@youngonesworks/ui 0.1.101 → 0.1.104

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
@@ -3,7 +3,7 @@
3
3
 
4
4
  import * as React$1 from "react";
5
5
  import React, { Fragment, cloneElement, createRef, forwardRef, isValidElement, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
6
- import { IconAlertCircle, IconAlertTriangle, 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 { IconAlertCircle, IconAlertTriangle, IconArrowNarrowLeft, IconBold, IconCalendar, IconCheck, IconChevronDown, IconChevronLeft, IconChevronRight, IconChevronUp, IconCircleCheck, IconClearFormatting, IconDotsVertical, IconEyeCheck, IconEyeOff, IconFilter, IconHeart, IconHeartFilled, IconItalic, IconList, IconListNumbers, IconMessageDots, IconSearch, IconSelector, IconUnderline, IconX } from "@tabler/icons-react";
7
7
  import clsx from "clsx";
8
8
  import { twMerge } from "tailwind-merge";
9
9
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -11,9 +11,8 @@ import { Tooltip as Tooltip$1 } from "react-tooltip";
11
11
  import { DayPicker, useDayPicker } from "react-day-picker";
12
12
  import { addMonths, format, setMonth } from "date-fns";
13
13
  import { enGB, fr, nl, nlBE } from "date-fns/locale";
14
- import { FloatingArrow, arrow, autoUpdate, flip, offset, shift, useClick, useDismiss, useFloating, useFocus, useHover, useInteractions, useRole } from "@floating-ui/react";
14
+ import { FloatingArrow, FloatingFocusManager, FloatingPortal, arrow, autoUpdate, flip, offset, shift, useClick, useDismiss, useFloating, useFocus, useHover, useInteractions, useRole } from "@floating-ui/react";
15
15
  import { createPortal } from "react-dom";
16
- import ReactSelect, { components } from "react-select";
17
16
  import { Placeholder } from "@tiptap/extension-placeholder";
18
17
  import { Underline } from "@tiptap/extension-underline";
19
18
  import { EditorContent, useEditor } from "@tiptap/react";
@@ -223,7 +222,7 @@ const Alert = ({ show, title, description, type = "warning", button, plain = fal
223
222
  };
224
223
  const config = typeConfig[type];
225
224
  const { bg, iconColor, Icon } = config;
226
- const descriptionId = description ? `alert-desc` : undefined;
225
+ const descriptionId = description ? "alert-desc" : undefined;
227
226
  return /* @__PURE__ */ jsxs("div", {
228
227
  role: "alert",
229
228
  "aria-live": "assertive",
@@ -252,11 +251,15 @@ const Alert = ({ show, title, description, type = "warning", button, plain = fal
252
251
  children: title
253
252
  })]
254
253
  }),
255
- description && /* @__PURE__ */ jsx("p", {
254
+ description && (typeof description === "string" ? /* @__PURE__ */ jsx("p", {
256
255
  id: descriptionId,
257
256
  className: "text-sm text-color-gray-900",
258
257
  children: description
259
- }),
258
+ }) : /* @__PURE__ */ jsx("div", {
259
+ id: descriptionId,
260
+ className: "text-sm text-color-gray-900",
261
+ children: description
262
+ })),
260
263
  button && /* @__PURE__ */ jsx("div", { children: button })
261
264
  ]
262
265
  }), closable && /* @__PURE__ */ jsx("button", {
@@ -1487,6 +1490,166 @@ const Island = ({ children, className, noShadow = false, noPadding = false,...pr
1487
1490
  });
1488
1491
  Island.displayName = "Island";
1489
1492
 
1493
+ //#endregion
1494
+ //#region src/components/tooltip/index.tsx
1495
+ const sizeClasses = {
1496
+ xs: "max-w-xs",
1497
+ sm: "max-w-sm",
1498
+ md: "max-w-md",
1499
+ lg: "max-w-lg"
1500
+ };
1501
+ const Tooltip = ({ content, children, passedOpen = false, size = "md", variant = "default" }) => {
1502
+ const [isOpen, setIsOpen] = useState(passedOpen);
1503
+ const arrowRef = useRef(null);
1504
+ const { refs, floatingStyles, context } = useFloating({
1505
+ open: isOpen,
1506
+ onOpenChange: setIsOpen,
1507
+ placement: "top",
1508
+ middleware: [
1509
+ variant === "default" ? offset(20) : offset(25),
1510
+ flip(),
1511
+ shift(),
1512
+ arrow({ element: arrowRef })
1513
+ ],
1514
+ whileElementsMounted: autoUpdate
1515
+ });
1516
+ const hover = useHover(context, { move: false });
1517
+ const focus = useFocus(context);
1518
+ const dismiss = useDismiss(context);
1519
+ const role = useRole(context, { role: "tooltip" });
1520
+ const { getReferenceProps, getFloatingProps } = useInteractions([
1521
+ hover,
1522
+ focus,
1523
+ dismiss,
1524
+ role
1525
+ ]);
1526
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [isValidElement(children) && cloneElement(children, getReferenceProps({
1527
+ ref: refs.setReference,
1528
+ ...children.props,
1529
+ ...getReferenceProps()
1530
+ })), isOpen && /* @__PURE__ */ jsx("div", {
1531
+ ref: refs.setFloating,
1532
+ style: floatingStyles,
1533
+ ...getFloatingProps(),
1534
+ className: "z-70 drop-shadow-xl",
1535
+ "data-testid": "tooltip",
1536
+ "data-component": "tooltip",
1537
+ children: variant === "default" ? /* @__PURE__ */ jsxs("div", {
1538
+ "data-testid": "tooltip-container",
1539
+ className: "w-full rounded bg-gray-800 pt-[3px] text-white",
1540
+ children: [/* @__PURE__ */ jsx("div", {
1541
+ "data-testid": "tooltip-content",
1542
+ className: `${sizeClasses[size]} px-2 py-1 text-sm font-normal`,
1543
+ children: content
1544
+ }), /* @__PURE__ */ jsx(FloatingArrow, {
1545
+ ref: arrowRef,
1546
+ context,
1547
+ width: 10,
1548
+ height: 6,
1549
+ tipRadius: 1,
1550
+ "data-testid": "tooltip-arrow",
1551
+ className: "fill-gray-800 drop-shadow-xl"
1552
+ })]
1553
+ }) : /* @__PURE__ */ jsxs("div", {
1554
+ "data-testid": "tooltip-container",
1555
+ className: "bg-linear-gradient-x pt-[3px]",
1556
+ children: [/* @__PURE__ */ jsx("div", {
1557
+ "data-testid": "tooltip-content",
1558
+ className: `${sizeClasses[size]} overflow-hidden bg-white p-5 px-2 py-1 text-start text-sm font-normal`,
1559
+ children: /* @__PURE__ */ jsx("p", { children: content })
1560
+ }), size === "md" ? /* @__PURE__ */ jsx(FloatingArrow, {
1561
+ ref: arrowRef,
1562
+ context,
1563
+ width: 25,
1564
+ height: 17,
1565
+ tipRadius: 1,
1566
+ fill: "white",
1567
+ className: "drop-shadow-xl",
1568
+ "data-testid": "tooltip-arrow"
1569
+ }) : /* @__PURE__ */ jsx(FloatingArrow, {
1570
+ ref: arrowRef,
1571
+ context,
1572
+ width: 10,
1573
+ height: 6,
1574
+ tipRadius: 1,
1575
+ fill: "white",
1576
+ className: "drop-shadow-xl",
1577
+ "data-testid": "tooltip-arrow"
1578
+ })]
1579
+ })
1580
+ })] });
1581
+ };
1582
+ Tooltip.displayName = "Tooltip";
1583
+
1584
+ //#endregion
1585
+ //#region src/components/kebabMenu/index.tsx
1586
+ const KebabMenu = ({ title, content, disabled = false, styleVariant = "default" }) => {
1587
+ const [isOpen, setIsOpen] = useState(false);
1588
+ const menuRef = useRef(null);
1589
+ const defaultStyling = "text-black flex items-center justify-self-end gap-1 bg-transparent font-medium py-1 h-9 min-w-9 cursor-pointer px-0";
1590
+ const handleToggle = () => {
1591
+ if (!disabled) setIsOpen((prev) => !prev);
1592
+ };
1593
+ const handleItemClick = (onClick) => {
1594
+ if (!disabled) {
1595
+ onClick();
1596
+ setIsOpen(false);
1597
+ }
1598
+ };
1599
+ const handleClickOutside = (event) => {
1600
+ if (menuRef.current && !menuRef.current.contains(event.target)) setIsOpen(false);
1601
+ };
1602
+ useEffect(() => {
1603
+ document.addEventListener("mousedown", handleClickOutside);
1604
+ return () => {
1605
+ document.removeEventListener("mousedown", handleClickOutside);
1606
+ };
1607
+ }, []);
1608
+ return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsxs("div", {
1609
+ className: "relative",
1610
+ "data-component": "kebabMenu",
1611
+ "data-testid": "kebab-menu",
1612
+ ref: menuRef,
1613
+ "data-tooltip-id": title,
1614
+ "data-tooltip-content": title,
1615
+ children: [/* @__PURE__ */ jsxs(UnstyledButton, {
1616
+ "aria-label": "Options Menu",
1617
+ className: cn(buttonVariants["secondary"], defaultStyling, {
1618
+ "md:pr-3.5 md:pl-5": title,
1619
+ "h-7 min-w-7": styleVariant === "small"
1620
+ }),
1621
+ disabled,
1622
+ onClick: handleToggle,
1623
+ children: [title && /* @__PURE__ */ jsx("span", {
1624
+ className: "hidden md:block",
1625
+ children: title
1626
+ }), /* @__PURE__ */ jsx(IconDotsVertical, {
1627
+ size: 20,
1628
+ stroke: 1,
1629
+ fill: "black"
1630
+ })]
1631
+ }), isOpen && /* @__PURE__ */ jsx("div", {
1632
+ className: "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",
1633
+ children: content.map((c, index) => {
1634
+ const button = /* @__PURE__ */ jsx(UnstyledButton, {
1635
+ onClick: () => handleItemClick(c.onClick),
1636
+ className: "w-full rounded-md px-4 py-2 text-left text-sm font-normal whitespace-nowrap hover:bg-gray-50",
1637
+ "aria-label": "Options Menu Item",
1638
+ disabled: c.disabled,
1639
+ children: c.title
1640
+ });
1641
+ return c.tooltip ? /* @__PURE__ */ jsx(Tooltip, {
1642
+ passedOpen: false,
1643
+ size: "sm",
1644
+ content: c.tooltip,
1645
+ children: button
1646
+ }, index) : /* @__PURE__ */ jsx(React.Fragment, { children: button }, index);
1647
+ })
1648
+ })]
1649
+ }) });
1650
+ };
1651
+ KebabMenu.displayName = "KebabMenu";
1652
+
1490
1653
  //#endregion
1491
1654
  //#region src/components/label/index.tsx
1492
1655
  const Label = ({ children, className,...props }) => /* @__PURE__ */ jsx("label", {
@@ -2128,182 +2291,302 @@ const SearchInput = ({ placeholder, value, onChange, className, rightSection,...
2128
2291
  });
2129
2292
 
2130
2293
  //#endregion
2131
- //#region src/components/select/index.tsx
2132
- const LANGUAGE_FLAGS = [
2133
- {
2134
- value: "nl-NL",
2135
- altValue: "nl_NL",
2136
- label: "nl"
2137
- },
2138
- {
2139
- value: "nl-BE",
2140
- altValue: "nl_BE",
2141
- label: "be"
2142
- },
2143
- {
2144
- value: "en-GB",
2145
- altValue: "en_GB",
2146
- label: "gb"
2147
- },
2148
- {
2149
- value: "fr-FR",
2150
- altValue: "fr_FR",
2151
- label: "fr"
2152
- }
2153
- ];
2154
- const selectStyles = {
2155
- singleValue: (provided) => ({
2156
- ...provided,
2157
- fontSize: "14px"
2158
- }),
2159
- placeholder: (provided) => ({
2160
- ...provided,
2161
- color: "#838383",
2162
- fontSize: "14px",
2163
- textWrap: "nowrap"
2164
- }),
2165
- dropdownIndicator: (provided) => ({
2166
- ...provided,
2167
- color: "black"
2168
- }),
2169
- option: (base, { isFocused, isSelected }) => ({
2170
- ...base,
2171
- color: "black",
2172
- marginLeft: "4px",
2173
- marginRight: "4px",
2174
- backgroundColor: isSelected ? "#f8f8f8" : isFocused ? "#f8f8f8" : "transparent",
2175
- width: "calc(100% - 8px)",
2176
- cursor: "pointer"
2177
- }),
2178
- menuList: (provided) => ({
2179
- ...provided,
2180
- fontSize: "14px"
2181
- })
2182
- };
2183
- const selectTheme = (theme) => ({
2184
- ...theme,
2185
- borderRadius: 4,
2186
- colors: {
2187
- ...theme.colors,
2188
- primary25: "#f8f8f8",
2189
- primary: "#f8f8f8"
2190
- }
2191
- });
2192
- const Select = forwardRef(({ options, placeholder, defaultValue, label, id, icon, error, className, labelClassNames, showLangFlags = false, hideErrorText = false, isClearable = true, fullWidth = true, width, isDisabled,...props }, ref) => {
2193
- const DropdownIndicator = (props$1) => /* @__PURE__ */ jsx(components.DropdownIndicator, {
2194
- ...props$1,
2195
- children: props$1.hasValue && isClearable ? /* @__PURE__ */ jsx(IconX, {
2196
- "data-testid": "icon-x",
2197
- className: "cursor-pointer",
2198
- size: 16,
2199
- color: "black",
2200
- onClick: () => props$1.clearValue()
2201
- }) : /* @__PURE__ */ jsx(IconSelector, {
2202
- size: 16,
2203
- color: "black"
2204
- })
2205
- });
2206
- const GroupHeading = ({ children }) => /* @__PURE__ */ jsxs("div", {
2207
- className: "flex items-stretch px-4 py-2 font-normal text-[#838383] capitalize",
2208
- children: [/* @__PURE__ */ jsx("span", {
2209
- className: "flex-nowrap whitespace-nowrap",
2210
- children
2211
- }), /* @__PURE__ */ jsx("span", {
2212
- className: "ml-2 flex w-full flex-1 items-center justify-center",
2213
- children: /* @__PURE__ */ jsx("span", { className: "h-px w-full bg-[#838383]" })
2214
- })]
2215
- });
2216
- const LanguageControl = ({ children,...props$1 }) => {
2217
- const getSelectedFlag = () => {
2218
- const selectValue = props$1.selectProps.value;
2219
- const findFlag = (value) => LANGUAGE_FLAGS.find((e) => e.value === value || e.altValue === value)?.label || "";
2220
- if (typeof selectValue === "string") return findFlag(selectValue);
2221
- if (typeof selectValue === "object" && selectValue !== null && "value" in selectValue) return findFlag(selectValue.value);
2222
- return null;
2223
- };
2224
- const selectedFlag = getSelectedFlag();
2225
- return /* @__PURE__ */ jsxs(components.Control, {
2226
- ...props$1,
2227
- children: [selectedFlag && /* @__PURE__ */ jsx("div", {
2228
- className: "flex h-[39px] items-center border-r border-gray-200 p-3",
2229
- children: /* @__PURE__ */ jsx("img", {
2230
- src: `/images/countries/${selectedFlag.toUpperCase()}_flag.svg`,
2231
- alt: "",
2232
- width: 24,
2233
- height: 24
2234
- })
2235
- }), children]
2294
+ //#region src/hooks/useDebouncedValue.ts
2295
+ function useDebouncedValue(value, delay = 200) {
2296
+ const [debouncedValue, setDebouncedValue] = useState(value);
2297
+ useEffect(() => {
2298
+ const handler = setTimeout(() => setDebouncedValue(value), delay);
2299
+ return () => clearTimeout(handler);
2300
+ }, [value, delay]);
2301
+ return debouncedValue;
2302
+ }
2303
+
2304
+ //#endregion
2305
+ //#region src/hooks/useMergeRefs.ts
2306
+ function useMergeRefs(...refs) {
2307
+ return useCallback((value) => {
2308
+ refs.forEach((ref) => {
2309
+ if (typeof ref === "function") {
2310
+ ref(value);
2311
+ } else if (ref) {
2312
+ ref.current = value;
2313
+ }
2236
2314
  });
2237
- };
2238
- const NoOptionsMessage = (props$1) => /* @__PURE__ */ jsx(components.NoOptionsMessage, {
2239
- ...props$1,
2240
- children: "noOptionsMessage"
2241
- });
2242
- const SingleValue = ({ children,...props$1 }) => /* @__PURE__ */ jsx(components.SingleValue, {
2243
- ...props$1,
2244
- children: /* @__PURE__ */ jsxs("span", {
2245
- className: "flex items-center",
2246
- children: [icon && icon, /* @__PURE__ */ jsx("span", {
2247
- className: "mx-2",
2248
- children
2249
- })]
2250
- })
2315
+ }, [refs]);
2316
+ }
2317
+
2318
+ //#endregion
2319
+ //#region src/components/select/index.tsx
2320
+ function Select({ id, options, placeholder, label, errorText, hideError = false, isClearable = false, disabled = false, multiSelect = false, searchable = false, value, defaultValue, onValueChange, className, searchPlaceholder, noResultsText,...props }) {
2321
+ const innerRef = useRef(null);
2322
+ const buttonRef = useRef(null);
2323
+ const optionRefs = useRef([]);
2324
+ const mergedRef = useMergeRefs(innerRef, props.ref);
2325
+ const [internalValue, setInternalValue] = useState(defaultValue);
2326
+ const [open, setOpen] = useState(false);
2327
+ const [searchTerm, setSearchTerm] = useState("");
2328
+ const [focusedIndex, setFocusedIndex] = useState(-1);
2329
+ const debouncedSearch = useDebouncedValue(searchTerm);
2330
+ const isControlled = value !== undefined;
2331
+ const currentValue = isControlled ? value : internalValue;
2332
+ const selectedLabels = useMemo(() => {
2333
+ if (Array.isArray(currentValue)) {
2334
+ return options.filter((o) => currentValue.includes(o.value)).map((o) => o.label).join(", ");
2335
+ }
2336
+ return options.find((o) => o.value === currentValue)?.label;
2337
+ }, [currentValue, options]);
2338
+ const { refs, floatingStyles, context } = useFloating({
2339
+ open,
2340
+ onOpenChange: setOpen,
2341
+ middleware: [
2342
+ offset(4),
2343
+ flip(),
2344
+ shift()
2345
+ ],
2346
+ whileElementsMounted: autoUpdate,
2347
+ placement: "bottom-start"
2251
2348
  });
2349
+ const click = useClick(context);
2350
+ const dismiss = useDismiss(context);
2351
+ const role = useRole(context, { role: "combobox" });
2352
+ const { getReferenceProps, getFloatingProps } = useInteractions([
2353
+ click,
2354
+ dismiss,
2355
+ role
2356
+ ]);
2357
+ const handleSelect = useCallback((val) => {
2358
+ if (multiSelect) {
2359
+ const current = Array.isArray(currentValue) ? currentValue : [];
2360
+ const newValues = current.includes(val) ? current.filter((v) => v !== val) : [...current, val];
2361
+ if (!isControlled) setInternalValue(newValues);
2362
+ onValueChange?.(newValues);
2363
+ } else {
2364
+ if (!isControlled) setInternalValue(val);
2365
+ onValueChange?.(val);
2366
+ setOpen(false);
2367
+ buttonRef.current?.focus();
2368
+ }
2369
+ }, [
2370
+ multiSelect,
2371
+ currentValue,
2372
+ isControlled,
2373
+ onValueChange
2374
+ ]);
2375
+ const handleClear = useCallback((e) => {
2376
+ e.preventDefault();
2377
+ e.stopPropagation();
2378
+ if (!isControlled) setInternalValue(undefined);
2379
+ onValueChange?.(undefined);
2380
+ setSearchTerm("");
2381
+ }, [isControlled, onValueChange]);
2382
+ const showPlaceholder = !currentValue || Array.isArray(currentValue) && currentValue.length === 0;
2383
+ const filteredOptions = useMemo(() => {
2384
+ if (!debouncedSearch.trim()) return options;
2385
+ return options.filter((opt) => opt.label.toLowerCase().includes(debouncedSearch.toLowerCase()));
2386
+ }, [options, debouncedSearch]);
2387
+ const handleKeyDown = useCallback((event) => {
2388
+ if (disabled) return;
2389
+ if (!open) {
2390
+ if (event.key === "ArrowDown" || event.key === "Enter" || event.key === " ") {
2391
+ event.preventDefault();
2392
+ setOpen(true);
2393
+ setTimeout(() => {
2394
+ setFocusedIndex(0);
2395
+ optionRefs.current[0]?.focus();
2396
+ }, 0);
2397
+ }
2398
+ return;
2399
+ }
2400
+ switch (event.key) {
2401
+ case "Escape":
2402
+ event.preventDefault();
2403
+ setOpen(false);
2404
+ setFocusedIndex(-1);
2405
+ buttonRef.current?.focus();
2406
+ break;
2407
+ case "ArrowDown":
2408
+ event.preventDefault();
2409
+ setFocusedIndex((prev) => {
2410
+ const next = prev < filteredOptions.length - 1 ? prev + 1 : 0;
2411
+ optionRefs.current[next]?.focus();
2412
+ return next;
2413
+ });
2414
+ break;
2415
+ case "ArrowUp":
2416
+ event.preventDefault();
2417
+ setFocusedIndex((prev) => {
2418
+ const next = prev > 0 ? prev - 1 : filteredOptions.length - 1;
2419
+ optionRefs.current[next]?.focus();
2420
+ return next;
2421
+ });
2422
+ break;
2423
+ case "Home":
2424
+ event.preventDefault();
2425
+ setFocusedIndex(0);
2426
+ optionRefs.current[0]?.focus();
2427
+ break;
2428
+ case "End":
2429
+ event.preventDefault();
2430
+ setFocusedIndex(filteredOptions.length - 1);
2431
+ optionRefs.current[filteredOptions.length - 1]?.focus();
2432
+ break;
2433
+ case "Enter":
2434
+ case " ":
2435
+ event.preventDefault();
2436
+ if (focusedIndex >= 0 && filteredOptions[focusedIndex]) {
2437
+ handleSelect(filteredOptions[focusedIndex].value);
2438
+ }
2439
+ break;
2440
+ }
2441
+ }, [
2442
+ open,
2443
+ filteredOptions,
2444
+ focusedIndex,
2445
+ handleSelect,
2446
+ disabled
2447
+ ]);
2448
+ useEffect(() => {
2449
+ if (!open) return;
2450
+ const listener = (e) => handleKeyDown(e);
2451
+ document.addEventListener("keydown", listener);
2452
+ return () => document.removeEventListener("keydown", listener);
2453
+ }, [open, handleKeyDown]);
2454
+ useEffect(() => {
2455
+ if (!open) setSearchTerm("");
2456
+ }, [open]);
2252
2457
  return /* @__PURE__ */ jsxs("div", {
2458
+ ref: mergedRef,
2459
+ ...props,
2253
2460
  "data-component": "Select",
2254
- "data-testid": "select-container",
2255
- ref,
2256
- className: clsx("m-0 grid gap-2 p-0", width ? width : fullWidth && "w-full", className),
2461
+ className: cn("grid gap-2 w-full", className),
2462
+ role: "group",
2463
+ "aria-labelledby": `${id}-label`,
2257
2464
  children: [
2258
- label && /* @__PURE__ */ jsx(Label, {
2259
- className: cn("leading-4", labelClassNames),
2260
- children: label
2465
+ label && /* @__PURE__ */ jsxs("div", {
2466
+ className: "leading-4",
2467
+ children: [/* @__PURE__ */ jsx(Label, {
2468
+ htmlFor: id,
2469
+ children: label
2470
+ }), /* @__PURE__ */ jsx("span", {
2471
+ id: `${id}-label`,
2472
+ className: "sr-only",
2473
+ children: label
2474
+ })]
2261
2475
  }),
2262
- /* @__PURE__ */ jsx(ReactSelect, {
2263
- "data-component": "select",
2264
- "data-testid": "select-input",
2265
- options,
2266
- menuPlacement: "auto",
2267
- isDisabled,
2268
- defaultValue,
2269
- placeholder,
2270
- isClearable: false,
2271
- menuPortalTarget: document?.body,
2272
- styles: {
2273
- ...selectStyles,
2274
- control: (base, state) => ({
2275
- ...base,
2276
- "&:hover": { borderColor: "#A8A8A8" },
2277
- height: "40px",
2278
- width: "100%",
2279
- backgroundColor: "#fbfbfb",
2280
- borderColor: error ? "red" : state.isFocused ? "#10d1bb" : "#cccccc",
2281
- cursor: "pointer"
2282
- }),
2283
- menuPortal: (base) => ({
2284
- ...base,
2285
- zIndex: 99999
2286
- })
2287
- },
2288
- theme: selectTheme,
2289
- components: {
2290
- IndicatorSeparator: () => null,
2291
- DropdownIndicator,
2292
- GroupHeading,
2293
- Control: showLangFlags ? LanguageControl : components.Control,
2294
- SingleValue,
2295
- NoOptionsMessage
2476
+ /* @__PURE__ */ jsxs("button", {
2477
+ id,
2478
+ type: "button",
2479
+ ref: (node) => {
2480
+ refs.setReference(node);
2481
+ buttonRef.current = node;
2296
2482
  },
2297
- ...props
2298
- }, id),
2299
- !hideErrorText && error && /* @__PURE__ */ jsx("small", {
2300
- className: "text-xs font-normal text-red-500",
2483
+ ...getReferenceProps(),
2484
+ disabled,
2485
+ className: cn("flex h-10 w-full items-center justify-between rounded-md border px-3 text-sm transition-colors bg-gray-20", "border-gray-200 hover:border-gray-300 focus:border-gray-300 outline-none", !hideError && errorText && "border-red-500 hover:border-red-500 focus:border-red-500", disabled && "opacity-50 cursor-not-allowed"),
2486
+ "aria-haspopup": "listbox",
2487
+ "aria-expanded": open,
2488
+ "aria-disabled": disabled,
2489
+ "aria-labelledby": `${id}-label`,
2490
+ "aria-controls": `${id}-listbox`,
2491
+ children: [/* @__PURE__ */ jsx("div", {
2492
+ className: "flex items-center gap-2 truncate text-black",
2493
+ children: showPlaceholder ? /* @__PURE__ */ jsx("span", {
2494
+ className: "text-gray-200",
2495
+ "aria-hidden": "true",
2496
+ children: placeholder
2497
+ }) : /* @__PURE__ */ jsx("span", {
2498
+ className: "truncate",
2499
+ children: selectedLabels
2500
+ })
2501
+ }), isClearable && !showPlaceholder ? /* @__PURE__ */ jsx(IconX, {
2502
+ size: 16,
2503
+ color: "black",
2504
+ className: "cursor-pointer",
2505
+ "data-testid": "clear-button",
2506
+ onPointerDown: handleClear,
2507
+ role: "button",
2508
+ "aria-label": "Clear selection"
2509
+ }) : /* @__PURE__ */ jsx(IconSelector, {
2510
+ size: 16,
2511
+ color: "black",
2512
+ "aria-hidden": "true"
2513
+ })]
2514
+ }),
2515
+ open && /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(FloatingFocusManager, {
2516
+ context,
2517
+ modal: false,
2518
+ children: /* @__PURE__ */ jsx("div", {
2519
+ ref: refs.setFloating,
2520
+ style: {
2521
+ ...floatingStyles,
2522
+ width: refs.reference.current?.offsetWidth ?? "auto"
2523
+ },
2524
+ ...getFloatingProps(),
2525
+ id: `${id}-listbox`,
2526
+ role: "listbox",
2527
+ "aria-labelledby": `${id}-label`,
2528
+ className: cn("z-[99999] mt-2 rounded-md border border-gray-200 bg-white shadow-md", "overflow-hidden animate-in fade-in"),
2529
+ children: /* @__PURE__ */ jsxs("div", {
2530
+ className: "p-1 text-sm max-h-[250px] overflow-auto",
2531
+ children: [searchable && /* @__PURE__ */ jsxs("div", {
2532
+ className: "flex items-center gap-2 px-2 py-1 border-b border-gray-100 sticky top-0 bg-white",
2533
+ role: "search",
2534
+ children: [/* @__PURE__ */ jsx(IconSearch, {
2535
+ size: 14,
2536
+ className: "text-gray-400",
2537
+ "aria-hidden": "true"
2538
+ }), /* @__PURE__ */ jsx("input", {
2539
+ type: "text",
2540
+ autoFocus: true,
2541
+ value: searchTerm,
2542
+ onChange: (e) => setSearchTerm(e.target.value),
2543
+ placeholder: searchPlaceholder,
2544
+ className: "w-full text-sm outline-none bg-transparent placeholder-gray-300",
2545
+ "aria-label": "Search options"
2546
+ })]
2547
+ }), /* @__PURE__ */ jsx("div", {
2548
+ className: "mt-1 pr-2",
2549
+ children: filteredOptions.length ? filteredOptions.map((opt, index) => {
2550
+ const isSelected = Array.isArray(currentValue) ? currentValue.includes(opt.value) : currentValue === opt.value;
2551
+ return /* @__PURE__ */ jsxs("button", {
2552
+ ref: (el) => optionRefs.current[index] = el,
2553
+ type: "button",
2554
+ onClick: () => handleSelect(opt.value),
2555
+ role: "option",
2556
+ "aria-selected": isSelected,
2557
+ tabIndex: -1,
2558
+ className: cn("relative flex w-full items-center gap-2 rounded px-3 py-2 text-sm text-black select-none", "hover:bg-gray-50 mx-1 my-[2px]", isSelected && "bg-gray-50", focusedIndex === index && "bg-gray-50 ring-1 ring-primary"),
2559
+ children: [multiSelect && /* @__PURE__ */ jsx("span", {
2560
+ className: cn("flex h-4 w-4 items-center justify-center rounded-sm border", isSelected ? "border-light-blue bg-light-blue" : "border-gray-400 bg-white"),
2561
+ "aria-hidden": "true",
2562
+ children: isSelected && /* @__PURE__ */ jsx(IconCheck, {
2563
+ size: 12,
2564
+ color: "white",
2565
+ stroke: 2,
2566
+ className: "pointer-events-none"
2567
+ })
2568
+ }), /* @__PURE__ */ jsx("span", {
2569
+ className: "flex-1 text-left",
2570
+ children: opt.label
2571
+ })]
2572
+ }, opt.value);
2573
+ }) : /* @__PURE__ */ jsx("div", {
2574
+ className: "px-3 py-2 text-gray-400",
2575
+ role: "status",
2576
+ children: noResultsText
2577
+ })
2578
+ })]
2579
+ })
2580
+ })
2581
+ }) }),
2582
+ !hideError && errorText && /* @__PURE__ */ jsx("span", {
2583
+ className: "text-xs text-red-500",
2301
2584
  role: "alert",
2302
- children: error
2585
+ children: errorText
2303
2586
  })
2304
2587
  ]
2305
2588
  });
2306
- });
2589
+ }
2307
2590
  Select.displayName = "Select";
2308
2591
 
2309
2592
  //#endregion
@@ -2708,97 +2991,6 @@ const Toggle = ({ onClick, value, disabled = false }) => {
2708
2991
  });
2709
2992
  };
2710
2993
 
2711
- //#endregion
2712
- //#region src/components/tooltip/index.tsx
2713
- const sizeClasses = {
2714
- xs: "max-w-xs",
2715
- sm: "max-w-sm",
2716
- md: "max-w-md",
2717
- lg: "max-w-lg"
2718
- };
2719
- const Tooltip = ({ content, children, passedOpen = false, size = "md", variant = "default" }) => {
2720
- const [isOpen, setIsOpen] = useState(passedOpen);
2721
- const arrowRef = useRef(null);
2722
- const { refs, floatingStyles, context } = useFloating({
2723
- open: isOpen,
2724
- onOpenChange: setIsOpen,
2725
- placement: "top",
2726
- middleware: [
2727
- variant === "default" ? offset(20) : offset(25),
2728
- flip(),
2729
- shift(),
2730
- arrow({ element: arrowRef })
2731
- ],
2732
- whileElementsMounted: autoUpdate
2733
- });
2734
- const hover = useHover(context, { move: false });
2735
- const focus = useFocus(context);
2736
- const dismiss = useDismiss(context);
2737
- const role = useRole(context, { role: "tooltip" });
2738
- const { getReferenceProps, getFloatingProps } = useInteractions([
2739
- hover,
2740
- focus,
2741
- dismiss,
2742
- role
2743
- ]);
2744
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [isValidElement(children) && cloneElement(children, getReferenceProps({
2745
- ref: refs.setReference,
2746
- ...children.props,
2747
- ...getReferenceProps()
2748
- })), isOpen && /* @__PURE__ */ jsx("div", {
2749
- ref: refs.setFloating,
2750
- style: floatingStyles,
2751
- ...getFloatingProps(),
2752
- className: "z-70 drop-shadow-xl",
2753
- "data-testid": "tooltip",
2754
- "data-component": "tooltip",
2755
- children: variant === "default" ? /* @__PURE__ */ jsxs("div", {
2756
- "data-testid": "tooltip-container",
2757
- className: "w-full rounded bg-gray-800 pt-[3px] text-white",
2758
- children: [/* @__PURE__ */ jsx("div", {
2759
- "data-testid": "tooltip-content",
2760
- className: `${sizeClasses[size]} px-2 py-1 text-sm font-normal`,
2761
- children: content
2762
- }), /* @__PURE__ */ jsx(FloatingArrow, {
2763
- ref: arrowRef,
2764
- context,
2765
- width: 10,
2766
- height: 6,
2767
- tipRadius: 1,
2768
- "data-testid": "tooltip-arrow",
2769
- className: "fill-gray-800 drop-shadow-xl"
2770
- })]
2771
- }) : /* @__PURE__ */ jsxs("div", {
2772
- "data-testid": "tooltip-container",
2773
- className: "bg-linear-gradient-x pt-[3px]",
2774
- children: [/* @__PURE__ */ jsx("div", {
2775
- "data-testid": "tooltip-content",
2776
- className: `${sizeClasses[size]} overflow-hidden bg-white p-5 px-2 py-1 text-start text-sm font-normal`,
2777
- children: /* @__PURE__ */ jsx("p", { children: content })
2778
- }), size === "md" ? /* @__PURE__ */ jsx(FloatingArrow, {
2779
- ref: arrowRef,
2780
- context,
2781
- width: 25,
2782
- height: 17,
2783
- tipRadius: 1,
2784
- fill: "white",
2785
- className: "drop-shadow-xl",
2786
- "data-testid": "tooltip-arrow"
2787
- }) : /* @__PURE__ */ jsx(FloatingArrow, {
2788
- ref: arrowRef,
2789
- context,
2790
- width: 10,
2791
- height: 6,
2792
- tipRadius: 1,
2793
- fill: "white",
2794
- className: "drop-shadow-xl",
2795
- "data-testid": "tooltip-arrow"
2796
- })]
2797
- })
2798
- })] });
2799
- };
2800
- Tooltip.displayName = "Tooltip";
2801
-
2802
2994
  //#endregion
2803
2995
  //#region src/components/truncatedText/index.tsx
2804
2996
  const TruncatedText = ({ text, limit = 20 }) => {
@@ -3147,5 +3339,5 @@ const setCSSVariable = (variable, value) => {
3147
3339
  };
3148
3340
 
3149
3341
  //#endregion
3150
- export { AccordionItem, AccordionWrapper, ActionIcon, Alert, AppleAppButtonIcon, AutoCompleteInput, Avatar, AvatarIndicator, Badge, BigBadge, BreadCrumb, Button, CSS_VARIABLE_KEYS, Checkbox, DatePickerInput, Divider, FavouriteButton, Filters, GoogleAppButtonIcon, HR, HamburgerMenuButton, Island, Label, Loader, LogoBlack, Modal, NavButtons, NumberField, NumberedStepper, PageUnavailable, PasswordInput, Popover, ProfileMenu, ProgressBar, RadioButton, Rating, RegionSelector, Reviews, ScrollToTop, SearchInput, Select, SettingsCard, Skeleton, SkillPill, Stepper, StickyMobileButtonWrapper, Table, TableCell, TableHeader, TableHeaderItem, TableHeaderRow, TableRow, TabsBadge, TabsWrapper, TextInput, Textarea, ThemeIcon, TimeInput, Toggle, Tooltip, TruncatedText, UnorderedList, UnorderedListItem, UnstyledButton, WysiwygEditor, buttonVariants, getCSSVariable, setCSSVariable };
3342
+ export { AccordionItem, AccordionWrapper, ActionIcon, Alert, AppleAppButtonIcon, AutoCompleteInput, Avatar, AvatarIndicator, Badge, BigBadge, BreadCrumb, Button, CSS_VARIABLE_KEYS, Checkbox, DatePickerInput, Divider, FavouriteButton, Filters, GoogleAppButtonIcon, HR, HamburgerMenuButton, Island, KebabMenu, Label, Loader, LogoBlack, Modal, NavButtons, NumberField, NumberedStepper, PageUnavailable, PasswordInput, Popover, ProfileMenu, ProgressBar, RadioButton, Rating, RegionSelector, Reviews, ScrollToTop, SearchInput, Select, SettingsCard, Skeleton, SkillPill, Stepper, StickyMobileButtonWrapper, Table, TableCell, TableHeader, TableHeaderItem, TableHeaderRow, TableRow, TabsBadge, TabsWrapper, TextInput, Textarea, ThemeIcon, TimeInput, Toggle, Tooltip, TruncatedText, UnorderedList, UnorderedListItem, UnstyledButton, WysiwygEditor, buttonVariants, getCSSVariable, setCSSVariable };
3151
3343
  //# sourceMappingURL=index.js.map