@youngonesworks/ui 0.1.78 → 0.1.81

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.js CHANGED
@@ -1,30 +1,37 @@
1
1
  'use client';
2
2
 
3
3
 
4
+ import * as React$1 from "react";
4
5
  import React, { Fragment, cloneElement, createRef, forwardRef, isValidElement, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
5
6
  import { IconAlertCircle, IconArrowNarrowLeft, IconBold, IconCalendar, IconCheck, IconChevronDown, IconChevronLeft, IconChevronRight, IconChevronUp, IconCircleCheck, IconClearFormatting, IconEyeCheck, IconEyeOff, IconFilter, IconHeart, IconHeartFilled, IconItalic, IconList, IconListNumbers, IconMessageDots, IconSelector, IconUnderline, IconX } from "@tabler/icons-react";
6
- import { cn } from "@utils/cn";
7
+ import clsx from "clsx";
8
+ import { twMerge } from "tailwind-merge";
7
9
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
10
  import { Tooltip as Tooltip$1 } from "react-tooltip";
9
- import { ACTION_ICON_STYLE_VARIANT, COLOR, THEME_ICON_STYLE_VARIANT } from "@utils/enums";
10
- import formatIcon from "@utils/formatIcon";
11
- import clsx from "clsx";
12
11
  import { DayPicker, useDayPicker } from "react-day-picker";
13
12
  import { addMonths, format, setMonth } from "date-fns";
14
13
  import { enGB, fr, nl, nlBE } from "date-fns/locale";
15
14
  import { FloatingArrow, arrow, autoUpdate, flip, offset, shift, useClick, useDismiss, useFloating, useFocus, useHover, useInteractions, useRole } from "@floating-ui/react";
16
15
  import { createPortal } from "react-dom";
17
16
  import PhoneInput from "react-phone-input-2";
18
- import { Label as Label$1 } from "@components/label";
19
17
  import ReactSelect, { components } from "react-select";
20
- import { buttonVariants as buttonVariants$1 } from "@components/button/buttonVariants";
21
- import { UnstyledButton as UnstyledButton$1 } from "@components/unstyledButton";
22
18
  import { Placeholder } from "@tiptap/extension-placeholder";
23
19
  import { Underline } from "@tiptap/extension-underline";
24
20
  import { EditorContent, useEditor } from "@tiptap/react";
25
21
  import { StarterKit } from "@tiptap/starter-kit";
26
- import { isSSR } from "@utils/ssr";
27
22
 
23
+ //#region src/jsx-runtime-shim.ts
24
+ const jsx$1 = React$1.createElement;
25
+ const jsxs$1 = React$1.createElement;
26
+ const Fragment$2 = React$1.Fragment;
27
+
28
+ //#endregion
29
+ //#region src/utils/cn.ts
30
+ function cn(...inputs) {
31
+ return twMerge(clsx(inputs));
32
+ }
33
+
34
+ //#endregion
28
35
  //#region src/components/unstyledButton/index.tsx
29
36
  const UnstyledButton = forwardRef(({ className,...props }, ref) => /* @__PURE__ */ jsx("button", {
30
37
  type: "button",
@@ -87,6 +94,80 @@ const AccordionWrapper = ({ children, className }) => /* @__PURE__ */ jsx("div",
87
94
  children
88
95
  });
89
96
 
97
+ //#endregion
98
+ //#region src/utils/enums.ts
99
+ let ACTION_ICON_STYLE_VARIANT = /* @__PURE__ */ function(ACTION_ICON_STYLE_VARIANT$1) {
100
+ ACTION_ICON_STYLE_VARIANT$1["DEFAULT"] = "default";
101
+ ACTION_ICON_STYLE_VARIANT$1["TRANSPARENT"] = "transparent";
102
+ ACTION_ICON_STYLE_VARIANT$1["SMALL"] = "small";
103
+ ACTION_ICON_STYLE_VARIANT$1["ROUND"] = "round";
104
+ return ACTION_ICON_STYLE_VARIANT$1;
105
+ }({});
106
+ let THEME_ICON_STYLE_VARIANT = /* @__PURE__ */ function(THEME_ICON_STYLE_VARIANT$1) {
107
+ THEME_ICON_STYLE_VARIANT$1["PINK_WITH_BACKGROUND"] = "pink-with-background";
108
+ return THEME_ICON_STYLE_VARIANT$1;
109
+ }({});
110
+ let COLOR = /* @__PURE__ */ function(COLOR$1) {
111
+ COLOR$1["PRIMARY"] = "primary";
112
+ COLOR$1["BLACK"] = "black";
113
+ COLOR$1["NAVY_BLUE"] = "navy-blue";
114
+ COLOR$1["LIGHT_BLUE"] = "light-blue";
115
+ COLOR$1["LIGHT_BLUE_DISABLED"] = "light-blue-disabled";
116
+ COLOR$1["GREEN"] = "green";
117
+ COLOR$1["GREEN_LIGHT"] = "green-light";
118
+ COLOR$1["PINK"] = "pink";
119
+ COLOR$1["PINK_LIGHT"] = "pink-light";
120
+ COLOR$1["ORANGE"] = "orange";
121
+ COLOR$1["ORANGE_LIGHT"] = "orange-light";
122
+ COLOR$1["ACCENT_BLUE"] = "accent-blue";
123
+ COLOR$1["ACCENT_BLUE_LIGHT"] = "accent-blue-light";
124
+ COLOR$1["YELLOW"] = "yellow";
125
+ COLOR$1["CHECK"] = "check";
126
+ COLOR$1["WARNING"] = "warning";
127
+ COLOR$1["ERROR"] = "error";
128
+ COLOR$1["SUCCESS"] = "success";
129
+ COLOR$1["WARNING_LIGHT"] = "warning-light";
130
+ COLOR$1["ULTRA_LIGHT_BLUE"] = "ultra-light-blue";
131
+ COLOR$1["ULTRA_LIGHT_GRAY"] = "ultra-light-gray";
132
+ COLOR$1["TURQUOISE"] = "turquoise";
133
+ COLOR$1["RED"] = "red";
134
+ COLOR$1["GRAY"] = "gray";
135
+ COLOR$1["WHITE"] = "white";
136
+ COLOR$1["PURPLE"] = "purple";
137
+ COLOR$1["PURPLE_LIGHT"] = "purple-light";
138
+ COLOR$1["NAVY_BLUE_SHADES"] = "navy-blue-shades";
139
+ return COLOR$1;
140
+ }({});
141
+ let REGION = /* @__PURE__ */ function(REGION$1) {
142
+ REGION$1["NETHERLANDS"] = "nl";
143
+ REGION$1["BELGIUM"] = "nl-BE";
144
+ REGION$1["UNITED_KINGDOM"] = "gb";
145
+ return REGION$1;
146
+ }({});
147
+ let TOOLTIP_COLOR = /* @__PURE__ */ function(TOOLTIP_COLOR$1) {
148
+ TOOLTIP_COLOR$1["DEFAULT"] = "default";
149
+ TOOLTIP_COLOR$1["WHITE"] = "white";
150
+ return TOOLTIP_COLOR$1;
151
+ }({});
152
+
153
+ //#endregion
154
+ //#region src/utils/formatIcon.ts
155
+ const globalDefaultFormatAttributes = {};
156
+ /**
157
+ * Format icon with default attributes. Icon attributes will
158
+ * always supersede default attributes which in term will supersede
159
+ * global default attributes.
160
+ */
161
+ function formatIcon(icon, defaultFormatAttributes) {
162
+ if (!React.isValidElement(icon)) return icon;
163
+ return cloneElement(icon, {
164
+ ...globalDefaultFormatAttributes,
165
+ ...defaultFormatAttributes,
166
+ ...icon.props,
167
+ ...{ className: clsx(globalDefaultFormatAttributes.className, defaultFormatAttributes.className, icon.props.className) }
168
+ });
169
+ }
170
+
90
171
  //#endregion
91
172
  //#region src/components/actionIcon/index.tsx
92
173
  const ActionIcon = forwardRef(({ title, disabled = false, styleVariant = "default", icon, type = "button", "data-testid": testId, iconSize = 20, strokeWidth = 1, onClick, className,...props }, ref) => {
@@ -430,9 +511,9 @@ const TextInput = React.forwardRef(({ rightSection, leftSection, className, erro
430
511
  step,
431
512
  maxLength,
432
513
  className: clsx(`${loadingState ? "cursor-not-allowed" : ""}`, `${disabled ? "text-gray-500" : "text-gray-900"} selection:bg-turquoise-200 focus:border-turquoise-500 focus:ring-turquoise-500 active:border-turquoise-500 active:ring-turquoise-500 h-10 w-full rounded-[4px] border border-gray-200 bg-gray-50 px-3 text-sm font-normal outline-hidden ${rightSection && "pr-12"} ${leftSection && "pl-12"} ${error && "border-red-500 text-red-500 selection:bg-red-200 focus:border-red-500 focus:ring-red-500 focus:placeholder:text-red-500 active:border-red-500 active:ring-red-500"}`, className),
433
- "aria-busy": loadingState || void 0,
434
- "data-lpignore": enablePasswordManagerAutofill ? void 0 : "true",
435
- "data-1p-ignore": enablePasswordManagerAutofill ? void 0 : "true",
514
+ "aria-busy": loadingState || undefined,
515
+ "data-lpignore": enablePasswordManagerAutofill ? undefined : "true",
516
+ "data-1p-ignore": enablePasswordManagerAutofill ? undefined : "true",
436
517
  ref,
437
518
  ...props,
438
519
  type: password ? showPassword ? "text" : "password" : "text"
@@ -790,7 +871,7 @@ const Popover = forwardRef(({ content, children, hoverEnabled = false, passedOpe
790
871
  //#region src/components/datePickerInput/index.tsx
791
872
  const DatePickerInput = ({ lang, todayText, value, disabledFrom, disabledUntil, className, error, onChange, placeholder, label, disabled, minimalDropdownYears = 4 }) => {
792
873
  const [selected, setSelected] = useState(value);
793
- const today = /* @__PURE__ */ new Date();
874
+ const today = new Date();
794
875
  const [newMonth, setNewMonth] = useState(selected || today);
795
876
  const [dropdownOpened, setDropdownOpened] = useState({
796
877
  month: false,
@@ -871,7 +952,7 @@ const DatePickerInput = ({ lang, todayText, value, disabledFrom, disabledUntil,
871
952
  captionLayout: "dropdown",
872
953
  onMonthChange: (newMonth$1) => setNewMonth(newMonth$1),
873
954
  showOutsideDays: true,
874
- disabled: disabledFrom ? { before: disabledFrom } : disabledUntil ? { after: disabledUntil } : void 0,
955
+ disabled: disabledFrom ? { before: disabledFrom } : disabledUntil ? { after: disabledUntil } : undefined,
875
956
  className,
876
957
  classNames: {
877
958
  month_grid: "mt-3 max-w-[400px] border-t border-gray-100",
@@ -909,7 +990,7 @@ const DatePickerInput = ({ lang, todayText, value, disabledFrom, disabledUntil,
909
990
  Dropdown: (props) => {
910
991
  const { goToMonth, months } = useDayPicker();
911
992
  const { className: dropdownClassName } = props;
912
- const today$1 = /* @__PURE__ */ new Date();
993
+ const today$1 = new Date();
913
994
  /* istanbul ignore next - react-day-picker may not pass this className in our test env */
914
995
  if (dropdownClassName === "rdp-months_dropdown") {
915
996
  const selectedYear = newMonth.getFullYear();
@@ -957,8 +1038,8 @@ const DatePickerInput = ({ lang, todayText, value, disabledFrom, disabledUntil,
957
1038
  children: todayText
958
1039
  })] });
959
1040
  } else if (dropdownClassName === "rdp-years_dropdown") {
960
- const earliestYear = (/* @__PURE__ */ new Date()).getFullYear() - minimalDropdownYears;
961
- const latestYear = (/* @__PURE__ */ new Date()).getFullYear() + 1;
1041
+ const earliestYear = new Date().getFullYear() - minimalDropdownYears;
1042
+ const latestYear = new Date().getFullYear() + 1;
962
1043
  /* istanbul ignore else - defensive guard will always be truthy */
963
1044
  if (earliestYear && latestYear) {
964
1045
  const years = Array.from({ length: latestYear - earliestYear + 1 }, (_, i) => earliestYear + i).reverse();
@@ -977,7 +1058,7 @@ const DatePickerInput = ({ lang, todayText, value, disabledFrom, disabledUntil,
977
1058
  className: "shadow-dropdown absolute z-70 rounded-md border border-gray-50 bg-white max-h-64 overflow-y-auto",
978
1059
  children: years.map((year) => /* @__PURE__ */ jsx("div", {
979
1060
  onClick: () => {
980
- const newDate = months?.[0].date || /* @__PURE__ */ new Date();
1061
+ const newDate = months?.[0].date || new Date();
981
1062
  newDate.setFullYear(year);
982
1063
  goToMonth(newDate);
983
1064
  setDropdownOpened({
@@ -1022,11 +1103,11 @@ const DatePickerInput = ({ lang, todayText, value, disabledFrom, disabledUntil,
1022
1103
  className: "text-sm font-normal text-nowrap text-black",
1023
1104
  children: selected ? selected.toLocaleDateString() : placeholder
1024
1105
  }),
1025
- selected !== void 0 && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("span", {
1106
+ selected !== undefined && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("span", {
1026
1107
  className: "cursor-pointer text-sm font-normal text-gray-800",
1027
1108
  onClick: () => {
1028
- setSelected(void 0);
1029
- onChange?.(void 0);
1109
+ setSelected(undefined);
1110
+ onChange?.(undefined);
1030
1111
  },
1031
1112
  children: /* @__PURE__ */ jsx(IconX, { size: 15 })
1032
1113
  }) })
@@ -1693,6 +1774,10 @@ const PasswordInput = React.forwardRef((props, ref) => /* @__PURE__ */ jsx(TextI
1693
1774
  }));
1694
1775
  PasswordInput.displayName = "PasswordInput";
1695
1776
 
1777
+ //#endregion
1778
+ //#region node_modules/react-phone-input-2/lib/style.css
1779
+ var style_default = {};
1780
+
1696
1781
  //#endregion
1697
1782
  //#region src/components/phoneNumberInput/index.tsx
1698
1783
  const PhoneNumberInput = ({ setValue, setPhoneNumberExt, phoneNumberExt, isValid = true, phoneNumberError, phoneNumberExtensionError, phoneNumberField, phoneNumberExtField, className, label, disabled }) => {
@@ -1708,11 +1793,13 @@ const PhoneNumberInput = ({ setValue, setPhoneNumberExt, phoneNumberExt, isValid
1708
1793
  shouldDirty: true,
1709
1794
  shouldValidate: true
1710
1795
  });
1711
- if (setPhoneNumberExt) setPhoneNumberExt({
1712
- number: numberWithoutDialCode,
1713
- ext: dialCode,
1714
- countryCode: country.countryCode || ""
1715
- });
1796
+ if (setPhoneNumberExt) {
1797
+ setPhoneNumberExt({
1798
+ number: numberWithoutDialCode,
1799
+ ext: dialCode,
1800
+ countryCode: country.countryCode || ""
1801
+ });
1802
+ }
1716
1803
  }, [
1717
1804
  setValue,
1718
1805
  phoneNumberField,
@@ -1722,7 +1809,7 @@ const PhoneNumberInput = ({ setValue, setPhoneNumberExt, phoneNumberExt, isValid
1722
1809
  return /* @__PURE__ */ jsxs("div", {
1723
1810
  className: `${className}`,
1724
1811
  children: [
1725
- typeof label === "string" ? /* @__PURE__ */ jsx(Label$1, {
1812
+ typeof label === "string" ? /* @__PURE__ */ jsx(Label, {
1726
1813
  htmlFor: "phoneNumber",
1727
1814
  className: "mb-2",
1728
1815
  children: label
@@ -1793,7 +1880,7 @@ const RadioButton = ({ id, name, value, label, onChange, checked, dataTestId, cl
1793
1880
  id,
1794
1881
  name,
1795
1882
  value,
1796
- onChange: props.disabled ? void 0 : onChange,
1883
+ onChange: props.disabled ? undefined : onChange,
1797
1884
  checked,
1798
1885
  "data-testid": dataTestId,
1799
1886
  className: `${clsx(className, "ease checked:border-navyBlue checked:bg-navy-blue relative m-0 flex size-5 cursor-pointer appearance-none items-center justify-center rounded-full border border-gray-400 bg-white transition-colors duration-100 focus:ring-0 focus:outline-hidden focus-visible:ring-0", { "cursor-not-allowed opacity-50": props.disabled })}`,
@@ -2561,7 +2648,7 @@ const TabContent = forwardRef(({ tab, setActiveTab, activeTab }, ref) => /* @__P
2561
2648
  setActiveTab,
2562
2649
  activeTab: activeTab === tab.value,
2563
2650
  tabContent: tab.name,
2564
- rightSection: tab?.rightSection || void 0,
2651
+ rightSection: tab?.rightSection || undefined,
2565
2652
  clickFnc: () => {
2566
2653
  tab.clickFnc(tab.value);
2567
2654
  setActiveTab(tab.value);
@@ -2827,23 +2914,26 @@ const ProfileMenu = ({ title, metaTitle, icon, content, disabled = false, classN
2827
2914
  const buttonId = `${menuId}-button`;
2828
2915
  const defaultStyling = "text-black flex items-center gap-1 bg-transparent py-1 px-2.5 h-9 min-w-9 cursor-pointer border-gray-200 focus:bg-gray-50 focus:ring focus:ring-primary focus:outline-none focus:border-0 focus:ring-inset";
2829
2916
  const handleToggle = () => {
2830
- if (!disabled) setIsOpen((prev) => {
2831
- const newIsOpen = !prev;
2832
- /* istanbul ignore next - branch depends on async DOM focus */
2833
- if (newIsOpen) setTimeout(() => {
2834
- /* istanbul ignore next - async focus behavior depends on DOM/timing */
2835
- setFocusedIndex(0);
2836
- /* istanbul ignore next - async focus behavior depends on DOM/timing */
2837
- menuItemRefs.current[0]?.focus();
2838
- }, 0);
2839
- else {
2840
- /* istanbul ignore next - focus reset depends on DOM/timing */
2841
- setFocusedIndex(-1);
2842
- /* istanbul ignore next - focus reset depends on DOM/timing */
2843
- buttonRef.current?.focus();
2844
- }
2845
- return newIsOpen;
2846
- });
2917
+ if (!disabled) {
2918
+ setIsOpen((prev) => {
2919
+ const newIsOpen = !prev;
2920
+ /* istanbul ignore next - branch depends on async DOM focus */
2921
+ if (newIsOpen) {
2922
+ setTimeout(() => {
2923
+ /* istanbul ignore next - async focus behavior depends on DOM/timing */
2924
+ setFocusedIndex(0);
2925
+ /* istanbul ignore next - async focus behavior depends on DOM/timing */
2926
+ menuItemRefs.current[0]?.focus();
2927
+ }, 0);
2928
+ } else {
2929
+ /* istanbul ignore next - focus reset depends on DOM/timing */
2930
+ setFocusedIndex(-1);
2931
+ /* istanbul ignore next - focus reset depends on DOM/timing */
2932
+ buttonRef.current?.focus();
2933
+ }
2934
+ return newIsOpen;
2935
+ });
2936
+ }
2847
2937
  };
2848
2938
  /* istanbul ignore next - click handler behavior covered via integration; unit env flaky */
2849
2939
  const handleItemClick = (onClick) => {
@@ -2919,14 +3009,14 @@ const ProfileMenu = ({ title, metaTitle, icon, content, disabled = false, classN
2919
3009
  ref: menuRef,
2920
3010
  "data-context-menu-id": metaTitle,
2921
3011
  "data-context-menu-content": metaTitle,
2922
- children: [/* @__PURE__ */ jsxs(UnstyledButton$1, {
3012
+ children: [/* @__PURE__ */ jsxs(UnstyledButton, {
2923
3013
  ref: buttonRef,
2924
3014
  id: buttonId,
2925
3015
  "aria-label": "Toggle profile menu",
2926
3016
  "aria-expanded": isOpen,
2927
3017
  "aria-haspopup": "menu",
2928
- "aria-controls": isOpen ? menuId : void 0,
2929
- className: cn(buttonVariants$1["secondary"], defaultStyling, classNames?.button),
3018
+ "aria-controls": isOpen ? menuId : undefined,
3019
+ className: cn(buttonVariants["secondary"], defaultStyling, classNames?.button),
2930
3020
  disabled,
2931
3021
  onClick: handleToggle,
2932
3022
  children: [title && /* @__PURE__ */ jsx("span", {
@@ -2940,7 +3030,7 @@ const ProfileMenu = ({ title, metaTitle, icon, content, disabled = false, classN
2940
3030
  className: cn("absolute right-0 z-10 mt-2 w-auto min-w-[200px] rounded-md border-[0.0625rem] border-gray-200 bg-white p-1 shadow-md", classNames?.menu),
2941
3031
  children: content.map(
2942
3032
  /* istanbul ignore next - render callback not meaningful for unit coverage */
2943
- (c, index) => /* @__PURE__ */ jsx(UnstyledButton$1, {
3033
+ (c, index) => /* @__PURE__ */ jsx(UnstyledButton, {
2944
3034
  ref: (el) => {
2945
3035
  menuItemRefs.current[index] = el;
2946
3036
  },
@@ -2957,6 +3047,10 @@ const ProfileMenu = ({ title, metaTitle, icon, content, disabled = false, classN
2957
3047
  }) });
2958
3048
  };
2959
3049
 
3050
+ //#endregion
3051
+ //#region src/utils/ssr.ts
3052
+ const isSSR = () => typeof window === "undefined" || typeof document === "undefined";
3053
+
2960
3054
  //#endregion
2961
3055
  //#region src/components/wysiwygEditor/index.tsx
2962
3056
  const BoldIcon = () => /* @__PURE__ */ jsx(IconBold, {