@youngonesworks/ui 0.1.103 → 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";
@@ -1491,6 +1490,166 @@ const Island = ({ children, className, noShadow = false, noPadding = false,...pr
1491
1490
  });
1492
1491
  Island.displayName = "Island";
1493
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
+
1494
1653
  //#endregion
1495
1654
  //#region src/components/label/index.tsx
1496
1655
  const Label = ({ children, className,...props }) => /* @__PURE__ */ jsx("label", {
@@ -2132,182 +2291,302 @@ const SearchInput = ({ placeholder, value, onChange, className, rightSection,...
2132
2291
  });
2133
2292
 
2134
2293
  //#endregion
2135
- //#region src/components/select/index.tsx
2136
- const LANGUAGE_FLAGS = [
2137
- {
2138
- value: "nl-NL",
2139
- altValue: "nl_NL",
2140
- label: "nl"
2141
- },
2142
- {
2143
- value: "nl-BE",
2144
- altValue: "nl_BE",
2145
- label: "be"
2146
- },
2147
- {
2148
- value: "en-GB",
2149
- altValue: "en_GB",
2150
- label: "gb"
2151
- },
2152
- {
2153
- value: "fr-FR",
2154
- altValue: "fr_FR",
2155
- label: "fr"
2156
- }
2157
- ];
2158
- const selectStyles = {
2159
- singleValue: (provided) => ({
2160
- ...provided,
2161
- fontSize: "14px"
2162
- }),
2163
- placeholder: (provided) => ({
2164
- ...provided,
2165
- color: "#838383",
2166
- fontSize: "14px",
2167
- textWrap: "nowrap"
2168
- }),
2169
- dropdownIndicator: (provided) => ({
2170
- ...provided,
2171
- color: "black"
2172
- }),
2173
- option: (base, { isFocused, isSelected }) => ({
2174
- ...base,
2175
- color: "black",
2176
- marginLeft: "4px",
2177
- marginRight: "4px",
2178
- backgroundColor: isSelected ? "#f8f8f8" : isFocused ? "#f8f8f8" : "transparent",
2179
- width: "calc(100% - 8px)",
2180
- cursor: "pointer"
2181
- }),
2182
- menuList: (provided) => ({
2183
- ...provided,
2184
- fontSize: "14px"
2185
- })
2186
- };
2187
- const selectTheme = (theme) => ({
2188
- ...theme,
2189
- borderRadius: 4,
2190
- colors: {
2191
- ...theme.colors,
2192
- primary25: "#f8f8f8",
2193
- primary: "#f8f8f8"
2194
- }
2195
- });
2196
- const Select = forwardRef(({ options, placeholder, defaultValue, label, id, icon, error, className, labelClassNames, showLangFlags = false, hideErrorText = false, isClearable = true, fullWidth = true, width, isDisabled,...props }, ref) => {
2197
- const DropdownIndicator = (props$1) => /* @__PURE__ */ jsx(components.DropdownIndicator, {
2198
- ...props$1,
2199
- children: props$1.hasValue && isClearable ? /* @__PURE__ */ jsx(IconX, {
2200
- "data-testid": "icon-x",
2201
- className: "cursor-pointer",
2202
- size: 16,
2203
- color: "black",
2204
- onClick: () => props$1.clearValue()
2205
- }) : /* @__PURE__ */ jsx(IconSelector, {
2206
- size: 16,
2207
- color: "black"
2208
- })
2209
- });
2210
- const GroupHeading = ({ children }) => /* @__PURE__ */ jsxs("div", {
2211
- className: "flex items-stretch px-4 py-2 font-normal text-[#838383] capitalize",
2212
- children: [/* @__PURE__ */ jsx("span", {
2213
- className: "flex-nowrap whitespace-nowrap",
2214
- children
2215
- }), /* @__PURE__ */ jsx("span", {
2216
- className: "ml-2 flex w-full flex-1 items-center justify-center",
2217
- children: /* @__PURE__ */ jsx("span", { className: "h-px w-full bg-[#838383]" })
2218
- })]
2219
- });
2220
- const LanguageControl = ({ children,...props$1 }) => {
2221
- const getSelectedFlag = () => {
2222
- const selectValue = props$1.selectProps.value;
2223
- const findFlag = (value) => LANGUAGE_FLAGS.find((e) => e.value === value || e.altValue === value)?.label || "";
2224
- if (typeof selectValue === "string") return findFlag(selectValue);
2225
- if (typeof selectValue === "object" && selectValue !== null && "value" in selectValue) return findFlag(selectValue.value);
2226
- return null;
2227
- };
2228
- const selectedFlag = getSelectedFlag();
2229
- return /* @__PURE__ */ jsxs(components.Control, {
2230
- ...props$1,
2231
- children: [selectedFlag && /* @__PURE__ */ jsx("div", {
2232
- className: "flex h-[39px] items-center border-r border-gray-200 p-3",
2233
- children: /* @__PURE__ */ jsx("img", {
2234
- src: `/images/countries/${selectedFlag.toUpperCase()}_flag.svg`,
2235
- alt: "",
2236
- width: 24,
2237
- height: 24
2238
- })
2239
- }), 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
+ }
2240
2314
  });
2241
- };
2242
- const NoOptionsMessage = (props$1) => /* @__PURE__ */ jsx(components.NoOptionsMessage, {
2243
- ...props$1,
2244
- children: "noOptionsMessage"
2245
- });
2246
- const SingleValue = ({ children,...props$1 }) => /* @__PURE__ */ jsx(components.SingleValue, {
2247
- ...props$1,
2248
- children: /* @__PURE__ */ jsxs("span", {
2249
- className: "flex items-center",
2250
- children: [icon && icon, /* @__PURE__ */ jsx("span", {
2251
- className: "mx-2",
2252
- children
2253
- })]
2254
- })
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"
2255
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]);
2256
2457
  return /* @__PURE__ */ jsxs("div", {
2458
+ ref: mergedRef,
2459
+ ...props,
2257
2460
  "data-component": "Select",
2258
- "data-testid": "select-container",
2259
- ref,
2260
- 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`,
2261
2464
  children: [
2262
- label && /* @__PURE__ */ jsx(Label, {
2263
- className: cn("leading-4", labelClassNames),
2264
- 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
+ })]
2265
2475
  }),
2266
- /* @__PURE__ */ jsx(ReactSelect, {
2267
- "data-component": "select",
2268
- "data-testid": "select-input",
2269
- options,
2270
- menuPlacement: "auto",
2271
- isDisabled,
2272
- defaultValue,
2273
- placeholder,
2274
- isClearable: false,
2275
- menuPortalTarget: document?.body,
2276
- styles: {
2277
- ...selectStyles,
2278
- control: (base, state) => ({
2279
- ...base,
2280
- "&:hover": { borderColor: "#A8A8A8" },
2281
- height: "40px",
2282
- width: "100%",
2283
- backgroundColor: "#fbfbfb",
2284
- borderColor: error ? "red" : state.isFocused ? "#10d1bb" : "#cccccc",
2285
- cursor: "pointer"
2286
- }),
2287
- menuPortal: (base) => ({
2288
- ...base,
2289
- zIndex: 99999
2290
- })
2291
- },
2292
- theme: selectTheme,
2293
- components: {
2294
- IndicatorSeparator: () => null,
2295
- DropdownIndicator,
2296
- GroupHeading,
2297
- Control: showLangFlags ? LanguageControl : components.Control,
2298
- SingleValue,
2299
- NoOptionsMessage
2476
+ /* @__PURE__ */ jsxs("button", {
2477
+ id,
2478
+ type: "button",
2479
+ ref: (node) => {
2480
+ refs.setReference(node);
2481
+ buttonRef.current = node;
2300
2482
  },
2301
- ...props
2302
- }, id),
2303
- !hideErrorText && error && /* @__PURE__ */ jsx("small", {
2304
- 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",
2305
2584
  role: "alert",
2306
- children: error
2585
+ children: errorText
2307
2586
  })
2308
2587
  ]
2309
2588
  });
2310
- });
2589
+ }
2311
2590
  Select.displayName = "Select";
2312
2591
 
2313
2592
  //#endregion
@@ -2712,97 +2991,6 @@ const Toggle = ({ onClick, value, disabled = false }) => {
2712
2991
  });
2713
2992
  };
2714
2993
 
2715
- //#endregion
2716
- //#region src/components/tooltip/index.tsx
2717
- const sizeClasses = {
2718
- xs: "max-w-xs",
2719
- sm: "max-w-sm",
2720
- md: "max-w-md",
2721
- lg: "max-w-lg"
2722
- };
2723
- const Tooltip = ({ content, children, passedOpen = false, size = "md", variant = "default" }) => {
2724
- const [isOpen, setIsOpen] = useState(passedOpen);
2725
- const arrowRef = useRef(null);
2726
- const { refs, floatingStyles, context } = useFloating({
2727
- open: isOpen,
2728
- onOpenChange: setIsOpen,
2729
- placement: "top",
2730
- middleware: [
2731
- variant === "default" ? offset(20) : offset(25),
2732
- flip(),
2733
- shift(),
2734
- arrow({ element: arrowRef })
2735
- ],
2736
- whileElementsMounted: autoUpdate
2737
- });
2738
- const hover = useHover(context, { move: false });
2739
- const focus = useFocus(context);
2740
- const dismiss = useDismiss(context);
2741
- const role = useRole(context, { role: "tooltip" });
2742
- const { getReferenceProps, getFloatingProps } = useInteractions([
2743
- hover,
2744
- focus,
2745
- dismiss,
2746
- role
2747
- ]);
2748
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [isValidElement(children) && cloneElement(children, getReferenceProps({
2749
- ref: refs.setReference,
2750
- ...children.props,
2751
- ...getReferenceProps()
2752
- })), isOpen && /* @__PURE__ */ jsx("div", {
2753
- ref: refs.setFloating,
2754
- style: floatingStyles,
2755
- ...getFloatingProps(),
2756
- className: "z-70 drop-shadow-xl",
2757
- "data-testid": "tooltip",
2758
- "data-component": "tooltip",
2759
- children: variant === "default" ? /* @__PURE__ */ jsxs("div", {
2760
- "data-testid": "tooltip-container",
2761
- className: "w-full rounded bg-gray-800 pt-[3px] text-white",
2762
- children: [/* @__PURE__ */ jsx("div", {
2763
- "data-testid": "tooltip-content",
2764
- className: `${sizeClasses[size]} px-2 py-1 text-sm font-normal`,
2765
- children: content
2766
- }), /* @__PURE__ */ jsx(FloatingArrow, {
2767
- ref: arrowRef,
2768
- context,
2769
- width: 10,
2770
- height: 6,
2771
- tipRadius: 1,
2772
- "data-testid": "tooltip-arrow",
2773
- className: "fill-gray-800 drop-shadow-xl"
2774
- })]
2775
- }) : /* @__PURE__ */ jsxs("div", {
2776
- "data-testid": "tooltip-container",
2777
- className: "bg-linear-gradient-x pt-[3px]",
2778
- children: [/* @__PURE__ */ jsx("div", {
2779
- "data-testid": "tooltip-content",
2780
- className: `${sizeClasses[size]} overflow-hidden bg-white p-5 px-2 py-1 text-start text-sm font-normal`,
2781
- children: /* @__PURE__ */ jsx("p", { children: content })
2782
- }), size === "md" ? /* @__PURE__ */ jsx(FloatingArrow, {
2783
- ref: arrowRef,
2784
- context,
2785
- width: 25,
2786
- height: 17,
2787
- tipRadius: 1,
2788
- fill: "white",
2789
- className: "drop-shadow-xl",
2790
- "data-testid": "tooltip-arrow"
2791
- }) : /* @__PURE__ */ jsx(FloatingArrow, {
2792
- ref: arrowRef,
2793
- context,
2794
- width: 10,
2795
- height: 6,
2796
- tipRadius: 1,
2797
- fill: "white",
2798
- className: "drop-shadow-xl",
2799
- "data-testid": "tooltip-arrow"
2800
- })]
2801
- })
2802
- })] });
2803
- };
2804
- Tooltip.displayName = "Tooltip";
2805
-
2806
2994
  //#endregion
2807
2995
  //#region src/components/truncatedText/index.tsx
2808
2996
  const TruncatedText = ({ text, limit = 20 }) => {
@@ -3151,5 +3339,5 @@ const setCSSVariable = (variable, value) => {
3151
3339
  };
3152
3340
 
3153
3341
  //#endregion
3154
- 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 };
3155
3343
  //# sourceMappingURL=index.js.map