@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.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"));
@@ -245,7 +244,7 @@ const Alert = ({ show, title, description, type = "warning", button, plain = fal
245
244
  };
246
245
  const config = typeConfig[type];
247
246
  const { bg, iconColor, Icon } = config;
248
- const descriptionId = description ? `alert-desc` : undefined;
247
+ const descriptionId = description ? "alert-desc" : undefined;
249
248
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
250
249
  role: "alert",
251
250
  "aria-live": "assertive",
@@ -274,11 +273,15 @@ const Alert = ({ show, title, description, type = "warning", button, plain = fal
274
273
  children: title
275
274
  })]
276
275
  }),
277
- description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
276
+ description && (typeof description === "string" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
278
277
  id: descriptionId,
279
278
  className: "text-sm text-color-gray-900",
280
279
  children: description
281
- }),
280
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
281
+ id: descriptionId,
282
+ className: "text-sm text-color-gray-900",
283
+ children: description
284
+ })),
282
285
  button && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: button })
283
286
  ]
284
287
  }), closable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
@@ -1509,6 +1512,166 @@ const Island = ({ children, className, noShadow = false, noPadding = false,...pr
1509
1512
  });
1510
1513
  Island.displayName = "Island";
1511
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
+
1512
1675
  //#endregion
1513
1676
  //#region src/components/label/index.tsx
1514
1677
  const Label = ({ children, className,...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
@@ -2150,182 +2313,302 @@ const SearchInput = ({ placeholder, value, onChange, className, rightSection,...
2150
2313
  });
2151
2314
 
2152
2315
  //#endregion
2153
- //#region src/components/select/index.tsx
2154
- const LANGUAGE_FLAGS = [
2155
- {
2156
- value: "nl-NL",
2157
- altValue: "nl_NL",
2158
- label: "nl"
2159
- },
2160
- {
2161
- value: "nl-BE",
2162
- altValue: "nl_BE",
2163
- label: "be"
2164
- },
2165
- {
2166
- value: "en-GB",
2167
- altValue: "en_GB",
2168
- label: "gb"
2169
- },
2170
- {
2171
- value: "fr-FR",
2172
- altValue: "fr_FR",
2173
- label: "fr"
2174
- }
2175
- ];
2176
- const selectStyles = {
2177
- singleValue: (provided) => ({
2178
- ...provided,
2179
- fontSize: "14px"
2180
- }),
2181
- placeholder: (provided) => ({
2182
- ...provided,
2183
- color: "#838383",
2184
- fontSize: "14px",
2185
- textWrap: "nowrap"
2186
- }),
2187
- dropdownIndicator: (provided) => ({
2188
- ...provided,
2189
- color: "black"
2190
- }),
2191
- option: (base, { isFocused, isSelected }) => ({
2192
- ...base,
2193
- color: "black",
2194
- marginLeft: "4px",
2195
- marginRight: "4px",
2196
- backgroundColor: isSelected ? "#f8f8f8" : isFocused ? "#f8f8f8" : "transparent",
2197
- width: "calc(100% - 8px)",
2198
- cursor: "pointer"
2199
- }),
2200
- menuList: (provided) => ({
2201
- ...provided,
2202
- fontSize: "14px"
2203
- })
2204
- };
2205
- const selectTheme = (theme) => ({
2206
- ...theme,
2207
- borderRadius: 4,
2208
- colors: {
2209
- ...theme.colors,
2210
- primary25: "#f8f8f8",
2211
- primary: "#f8f8f8"
2212
- }
2213
- });
2214
- 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) => {
2215
- const DropdownIndicator = (props$1) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_select.components.DropdownIndicator, {
2216
- ...props$1,
2217
- children: props$1.hasValue && isClearable ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__tabler_icons_react.IconX, {
2218
- "data-testid": "icon-x",
2219
- className: "cursor-pointer",
2220
- size: 16,
2221
- color: "black",
2222
- onClick: () => props$1.clearValue()
2223
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__tabler_icons_react.IconSelector, {
2224
- size: 16,
2225
- color: "black"
2226
- })
2227
- });
2228
- const GroupHeading = ({ children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2229
- className: "flex items-stretch px-4 py-2 font-normal text-[#838383] capitalize",
2230
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2231
- className: "flex-nowrap whitespace-nowrap",
2232
- children
2233
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2234
- className: "ml-2 flex w-full flex-1 items-center justify-center",
2235
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "h-px w-full bg-[#838383]" })
2236
- })]
2237
- });
2238
- const LanguageControl = ({ children,...props$1 }) => {
2239
- const getSelectedFlag = () => {
2240
- const selectValue = props$1.selectProps.value;
2241
- const findFlag = (value) => LANGUAGE_FLAGS.find((e) => e.value === value || e.altValue === value)?.label || "";
2242
- if (typeof selectValue === "string") return findFlag(selectValue);
2243
- if (typeof selectValue === "object" && selectValue !== null && "value" in selectValue) return findFlag(selectValue.value);
2244
- return null;
2245
- };
2246
- const selectedFlag = getSelectedFlag();
2247
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_select.components.Control, {
2248
- ...props$1,
2249
- children: [selectedFlag && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2250
- className: "flex h-[39px] items-center border-r border-gray-200 p-3",
2251
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
2252
- src: `/images/countries/${selectedFlag.toUpperCase()}_flag.svg`,
2253
- alt: "",
2254
- width: 24,
2255
- height: 24
2256
- })
2257
- }), 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
+ }
2258
2336
  });
2259
- };
2260
- const NoOptionsMessage = (props$1) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_select.components.NoOptionsMessage, {
2261
- ...props$1,
2262
- children: "noOptionsMessage"
2263
- });
2264
- const SingleValue = ({ children,...props$1 }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_select.components.SingleValue, {
2265
- ...props$1,
2266
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2267
- className: "flex items-center",
2268
- children: [icon && icon, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2269
- className: "mx-2",
2270
- children
2271
- })]
2272
- })
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"
2273
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]);
2274
2479
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2480
+ ref: mergedRef,
2481
+ ...props,
2275
2482
  "data-component": "Select",
2276
- "data-testid": "select-container",
2277
- ref,
2278
- 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`,
2279
2486
  children: [
2280
- label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Label, {
2281
- className: cn("leading-4", labelClassNames),
2282
- 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
+ })]
2283
2497
  }),
2284
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_select.default, {
2285
- "data-component": "select",
2286
- "data-testid": "select-input",
2287
- options,
2288
- menuPlacement: "auto",
2289
- isDisabled,
2290
- defaultValue,
2291
- placeholder,
2292
- isClearable: false,
2293
- menuPortalTarget: document?.body,
2294
- styles: {
2295
- ...selectStyles,
2296
- control: (base, state) => ({
2297
- ...base,
2298
- "&:hover": { borderColor: "#A8A8A8" },
2299
- height: "40px",
2300
- width: "100%",
2301
- backgroundColor: "#fbfbfb",
2302
- borderColor: error ? "red" : state.isFocused ? "#10d1bb" : "#cccccc",
2303
- cursor: "pointer"
2304
- }),
2305
- menuPortal: (base) => ({
2306
- ...base,
2307
- zIndex: 99999
2308
- })
2309
- },
2310
- theme: selectTheme,
2311
- components: {
2312
- IndicatorSeparator: () => null,
2313
- DropdownIndicator,
2314
- GroupHeading,
2315
- Control: showLangFlags ? LanguageControl : react_select.components.Control,
2316
- SingleValue,
2317
- 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;
2318
2504
  },
2319
- ...props
2320
- }, id),
2321
- !hideErrorText && error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", {
2322
- 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",
2323
2606
  role: "alert",
2324
- children: error
2607
+ children: errorText
2325
2608
  })
2326
2609
  ]
2327
2610
  });
2328
- });
2611
+ }
2329
2612
  Select.displayName = "Select";
2330
2613
 
2331
2614
  //#endregion
@@ -2730,97 +3013,6 @@ const Toggle = ({ onClick, value, disabled = false }) => {
2730
3013
  });
2731
3014
  };
2732
3015
 
2733
- //#endregion
2734
- //#region src/components/tooltip/index.tsx
2735
- const sizeClasses = {
2736
- xs: "max-w-xs",
2737
- sm: "max-w-sm",
2738
- md: "max-w-md",
2739
- lg: "max-w-lg"
2740
- };
2741
- const Tooltip = ({ content, children, passedOpen = false, size = "md", variant = "default" }) => {
2742
- const [isOpen, setIsOpen] = (0, react.useState)(passedOpen);
2743
- const arrowRef = (0, react.useRef)(null);
2744
- const { refs, floatingStyles, context } = (0, __floating_ui_react.useFloating)({
2745
- open: isOpen,
2746
- onOpenChange: setIsOpen,
2747
- placement: "top",
2748
- middleware: [
2749
- variant === "default" ? (0, __floating_ui_react.offset)(20) : (0, __floating_ui_react.offset)(25),
2750
- (0, __floating_ui_react.flip)(),
2751
- (0, __floating_ui_react.shift)(),
2752
- (0, __floating_ui_react.arrow)({ element: arrowRef })
2753
- ],
2754
- whileElementsMounted: __floating_ui_react.autoUpdate
2755
- });
2756
- const hover = (0, __floating_ui_react.useHover)(context, { move: false });
2757
- const focus = (0, __floating_ui_react.useFocus)(context);
2758
- const dismiss = (0, __floating_ui_react.useDismiss)(context);
2759
- const role = (0, __floating_ui_react.useRole)(context, { role: "tooltip" });
2760
- const { getReferenceProps, getFloatingProps } = (0, __floating_ui_react.useInteractions)([
2761
- hover,
2762
- focus,
2763
- dismiss,
2764
- role
2765
- ]);
2766
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react.isValidElement)(children) && (0, react.cloneElement)(children, getReferenceProps({
2767
- ref: refs.setReference,
2768
- ...children.props,
2769
- ...getReferenceProps()
2770
- })), isOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2771
- ref: refs.setFloating,
2772
- style: floatingStyles,
2773
- ...getFloatingProps(),
2774
- className: "z-70 drop-shadow-xl",
2775
- "data-testid": "tooltip",
2776
- "data-component": "tooltip",
2777
- children: variant === "default" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2778
- "data-testid": "tooltip-container",
2779
- className: "w-full rounded bg-gray-800 pt-[3px] text-white",
2780
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2781
- "data-testid": "tooltip-content",
2782
- className: `${sizeClasses[size]} px-2 py-1 text-sm font-normal`,
2783
- children: content
2784
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__floating_ui_react.FloatingArrow, {
2785
- ref: arrowRef,
2786
- context,
2787
- width: 10,
2788
- height: 6,
2789
- tipRadius: 1,
2790
- "data-testid": "tooltip-arrow",
2791
- className: "fill-gray-800 drop-shadow-xl"
2792
- })]
2793
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2794
- "data-testid": "tooltip-container",
2795
- className: "bg-linear-gradient-x pt-[3px]",
2796
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2797
- "data-testid": "tooltip-content",
2798
- className: `${sizeClasses[size]} overflow-hidden bg-white p-5 px-2 py-1 text-start text-sm font-normal`,
2799
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: content })
2800
- }), size === "md" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__floating_ui_react.FloatingArrow, {
2801
- ref: arrowRef,
2802
- context,
2803
- width: 25,
2804
- height: 17,
2805
- tipRadius: 1,
2806
- fill: "white",
2807
- className: "drop-shadow-xl",
2808
- "data-testid": "tooltip-arrow"
2809
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__floating_ui_react.FloatingArrow, {
2810
- ref: arrowRef,
2811
- context,
2812
- width: 10,
2813
- height: 6,
2814
- tipRadius: 1,
2815
- fill: "white",
2816
- className: "drop-shadow-xl",
2817
- "data-testid": "tooltip-arrow"
2818
- })]
2819
- })
2820
- })] });
2821
- };
2822
- Tooltip.displayName = "Tooltip";
2823
-
2824
3016
  //#endregion
2825
3017
  //#region src/components/truncatedText/index.tsx
2826
3018
  const TruncatedText = ({ text, limit = 20 }) => {
@@ -3191,6 +3383,7 @@ exports.GoogleAppButtonIcon = GoogleAppButtonIcon;
3191
3383
  exports.HR = HR;
3192
3384
  exports.HamburgerMenuButton = HamburgerMenuButton;
3193
3385
  exports.Island = Island;
3386
+ exports.KebabMenu = KebabMenu;
3194
3387
  exports.Label = Label;
3195
3388
  exports.Loader = Loader;
3196
3389
  exports.LogoBlack = LogoBlack;