@youngonesworks/ui 0.1.10 → 0.1.12

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
@@ -103385,6 +103385,204 @@ const Divider = ({ className,...props }) => /* @__PURE__ */ (0, react_jsx_runtim
103385
103385
  ...props
103386
103386
  });
103387
103387
 
103388
+ //#endregion
103389
+ //#region src/icons/IconLoading.tsx
103390
+ const IconLoading = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
103391
+ "data-component": "button",
103392
+ "data-testid": "loading-svg-button",
103393
+ viewBox: "0 0 256 256",
103394
+ ...props,
103395
+ children: [
103396
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103397
+ x1: "128",
103398
+ y1: "32",
103399
+ x2: "128",
103400
+ y2: "64",
103401
+ strokeLinecap: "round",
103402
+ strokeLinejoin: "round",
103403
+ strokeWidth: "24"
103404
+ }),
103405
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103406
+ x1: "195.9",
103407
+ y1: "60.1",
103408
+ x2: "173.3",
103409
+ y2: "82.7",
103410
+ strokeLinecap: "round",
103411
+ strokeLinejoin: "round",
103412
+ strokeWidth: "24"
103413
+ }),
103414
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103415
+ x1: "224",
103416
+ y1: "128",
103417
+ x2: "192",
103418
+ y2: "128",
103419
+ strokeLinecap: "round",
103420
+ strokeLinejoin: "round",
103421
+ strokeWidth: "24"
103422
+ }),
103423
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103424
+ x1: "195.9",
103425
+ y1: "195.9",
103426
+ x2: "173.3",
103427
+ y2: "173.3",
103428
+ strokeLinecap: "round",
103429
+ strokeLinejoin: "round",
103430
+ strokeWidth: "24"
103431
+ }),
103432
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103433
+ x1: "128",
103434
+ y1: "224",
103435
+ x2: "128",
103436
+ y2: "192",
103437
+ strokeLinecap: "round",
103438
+ strokeLinejoin: "round",
103439
+ strokeWidth: "24"
103440
+ }),
103441
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103442
+ x1: "60.1",
103443
+ y1: "195.9",
103444
+ x2: "82.7",
103445
+ y2: "173.3",
103446
+ strokeLinecap: "round",
103447
+ strokeLinejoin: "round",
103448
+ strokeWidth: "24"
103449
+ }),
103450
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103451
+ x1: "32",
103452
+ y1: "128",
103453
+ x2: "64",
103454
+ y2: "128",
103455
+ strokeLinecap: "round",
103456
+ strokeLinejoin: "round",
103457
+ strokeWidth: "24"
103458
+ }),
103459
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103460
+ x1: "60.1",
103461
+ y1: "60.1",
103462
+ x2: "82.7",
103463
+ y2: "82.7",
103464
+ strokeLinecap: "round",
103465
+ strokeLinejoin: "round",
103466
+ strokeWidth: "24"
103467
+ })
103468
+ ]
103469
+ });
103470
+
103471
+ //#endregion
103472
+ //#region src/components/button/buttonVariants.ts
103473
+ const defaultButtonStyling = "justify-center group relative flex items-center gap-2 cursor-pointer border rounded py-2 px-5 text-sx md:text-sm md:font-medium font-medium hover:outline-hidden focus:outline-hidden disabled:cursor-not-allowed transition-colors duration-100 ease-in-out";
103474
+ const buttonVariants = {
103475
+ primary: clsx_default(defaultButtonStyling, "border-transparent bg-primary text-black hover:bg-turquoise-700 hover:fill-white disabled:bg-turquoise-100 disabled:text-gray-800 disabled:hover:bg-turquoise-100"),
103476
+ secondary: clsx_default(defaultButtonStyling, "border-solid border-gray-200 bg-white text-black hover:border-gray-800 hover:bg-gray-50 hover:fill-white disabled:text-gray-800 disabled:hover:border-gray-200 disabled:hover:bg-white"),
103477
+ danger: clsx_default(defaultButtonStyling, "border-transparent bg-red-500 text-white hover:bg-red-700 disabled:bg-red-100 disabled:hover:bg-red-100"),
103478
+ link: clsx_default(defaultButtonStyling, "border-transparent bg-transparent text-accent-blue hover:bg-gray-50 disabled:bg-transparent disabled:text-gray-800 disabled:hover:bg-transparent"),
103479
+ outline: clsx_default(defaultButtonStyling, "border-solid border-gray-200 bg-transparent text-white hover:border-gray-800 hover:bg-[rgba(255,255,255,0.1)] disabled:text-gray-800 disabled:hover:border-gray-200 disabled:hover:bg-white"),
103480
+ search: clsx_default(defaultButtonStyling, "absolute top-0 right-0 h-full w-[50px] border-0 bg-transparent bg-no-repeat"),
103481
+ icon__primary: clsx_default(defaultButtonStyling, "flex! items-center justify-center"),
103482
+ icon__danger: clsx_default(defaultButtonStyling, "flex! items-center justify-center")
103483
+ };
103484
+
103485
+ //#endregion
103486
+ //#region src/components/button/index.tsx
103487
+ const Button = (0, react.forwardRef)(({ type = "button", variant = "primary", ariaLabel, block = false, isLoading = false, icon: iconFromProps = null, iconRight = false, onClick, className, children, dataTestId,...props }, ref) => {
103488
+ const icon = isLoading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconLoading, { className: "animate-spin-slow mr-2 stroke-current" }) : iconFromProps;
103489
+ const formattedIcon = formatIcon(icon, { className: clsx_default("size-[1.125rem]", {
103490
+ "-mr-2": iconRight,
103491
+ "-ml-2": !iconRight
103492
+ }) });
103493
+ const handleOnClick = (event) => {
103494
+ onClick && onClick(event);
103495
+ };
103496
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
103497
+ type,
103498
+ "aria-label": ariaLabel,
103499
+ "data-testid": dataTestId,
103500
+ className: cn(buttonVariants[variant], className, block && "w-full"),
103501
+ onClick: (event) => handleOnClick(event),
103502
+ ref,
103503
+ ...props,
103504
+ children: [
103505
+ !iconRight && formattedIcon,
103506
+ children,
103507
+ iconRight && formattedIcon
103508
+ ]
103509
+ });
103510
+ });
103511
+ Button.displayName = "Button";
103512
+
103513
+ //#endregion
103514
+ //#region src/components/filters/FilterButton.tsx
103515
+ const FilterButton = ({ onClick, hasFilters, reset, filtersText, resetText }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
103516
+ className: "flex gap-3",
103517
+ "data-testid": "filterButton",
103518
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, {
103519
+ onClick,
103520
+ variant: "secondary",
103521
+ className: "font-normal md:font-normal",
103522
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconFilter, { stroke: 1 }),
103523
+ children: filtersText
103524
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnstyledButton, {
103525
+ className: "text-sm font-normal disabled:text-gray-500",
103526
+ onClick: reset,
103527
+ disabled: !hasFilters,
103528
+ children: resetText
103529
+ })]
103530
+ });
103531
+
103532
+ //#endregion
103533
+ //#region src/components/filters/FilterItem.tsx
103534
+ const FilterItem = ({ title, isActive: isActive$1 = false, onClick }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
103535
+ className: cn("has-checked:border-primary has-checked:bg-turquoise-100 flex cursor-pointer items-center gap-3 rounded-full border border-gray-200 px-7 py-1.5 text-sm leading-6 font-normal transition-all duration-300 ease-in-out hover:bg-gray-50"),
103536
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
103537
+ type: "checkbox",
103538
+ className: "hidden",
103539
+ onChange: onClick,
103540
+ checked: isActive$1
103541
+ }), title]
103542
+ });
103543
+
103544
+ //#endregion
103545
+ //#region src/components/filters/index.tsx
103546
+ const Filters = ({ filters, setFilters, selectedFilters, selectedFiltersText, filtersText, resetText }) => {
103547
+ const content = (0, react.useRef)(null);
103548
+ const [showFilters, setShowFilters] = (0, react.useState)(false);
103549
+ const onFilter = (filter) => {
103550
+ if (selectedFilters.includes(filter)) setFilters(selectedFilters.filter((f$1) => f$1 !== filter));
103551
+ else setFilters([...selectedFilters, filter]);
103552
+ };
103553
+ (0, react.useEffect)(() => {
103554
+ setShowFilters(selectedFilters.length > 0);
103555
+ }, [selectedFilters]);
103556
+ const onReset = () => {
103557
+ setFilters([]);
103558
+ };
103559
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
103560
+ className: "grid justify-end gap-3",
103561
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
103562
+ className: "flex items-center justify-end gap-3",
103563
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
103564
+ className: "text-sm font-medium",
103565
+ children: selectedFiltersText
103566
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FilterButton, {
103567
+ onClick: () => setShowFilters(!showFilters),
103568
+ hasFilters: selectedFilters.length > 0,
103569
+ reset: () => onReset(),
103570
+ filtersText,
103571
+ resetText
103572
+ })]
103573
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
103574
+ ref: content,
103575
+ className: cn("flex flex-wrap justify-end gap-2 overflow-hidden opacity-0 ease-in-out [transition:max-height_0.4s,opacity_0.3s]", showFilters && "opacity-100"),
103576
+ style: { maxHeight: showFilters ? `${content?.current?.scrollHeight}px` : "0px" },
103577
+ children: filters.map((filter) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FilterItem, {
103578
+ title: filter,
103579
+ isActive: selectedFilters.includes(filter),
103580
+ onClick: () => onFilter(filter)
103581
+ }, filter))
103582
+ })]
103583
+ });
103584
+ };
103585
+
103388
103586
  //#endregion
103389
103587
  //#region src/components/googleAppButtonIcon/index.tsx
103390
103588
  const GoogleAppButtonIcon = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
@@ -109509,89 +109707,6 @@ const RadioButton = ({ id, name, value, label, onChange, checked, dataTestId, cl
109509
109707
  });
109510
109708
  RadioButton.displayName = "RadioButton";
109511
109709
 
109512
- //#endregion
109513
- //#region src/icons/IconLoading.tsx
109514
- const IconLoading = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
109515
- "data-component": "button",
109516
- "data-testid": "loading-svg-button",
109517
- viewBox: "0 0 256 256",
109518
- ...props,
109519
- children: [
109520
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
109521
- x1: "128",
109522
- y1: "32",
109523
- x2: "128",
109524
- y2: "64",
109525
- strokeLinecap: "round",
109526
- strokeLinejoin: "round",
109527
- strokeWidth: "24"
109528
- }),
109529
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
109530
- x1: "195.9",
109531
- y1: "60.1",
109532
- x2: "173.3",
109533
- y2: "82.7",
109534
- strokeLinecap: "round",
109535
- strokeLinejoin: "round",
109536
- strokeWidth: "24"
109537
- }),
109538
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
109539
- x1: "224",
109540
- y1: "128",
109541
- x2: "192",
109542
- y2: "128",
109543
- strokeLinecap: "round",
109544
- strokeLinejoin: "round",
109545
- strokeWidth: "24"
109546
- }),
109547
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
109548
- x1: "195.9",
109549
- y1: "195.9",
109550
- x2: "173.3",
109551
- y2: "173.3",
109552
- strokeLinecap: "round",
109553
- strokeLinejoin: "round",
109554
- strokeWidth: "24"
109555
- }),
109556
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
109557
- x1: "128",
109558
- y1: "224",
109559
- x2: "128",
109560
- y2: "192",
109561
- strokeLinecap: "round",
109562
- strokeLinejoin: "round",
109563
- strokeWidth: "24"
109564
- }),
109565
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
109566
- x1: "60.1",
109567
- y1: "195.9",
109568
- x2: "82.7",
109569
- y2: "173.3",
109570
- strokeLinecap: "round",
109571
- strokeLinejoin: "round",
109572
- strokeWidth: "24"
109573
- }),
109574
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
109575
- x1: "32",
109576
- y1: "128",
109577
- x2: "64",
109578
- y2: "128",
109579
- strokeLinecap: "round",
109580
- strokeLinejoin: "round",
109581
- strokeWidth: "24"
109582
- }),
109583
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
109584
- x1: "60.1",
109585
- y1: "60.1",
109586
- x2: "82.7",
109587
- y2: "82.7",
109588
- strokeLinecap: "round",
109589
- strokeLinejoin: "round",
109590
- strokeWidth: "24"
109591
- })
109592
- ]
109593
- });
109594
-
109595
109710
  //#endregion
109596
109711
  //#region src/icons/IconStarEmpty.tsx
109597
109712
  const IconStarEmpty = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
@@ -111809,9 +111924,9 @@ var jsx = function jsx$3(type, props) {
111809
111924
  }
111810
111925
  return react.createElement.apply(null, createElementArgArray);
111811
111926
  };
111812
- (function(_jsx$61) {
111927
+ (function(_jsx$65) {
111813
111928
  var JSX;
111814
- (function(_JSX) {})(JSX || (JSX = _jsx$61.JSX || (_jsx$61.JSX = {})));
111929
+ (function(_JSX) {})(JSX || (JSX = _jsx$65.JSX || (_jsx$65.JSX = {})));
111815
111930
  })(jsx || (jsx = {}));
111816
111931
  var Global = /* @__PURE__ */ withEmotionCache(function(props, cache) {
111817
111932
  var styles = props.styles;
@@ -136733,7 +136848,7 @@ function requireUseSyncExternalStoreShim_development() {
136733
136848
  return x$2 === y$2 && (x$2 !== 0 || 1 / x$2 === 1 / y$2) || x$2 !== x$2 && y$2 !== y$2;
136734
136849
  }
136735
136850
  var objectIs = typeof Object.is === "function" ? Object.is : is;
136736
- var useState$12 = React$1$1.useState, useEffect$9 = React$1$1.useEffect, useLayoutEffect$4 = React$1$1.useLayoutEffect, useDebugValue$1 = React$1$1.useDebugValue;
136851
+ var useState$13 = React$1$1.useState, useEffect$10 = React$1$1.useEffect, useLayoutEffect$4 = React$1$1.useLayoutEffect, useDebugValue$1 = React$1$1.useDebugValue;
136737
136852
  var didWarnOld18Alpha = false;
136738
136853
  var didWarnUncachedGetSnapshot = false;
136739
136854
  function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
@@ -136755,7 +136870,7 @@ function requireUseSyncExternalStoreShim_development() {
136755
136870
  }
136756
136871
  }
136757
136872
  }
136758
- var _useState = useState$12({ inst: {
136873
+ var _useState = useState$13({ inst: {
136759
136874
  value,
136760
136875
  getSnapshot
136761
136876
  } }), inst = _useState[0].inst, forceUpdate = _useState[1];
@@ -136770,7 +136885,7 @@ function requireUseSyncExternalStoreShim_development() {
136770
136885
  value,
136771
136886
  getSnapshot
136772
136887
  ]);
136773
- useEffect$9(function() {
136888
+ useEffect$10(function() {
136774
136889
  if (checkIfSnapshotChanged(inst)) {
136775
136890
  forceUpdate({ inst });
136776
136891
  }
@@ -137091,9 +137206,9 @@ function requireWithSelector_development() {
137091
137206
  }
137092
137207
  var objectIs = typeof Object.is === "function" ? Object.is : is;
137093
137208
  var useSyncExternalStore = shim$1.useSyncExternalStore;
137094
- var useRef$5 = React$1$1.useRef, useEffect$9 = React$1$1.useEffect, useMemo$3 = React$1$1.useMemo, useDebugValue$1 = React$1$1.useDebugValue;
137209
+ var useRef$6 = React$1$1.useRef, useEffect$10 = React$1$1.useEffect, useMemo$3 = React$1$1.useMemo, useDebugValue$1 = React$1$1.useDebugValue;
137095
137210
  function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual$1) {
137096
- var instRef = useRef$5(null);
137211
+ var instRef = useRef$6(null);
137097
137212
  var inst;
137098
137213
  if (instRef.current === null) {
137099
137214
  inst = {
@@ -137153,7 +137268,7 @@ function requireWithSelector_development() {
137153
137268
  isEqual$1
137154
137269
  ]), getSelection$1 = _useMemo[0], getServerSelection = _useMemo[1];
137155
137270
  var value = useSyncExternalStore(subscribe, getSelection$1, getServerSelection);
137156
- useEffect$9(function() {
137271
+ useEffect$10(function() {
137157
137272
  inst.hasValue = true;
137158
137273
  inst.value = value;
137159
137274
  }, [value]);
@@ -140185,6 +140300,7 @@ exports.BigBadge = BigBadge;
140185
140300
  exports.BreadCrumb = BreadCrumb;
140186
140301
  exports.Checkbox = Checkbox;
140187
140302
  exports.Divider = Divider;
140303
+ exports.Filters = Filters;
140188
140304
  exports.GoogleAppButtonIcon = GoogleAppButtonIcon;
140189
140305
  exports.HR = HR;
140190
140306
  exports.HamburgerMenuButton = HamburgerMenuButton;