@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.cjs CHANGED
@@ -35,7 +35,6 @@ const date_fns = __toESM(require("date-fns"));
35
35
  const date_fns_locale = __toESM(require("date-fns/locale"));
36
36
  const __floating_ui_react = __toESM(require("@floating-ui/react"));
37
37
  const react_dom = __toESM(require("react-dom"));
38
- const react_select = __toESM(require("react-select"));
39
38
  const __tiptap_extension_placeholder = __toESM(require("@tiptap/extension-placeholder"));
40
39
  const __tiptap_extension_underline = __toESM(require("@tiptap/extension-underline"));
41
40
  const __tiptap_react = __toESM(require("@tiptap/react"));
@@ -1513,6 +1512,166 @@ const Island = ({ children, className, noShadow = false, noPadding = false,...pr
1513
1512
  });
1514
1513
  Island.displayName = "Island";
1515
1514
 
1515
+ //#endregion
1516
+ //#region src/components/tooltip/index.tsx
1517
+ const sizeClasses = {
1518
+ xs: "max-w-xs",
1519
+ sm: "max-w-sm",
1520
+ md: "max-w-md",
1521
+ lg: "max-w-lg"
1522
+ };
1523
+ const Tooltip = ({ content, children, passedOpen = false, size = "md", variant = "default" }) => {
1524
+ const [isOpen, setIsOpen] = (0, react.useState)(passedOpen);
1525
+ const arrowRef = (0, react.useRef)(null);
1526
+ const { refs, floatingStyles, context } = (0, __floating_ui_react.useFloating)({
1527
+ open: isOpen,
1528
+ onOpenChange: setIsOpen,
1529
+ placement: "top",
1530
+ middleware: [
1531
+ variant === "default" ? (0, __floating_ui_react.offset)(20) : (0, __floating_ui_react.offset)(25),
1532
+ (0, __floating_ui_react.flip)(),
1533
+ (0, __floating_ui_react.shift)(),
1534
+ (0, __floating_ui_react.arrow)({ element: arrowRef })
1535
+ ],
1536
+ whileElementsMounted: __floating_ui_react.autoUpdate
1537
+ });
1538
+ const hover = (0, __floating_ui_react.useHover)(context, { move: false });
1539
+ const focus = (0, __floating_ui_react.useFocus)(context);
1540
+ const dismiss = (0, __floating_ui_react.useDismiss)(context);
1541
+ const role = (0, __floating_ui_react.useRole)(context, { role: "tooltip" });
1542
+ const { getReferenceProps, getFloatingProps } = (0, __floating_ui_react.useInteractions)([
1543
+ hover,
1544
+ focus,
1545
+ dismiss,
1546
+ role
1547
+ ]);
1548
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react.isValidElement)(children) && (0, react.cloneElement)(children, getReferenceProps({
1549
+ ref: refs.setReference,
1550
+ ...children.props,
1551
+ ...getReferenceProps()
1552
+ })), isOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1553
+ ref: refs.setFloating,
1554
+ style: floatingStyles,
1555
+ ...getFloatingProps(),
1556
+ className: "z-70 drop-shadow-xl",
1557
+ "data-testid": "tooltip",
1558
+ "data-component": "tooltip",
1559
+ children: variant === "default" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1560
+ "data-testid": "tooltip-container",
1561
+ className: "w-full rounded bg-gray-800 pt-[3px] text-white",
1562
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1563
+ "data-testid": "tooltip-content",
1564
+ className: `${sizeClasses[size]} px-2 py-1 text-sm font-normal`,
1565
+ children: content
1566
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__floating_ui_react.FloatingArrow, {
1567
+ ref: arrowRef,
1568
+ context,
1569
+ width: 10,
1570
+ height: 6,
1571
+ tipRadius: 1,
1572
+ "data-testid": "tooltip-arrow",
1573
+ className: "fill-gray-800 drop-shadow-xl"
1574
+ })]
1575
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1576
+ "data-testid": "tooltip-container",
1577
+ className: "bg-linear-gradient-x pt-[3px]",
1578
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1579
+ "data-testid": "tooltip-content",
1580
+ className: `${sizeClasses[size]} overflow-hidden bg-white p-5 px-2 py-1 text-start text-sm font-normal`,
1581
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: content })
1582
+ }), size === "md" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__floating_ui_react.FloatingArrow, {
1583
+ ref: arrowRef,
1584
+ context,
1585
+ width: 25,
1586
+ height: 17,
1587
+ tipRadius: 1,
1588
+ fill: "white",
1589
+ className: "drop-shadow-xl",
1590
+ "data-testid": "tooltip-arrow"
1591
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__floating_ui_react.FloatingArrow, {
1592
+ ref: arrowRef,
1593
+ context,
1594
+ width: 10,
1595
+ height: 6,
1596
+ tipRadius: 1,
1597
+ fill: "white",
1598
+ className: "drop-shadow-xl",
1599
+ "data-testid": "tooltip-arrow"
1600
+ })]
1601
+ })
1602
+ })] });
1603
+ };
1604
+ Tooltip.displayName = "Tooltip";
1605
+
1606
+ //#endregion
1607
+ //#region src/components/kebabMenu/index.tsx
1608
+ const KebabMenu = ({ title, content, disabled = false, styleVariant = "default" }) => {
1609
+ const [isOpen, setIsOpen] = (0, react.useState)(false);
1610
+ const menuRef = (0, react.useRef)(null);
1611
+ 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";
1612
+ const handleToggle = () => {
1613
+ if (!disabled) setIsOpen((prev) => !prev);
1614
+ };
1615
+ const handleItemClick = (onClick) => {
1616
+ if (!disabled) {
1617
+ onClick();
1618
+ setIsOpen(false);
1619
+ }
1620
+ };
1621
+ const handleClickOutside = (event) => {
1622
+ if (menuRef.current && !menuRef.current.contains(event.target)) setIsOpen(false);
1623
+ };
1624
+ (0, react.useEffect)(() => {
1625
+ document.addEventListener("mousedown", handleClickOutside);
1626
+ return () => {
1627
+ document.removeEventListener("mousedown", handleClickOutside);
1628
+ };
1629
+ }, []);
1630
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1631
+ className: "relative",
1632
+ "data-component": "kebabMenu",
1633
+ "data-testid": "kebab-menu",
1634
+ ref: menuRef,
1635
+ "data-tooltip-id": title,
1636
+ "data-tooltip-content": title,
1637
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(UnstyledButton, {
1638
+ "aria-label": "Options Menu",
1639
+ className: cn(buttonVariants["secondary"], defaultStyling, {
1640
+ "md:pr-3.5 md:pl-5": title,
1641
+ "h-7 min-w-7": styleVariant === "small"
1642
+ }),
1643
+ disabled,
1644
+ onClick: handleToggle,
1645
+ children: [title && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1646
+ className: "hidden md:block",
1647
+ children: title
1648
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__tabler_icons_react.IconDotsVertical, {
1649
+ size: 20,
1650
+ stroke: 1,
1651
+ fill: "black"
1652
+ })]
1653
+ }), isOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1654
+ 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",
1655
+ children: content.map((c, index) => {
1656
+ const button = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UnstyledButton, {
1657
+ onClick: () => handleItemClick(c.onClick),
1658
+ className: "w-full rounded-md px-4 py-2 text-left text-sm font-normal whitespace-nowrap hover:bg-gray-50",
1659
+ "aria-label": "Options Menu Item",
1660
+ disabled: c.disabled,
1661
+ children: c.title
1662
+ });
1663
+ return c.tooltip ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tooltip, {
1664
+ passedOpen: false,
1665
+ size: "sm",
1666
+ content: c.tooltip,
1667
+ children: button
1668
+ }, index) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.default.Fragment, { children: button }, index);
1669
+ })
1670
+ })]
1671
+ }) });
1672
+ };
1673
+ KebabMenu.displayName = "KebabMenu";
1674
+
1516
1675
  //#endregion
1517
1676
  //#region src/components/label/index.tsx
1518
1677
  const Label = ({ children, className,...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
@@ -2154,182 +2313,302 @@ const SearchInput = ({ placeholder, value, onChange, className, rightSection,...
2154
2313
  });
2155
2314
 
2156
2315
  //#endregion
2157
- //#region src/components/select/index.tsx
2158
- const LANGUAGE_FLAGS = [
2159
- {
2160
- value: "nl-NL",
2161
- altValue: "nl_NL",
2162
- label: "nl"
2163
- },
2164
- {
2165
- value: "nl-BE",
2166
- altValue: "nl_BE",
2167
- label: "be"
2168
- },
2169
- {
2170
- value: "en-GB",
2171
- altValue: "en_GB",
2172
- label: "gb"
2173
- },
2174
- {
2175
- value: "fr-FR",
2176
- altValue: "fr_FR",
2177
- label: "fr"
2178
- }
2179
- ];
2180
- const selectStyles = {
2181
- singleValue: (provided) => ({
2182
- ...provided,
2183
- fontSize: "14px"
2184
- }),
2185
- placeholder: (provided) => ({
2186
- ...provided,
2187
- color: "#838383",
2188
- fontSize: "14px",
2189
- textWrap: "nowrap"
2190
- }),
2191
- dropdownIndicator: (provided) => ({
2192
- ...provided,
2193
- color: "black"
2194
- }),
2195
- option: (base, { isFocused, isSelected }) => ({
2196
- ...base,
2197
- color: "black",
2198
- marginLeft: "4px",
2199
- marginRight: "4px",
2200
- backgroundColor: isSelected ? "#f8f8f8" : isFocused ? "#f8f8f8" : "transparent",
2201
- width: "calc(100% - 8px)",
2202
- cursor: "pointer"
2203
- }),
2204
- menuList: (provided) => ({
2205
- ...provided,
2206
- fontSize: "14px"
2207
- })
2208
- };
2209
- const selectTheme = (theme) => ({
2210
- ...theme,
2211
- borderRadius: 4,
2212
- colors: {
2213
- ...theme.colors,
2214
- primary25: "#f8f8f8",
2215
- primary: "#f8f8f8"
2216
- }
2217
- });
2218
- const Select = (0, react.forwardRef)(({ options, placeholder, defaultValue, label, id, icon, error, className, labelClassNames, showLangFlags = false, hideErrorText = false, isClearable = true, fullWidth = true, width, isDisabled,...props }, ref) => {
2219
- const DropdownIndicator = (props$1) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_select.components.DropdownIndicator, {
2220
- ...props$1,
2221
- children: props$1.hasValue && isClearable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__tabler_icons_react.IconX, {
2222
- "data-testid": "icon-x",
2223
- className: "cursor-pointer",
2224
- size: 16,
2225
- color: "black",
2226
- onClick: () => props$1.clearValue()
2227
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__tabler_icons_react.IconSelector, {
2228
- size: 16,
2229
- color: "black"
2230
- })
2231
- });
2232
- const GroupHeading = ({ children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2233
- className: "flex items-stretch px-4 py-2 font-normal text-[#838383] capitalize",
2234
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2235
- className: "flex-nowrap whitespace-nowrap",
2236
- children
2237
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2238
- className: "ml-2 flex w-full flex-1 items-center justify-center",
2239
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "h-px w-full bg-[#838383]" })
2240
- })]
2241
- });
2242
- const LanguageControl = ({ children,...props$1 }) => {
2243
- const getSelectedFlag = () => {
2244
- const selectValue = props$1.selectProps.value;
2245
- const findFlag = (value) => LANGUAGE_FLAGS.find((e) => e.value === value || e.altValue === value)?.label || "";
2246
- if (typeof selectValue === "string") return findFlag(selectValue);
2247
- if (typeof selectValue === "object" && selectValue !== null && "value" in selectValue) return findFlag(selectValue.value);
2248
- return null;
2249
- };
2250
- const selectedFlag = getSelectedFlag();
2251
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_select.components.Control, {
2252
- ...props$1,
2253
- children: [selectedFlag && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2254
- className: "flex h-[39px] items-center border-r border-gray-200 p-3",
2255
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
2256
- src: `/images/countries/${selectedFlag.toUpperCase()}_flag.svg`,
2257
- alt: "",
2258
- width: 24,
2259
- height: 24
2260
- })
2261
- }), children]
2316
+ //#region src/hooks/useDebouncedValue.ts
2317
+ function useDebouncedValue(value, delay = 200) {
2318
+ const [debouncedValue, setDebouncedValue] = (0, react.useState)(value);
2319
+ (0, react.useEffect)(() => {
2320
+ const handler = setTimeout(() => setDebouncedValue(value), delay);
2321
+ return () => clearTimeout(handler);
2322
+ }, [value, delay]);
2323
+ return debouncedValue;
2324
+ }
2325
+
2326
+ //#endregion
2327
+ //#region src/hooks/useMergeRefs.ts
2328
+ function useMergeRefs(...refs) {
2329
+ return (0, react.useCallback)((value) => {
2330
+ refs.forEach((ref) => {
2331
+ if (typeof ref === "function") {
2332
+ ref(value);
2333
+ } else if (ref) {
2334
+ ref.current = value;
2335
+ }
2262
2336
  });
2263
- };
2264
- const NoOptionsMessage = (props$1) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_select.components.NoOptionsMessage, {
2265
- ...props$1,
2266
- children: "noOptionsMessage"
2267
- });
2268
- const SingleValue = ({ children,...props$1 }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_select.components.SingleValue, {
2269
- ...props$1,
2270
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2271
- className: "flex items-center",
2272
- children: [icon && icon, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2273
- className: "mx-2",
2274
- children
2275
- })]
2276
- })
2337
+ }, [refs]);
2338
+ }
2339
+
2340
+ //#endregion
2341
+ //#region src/components/select/index.tsx
2342
+ function Select({ id, options, placeholder, label, errorText, hideError = false, isClearable = false, disabled = false, multiSelect = false, searchable = false, value, defaultValue, onValueChange, className, searchPlaceholder, noResultsText,...props }) {
2343
+ const innerRef = (0, react.useRef)(null);
2344
+ const buttonRef = (0, react.useRef)(null);
2345
+ const optionRefs = (0, react.useRef)([]);
2346
+ const mergedRef = useMergeRefs(innerRef, props.ref);
2347
+ const [internalValue, setInternalValue] = (0, react.useState)(defaultValue);
2348
+ const [open, setOpen] = (0, react.useState)(false);
2349
+ const [searchTerm, setSearchTerm] = (0, react.useState)("");
2350
+ const [focusedIndex, setFocusedIndex] = (0, react.useState)(-1);
2351
+ const debouncedSearch = useDebouncedValue(searchTerm);
2352
+ const isControlled = value !== undefined;
2353
+ const currentValue = isControlled ? value : internalValue;
2354
+ const selectedLabels = (0, react.useMemo)(() => {
2355
+ if (Array.isArray(currentValue)) {
2356
+ return options.filter((o) => currentValue.includes(o.value)).map((o) => o.label).join(", ");
2357
+ }
2358
+ return options.find((o) => o.value === currentValue)?.label;
2359
+ }, [currentValue, options]);
2360
+ const { refs, floatingStyles, context } = (0, __floating_ui_react.useFloating)({
2361
+ open,
2362
+ onOpenChange: setOpen,
2363
+ middleware: [
2364
+ (0, __floating_ui_react.offset)(4),
2365
+ (0, __floating_ui_react.flip)(),
2366
+ (0, __floating_ui_react.shift)()
2367
+ ],
2368
+ whileElementsMounted: __floating_ui_react.autoUpdate,
2369
+ placement: "bottom-start"
2277
2370
  });
2371
+ const click = (0, __floating_ui_react.useClick)(context);
2372
+ const dismiss = (0, __floating_ui_react.useDismiss)(context);
2373
+ const role = (0, __floating_ui_react.useRole)(context, { role: "combobox" });
2374
+ const { getReferenceProps, getFloatingProps } = (0, __floating_ui_react.useInteractions)([
2375
+ click,
2376
+ dismiss,
2377
+ role
2378
+ ]);
2379
+ const handleSelect = (0, react.useCallback)((val) => {
2380
+ if (multiSelect) {
2381
+ const current = Array.isArray(currentValue) ? currentValue : [];
2382
+ const newValues = current.includes(val) ? current.filter((v) => v !== val) : [...current, val];
2383
+ if (!isControlled) setInternalValue(newValues);
2384
+ onValueChange?.(newValues);
2385
+ } else {
2386
+ if (!isControlled) setInternalValue(val);
2387
+ onValueChange?.(val);
2388
+ setOpen(false);
2389
+ buttonRef.current?.focus();
2390
+ }
2391
+ }, [
2392
+ multiSelect,
2393
+ currentValue,
2394
+ isControlled,
2395
+ onValueChange
2396
+ ]);
2397
+ const handleClear = (0, react.useCallback)((e) => {
2398
+ e.preventDefault();
2399
+ e.stopPropagation();
2400
+ if (!isControlled) setInternalValue(undefined);
2401
+ onValueChange?.(undefined);
2402
+ setSearchTerm("");
2403
+ }, [isControlled, onValueChange]);
2404
+ const showPlaceholder = !currentValue || Array.isArray(currentValue) && currentValue.length === 0;
2405
+ const filteredOptions = (0, react.useMemo)(() => {
2406
+ if (!debouncedSearch.trim()) return options;
2407
+ return options.filter((opt) => opt.label.toLowerCase().includes(debouncedSearch.toLowerCase()));
2408
+ }, [options, debouncedSearch]);
2409
+ const handleKeyDown = (0, react.useCallback)((event) => {
2410
+ if (disabled) return;
2411
+ if (!open) {
2412
+ if (event.key === "ArrowDown" || event.key === "Enter" || event.key === " ") {
2413
+ event.preventDefault();
2414
+ setOpen(true);
2415
+ setTimeout(() => {
2416
+ setFocusedIndex(0);
2417
+ optionRefs.current[0]?.focus();
2418
+ }, 0);
2419
+ }
2420
+ return;
2421
+ }
2422
+ switch (event.key) {
2423
+ case "Escape":
2424
+ event.preventDefault();
2425
+ setOpen(false);
2426
+ setFocusedIndex(-1);
2427
+ buttonRef.current?.focus();
2428
+ break;
2429
+ case "ArrowDown":
2430
+ event.preventDefault();
2431
+ setFocusedIndex((prev) => {
2432
+ const next = prev < filteredOptions.length - 1 ? prev + 1 : 0;
2433
+ optionRefs.current[next]?.focus();
2434
+ return next;
2435
+ });
2436
+ break;
2437
+ case "ArrowUp":
2438
+ event.preventDefault();
2439
+ setFocusedIndex((prev) => {
2440
+ const next = prev > 0 ? prev - 1 : filteredOptions.length - 1;
2441
+ optionRefs.current[next]?.focus();
2442
+ return next;
2443
+ });
2444
+ break;
2445
+ case "Home":
2446
+ event.preventDefault();
2447
+ setFocusedIndex(0);
2448
+ optionRefs.current[0]?.focus();
2449
+ break;
2450
+ case "End":
2451
+ event.preventDefault();
2452
+ setFocusedIndex(filteredOptions.length - 1);
2453
+ optionRefs.current[filteredOptions.length - 1]?.focus();
2454
+ break;
2455
+ case "Enter":
2456
+ case " ":
2457
+ event.preventDefault();
2458
+ if (focusedIndex >= 0 && filteredOptions[focusedIndex]) {
2459
+ handleSelect(filteredOptions[focusedIndex].value);
2460
+ }
2461
+ break;
2462
+ }
2463
+ }, [
2464
+ open,
2465
+ filteredOptions,
2466
+ focusedIndex,
2467
+ handleSelect,
2468
+ disabled
2469
+ ]);
2470
+ (0, react.useEffect)(() => {
2471
+ if (!open) return;
2472
+ const listener = (e) => handleKeyDown(e);
2473
+ document.addEventListener("keydown", listener);
2474
+ return () => document.removeEventListener("keydown", listener);
2475
+ }, [open, handleKeyDown]);
2476
+ (0, react.useEffect)(() => {
2477
+ if (!open) setSearchTerm("");
2478
+ }, [open]);
2278
2479
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2480
+ ref: mergedRef,
2481
+ ...props,
2279
2482
  "data-component": "Select",
2280
- "data-testid": "select-container",
2281
- ref,
2282
- className: (0, clsx.default)("m-0 grid gap-2 p-0", width ? width : fullWidth && "w-full", className),
2483
+ className: cn("grid gap-2 w-full", className),
2484
+ role: "group",
2485
+ "aria-labelledby": `${id}-label`,
2283
2486
  children: [
2284
- label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, {
2285
- className: cn("leading-4", labelClassNames),
2286
- children: label
2487
+ label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2488
+ className: "leading-4",
2489
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, {
2490
+ htmlFor: id,
2491
+ children: label
2492
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2493
+ id: `${id}-label`,
2494
+ className: "sr-only",
2495
+ children: label
2496
+ })]
2287
2497
  }),
2288
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_select.default, {
2289
- "data-component": "select",
2290
- "data-testid": "select-input",
2291
- options,
2292
- menuPlacement: "auto",
2293
- isDisabled,
2294
- defaultValue,
2295
- placeholder,
2296
- isClearable: false,
2297
- menuPortalTarget: document?.body,
2298
- styles: {
2299
- ...selectStyles,
2300
- control: (base, state) => ({
2301
- ...base,
2302
- "&:hover": { borderColor: "#A8A8A8" },
2303
- height: "40px",
2304
- width: "100%",
2305
- backgroundColor: "#fbfbfb",
2306
- borderColor: error ? "red" : state.isFocused ? "#10d1bb" : "#cccccc",
2307
- cursor: "pointer"
2308
- }),
2309
- menuPortal: (base) => ({
2310
- ...base,
2311
- zIndex: 99999
2312
- })
2313
- },
2314
- theme: selectTheme,
2315
- components: {
2316
- IndicatorSeparator: () => null,
2317
- DropdownIndicator,
2318
- GroupHeading,
2319
- Control: showLangFlags ? LanguageControl : react_select.components.Control,
2320
- SingleValue,
2321
- NoOptionsMessage
2498
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2499
+ id,
2500
+ type: "button",
2501
+ ref: (node) => {
2502
+ refs.setReference(node);
2503
+ buttonRef.current = node;
2322
2504
  },
2323
- ...props
2324
- }, id),
2325
- !hideErrorText && error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", {
2326
- className: "text-xs font-normal text-red-500",
2505
+ ...getReferenceProps(),
2506
+ disabled,
2507
+ 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"),
2508
+ "aria-haspopup": "listbox",
2509
+ "aria-expanded": open,
2510
+ "aria-disabled": disabled,
2511
+ "aria-labelledby": `${id}-label`,
2512
+ "aria-controls": `${id}-listbox`,
2513
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2514
+ className: "flex items-center gap-2 truncate text-black",
2515
+ children: showPlaceholder ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2516
+ className: "text-gray-200",
2517
+ "aria-hidden": "true",
2518
+ children: placeholder
2519
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2520
+ className: "truncate",
2521
+ children: selectedLabels
2522
+ })
2523
+ }), isClearable && !showPlaceholder ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__tabler_icons_react.IconX, {
2524
+ size: 16,
2525
+ color: "black",
2526
+ className: "cursor-pointer",
2527
+ "data-testid": "clear-button",
2528
+ onPointerDown: handleClear,
2529
+ role: "button",
2530
+ "aria-label": "Clear selection"
2531
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__tabler_icons_react.IconSelector, {
2532
+ size: 16,
2533
+ color: "black",
2534
+ "aria-hidden": "true"
2535
+ })]
2536
+ }),
2537
+ open && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__floating_ui_react.FloatingPortal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__floating_ui_react.FloatingFocusManager, {
2538
+ context,
2539
+ modal: false,
2540
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2541
+ ref: refs.setFloating,
2542
+ style: {
2543
+ ...floatingStyles,
2544
+ width: refs.reference.current?.offsetWidth ?? "auto"
2545
+ },
2546
+ ...getFloatingProps(),
2547
+ id: `${id}-listbox`,
2548
+ role: "listbox",
2549
+ "aria-labelledby": `${id}-label`,
2550
+ className: cn("z-[99999] mt-2 rounded-md border border-gray-200 bg-white shadow-md", "overflow-hidden animate-in fade-in"),
2551
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2552
+ className: "p-1 text-sm max-h-[250px] overflow-auto",
2553
+ children: [searchable && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2554
+ className: "flex items-center gap-2 px-2 py-1 border-b border-gray-100 sticky top-0 bg-white",
2555
+ role: "search",
2556
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__tabler_icons_react.IconSearch, {
2557
+ size: 14,
2558
+ className: "text-gray-400",
2559
+ "aria-hidden": "true"
2560
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
2561
+ type: "text",
2562
+ autoFocus: true,
2563
+ value: searchTerm,
2564
+ onChange: (e) => setSearchTerm(e.target.value),
2565
+ placeholder: searchPlaceholder,
2566
+ className: "w-full text-sm outline-none bg-transparent placeholder-gray-300",
2567
+ "aria-label": "Search options"
2568
+ })]
2569
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2570
+ className: "mt-1 pr-2",
2571
+ children: filteredOptions.length ? filteredOptions.map((opt, index) => {
2572
+ const isSelected = Array.isArray(currentValue) ? currentValue.includes(opt.value) : currentValue === opt.value;
2573
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2574
+ ref: (el) => optionRefs.current[index] = el,
2575
+ type: "button",
2576
+ onClick: () => handleSelect(opt.value),
2577
+ role: "option",
2578
+ "aria-selected": isSelected,
2579
+ tabIndex: -1,
2580
+ 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"),
2581
+ children: [multiSelect && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2582
+ 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"),
2583
+ "aria-hidden": "true",
2584
+ children: isSelected && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__tabler_icons_react.IconCheck, {
2585
+ size: 12,
2586
+ color: "white",
2587
+ stroke: 2,
2588
+ className: "pointer-events-none"
2589
+ })
2590
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2591
+ className: "flex-1 text-left",
2592
+ children: opt.label
2593
+ })]
2594
+ }, opt.value);
2595
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2596
+ className: "px-3 py-2 text-gray-400",
2597
+ role: "status",
2598
+ children: noResultsText
2599
+ })
2600
+ })]
2601
+ })
2602
+ })
2603
+ }) }),
2604
+ !hideError && errorText && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2605
+ className: "text-xs text-red-500",
2327
2606
  role: "alert",
2328
- children: error
2607
+ children: errorText
2329
2608
  })
2330
2609
  ]
2331
2610
  });
2332
- });
2611
+ }
2333
2612
  Select.displayName = "Select";
2334
2613
 
2335
2614
  //#endregion
@@ -2734,97 +3013,6 @@ const Toggle = ({ onClick, value, disabled = false }) => {
2734
3013
  });
2735
3014
  };
2736
3015
 
2737
- //#endregion
2738
- //#region src/components/tooltip/index.tsx
2739
- const sizeClasses = {
2740
- xs: "max-w-xs",
2741
- sm: "max-w-sm",
2742
- md: "max-w-md",
2743
- lg: "max-w-lg"
2744
- };
2745
- const Tooltip = ({ content, children, passedOpen = false, size = "md", variant = "default" }) => {
2746
- const [isOpen, setIsOpen] = (0, react.useState)(passedOpen);
2747
- const arrowRef = (0, react.useRef)(null);
2748
- const { refs, floatingStyles, context } = (0, __floating_ui_react.useFloating)({
2749
- open: isOpen,
2750
- onOpenChange: setIsOpen,
2751
- placement: "top",
2752
- middleware: [
2753
- variant === "default" ? (0, __floating_ui_react.offset)(20) : (0, __floating_ui_react.offset)(25),
2754
- (0, __floating_ui_react.flip)(),
2755
- (0, __floating_ui_react.shift)(),
2756
- (0, __floating_ui_react.arrow)({ element: arrowRef })
2757
- ],
2758
- whileElementsMounted: __floating_ui_react.autoUpdate
2759
- });
2760
- const hover = (0, __floating_ui_react.useHover)(context, { move: false });
2761
- const focus = (0, __floating_ui_react.useFocus)(context);
2762
- const dismiss = (0, __floating_ui_react.useDismiss)(context);
2763
- const role = (0, __floating_ui_react.useRole)(context, { role: "tooltip" });
2764
- const { getReferenceProps, getFloatingProps } = (0, __floating_ui_react.useInteractions)([
2765
- hover,
2766
- focus,
2767
- dismiss,
2768
- role
2769
- ]);
2770
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react.isValidElement)(children) && (0, react.cloneElement)(children, getReferenceProps({
2771
- ref: refs.setReference,
2772
- ...children.props,
2773
- ...getReferenceProps()
2774
- })), isOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2775
- ref: refs.setFloating,
2776
- style: floatingStyles,
2777
- ...getFloatingProps(),
2778
- className: "z-70 drop-shadow-xl",
2779
- "data-testid": "tooltip",
2780
- "data-component": "tooltip",
2781
- children: variant === "default" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2782
- "data-testid": "tooltip-container",
2783
- className: "w-full rounded bg-gray-800 pt-[3px] text-white",
2784
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2785
- "data-testid": "tooltip-content",
2786
- className: `${sizeClasses[size]} px-2 py-1 text-sm font-normal`,
2787
- children: content
2788
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__floating_ui_react.FloatingArrow, {
2789
- ref: arrowRef,
2790
- context,
2791
- width: 10,
2792
- height: 6,
2793
- tipRadius: 1,
2794
- "data-testid": "tooltip-arrow",
2795
- className: "fill-gray-800 drop-shadow-xl"
2796
- })]
2797
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2798
- "data-testid": "tooltip-container",
2799
- className: "bg-linear-gradient-x pt-[3px]",
2800
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2801
- "data-testid": "tooltip-content",
2802
- className: `${sizeClasses[size]} overflow-hidden bg-white p-5 px-2 py-1 text-start text-sm font-normal`,
2803
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: content })
2804
- }), size === "md" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__floating_ui_react.FloatingArrow, {
2805
- ref: arrowRef,
2806
- context,
2807
- width: 25,
2808
- height: 17,
2809
- tipRadius: 1,
2810
- fill: "white",
2811
- className: "drop-shadow-xl",
2812
- "data-testid": "tooltip-arrow"
2813
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__floating_ui_react.FloatingArrow, {
2814
- ref: arrowRef,
2815
- context,
2816
- width: 10,
2817
- height: 6,
2818
- tipRadius: 1,
2819
- fill: "white",
2820
- className: "drop-shadow-xl",
2821
- "data-testid": "tooltip-arrow"
2822
- })]
2823
- })
2824
- })] });
2825
- };
2826
- Tooltip.displayName = "Tooltip";
2827
-
2828
3016
  //#endregion
2829
3017
  //#region src/components/truncatedText/index.tsx
2830
3018
  const TruncatedText = ({ text, limit = 20 }) => {
@@ -3195,6 +3383,7 @@ exports.GoogleAppButtonIcon = GoogleAppButtonIcon;
3195
3383
  exports.HR = HR;
3196
3384
  exports.HamburgerMenuButton = HamburgerMenuButton;
3197
3385
  exports.Island = Island;
3386
+ exports.KebabMenu = KebabMenu;
3198
3387
  exports.Label = Label;
3199
3388
  exports.Loader = Loader;
3200
3389
  exports.LogoBlack = LogoBlack;