@geckoui/geckoui 1.2.0-beta.2 → 1.3.0

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
@@ -94,20 +94,15 @@ __export(index_exports, {
94
94
  DateRangeInput: () => DateRangeInput_default,
95
95
  Dialog: () => Dialog_default,
96
96
  Drawer: () => Drawer_default,
97
- Dropdown: () => Dropdown_default,
98
97
  FilePicker: () => FilePicker_default,
99
98
  GeckoUIPortal: () => GeckoUIPortal_default,
100
99
  Input: () => Input_default,
101
100
  InputError: () => InputError_default,
102
101
  Label: () => Label_default,
103
102
  LoadingButton: () => LoadingButton_default,
104
- Menu: () => Menu,
105
- MenuButton: () => MenuButton,
106
- MenuHeading: () => MenuHeading,
107
- MenuItem: () => MenuItem,
108
- MenuItems: () => MenuItems,
109
- MenuSection: () => MenuSection,
110
- MenuSeparator: () => MenuSeparator,
103
+ Menu: () => Menu_default,
104
+ MenuItem: () => MenuItem_default,
105
+ MenuTrigger: () => MenuTrigger_default,
111
106
  OTPInput: () => OTPInput_default,
112
107
  Pagination: () => Pagination_default,
113
108
  RHFCheckbox: () => RHFCheckbox_default,
@@ -148,6 +143,7 @@ __export(index_exports, {
148
143
  useClickOutside: () => useClickOutside_default,
149
144
  useEscListener: () => useEscListener_default,
150
145
  useFilePicker: () => useFilePicker_default,
146
+ useMenu: () => useMenu,
151
147
  usePreventDefault: () => usePreventDefault_default,
152
148
  useSelect: () => useSelect
153
149
  });
@@ -855,27 +851,20 @@ var CounterInput = (0, import_react7.forwardRef)(
855
851
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
856
852
  "div",
857
853
  {
858
- className: classNames(
859
- "GeckoUICounterInput",
860
- `GeckoUICounterInput--size-${size}`,
861
- disabled && "GeckoUICounterInput--disabled",
862
- readOnly && "GeckoUICounterInput--readonly",
863
- className
864
- ),
854
+ className: classNames("GeckoUICounterInput", className),
855
+ "data-size": size,
856
+ "data-state": disabled ? "disabled" : readOnly ? "readonly" : void 0,
865
857
  children: [
866
858
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
867
859
  "button",
868
860
  {
869
861
  type: "button",
870
- className: classNames(
871
- "GeckoUICounterInput__button",
872
- "GeckoUICounterInput__button--decrement",
873
- buttonClassName
874
- ),
862
+ className: classNames("GeckoUICounterInput__button", buttonClassName),
863
+ "data-action": "decrement",
875
864
  onClick: handleDecrement,
876
865
  disabled: disabled || readOnly || isAtMin,
877
866
  "aria-label": "Decrement",
878
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "GeckoUICounterInput__icon GeckoUICounterInput__icon--minus" })
867
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "GeckoUICounterInput__icon", "data-icon": "minus" })
879
868
  }
880
869
  ),
881
870
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
@@ -898,15 +887,12 @@ var CounterInput = (0, import_react7.forwardRef)(
898
887
  "button",
899
888
  {
900
889
  type: "button",
901
- className: classNames(
902
- "GeckoUICounterInput__button",
903
- "GeckoUICounterInput__button--increment",
904
- buttonClassName
905
- ),
890
+ className: classNames("GeckoUICounterInput__button", buttonClassName),
891
+ "data-action": "increment",
906
892
  onClick: handleIncrement,
907
893
  disabled: disabled || readOnly || isAtMax,
908
894
  "aria-label": "Increment",
909
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "GeckoUICounterInput__icon GeckoUICounterInput__icon--plus" })
895
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "GeckoUICounterInput__icon", "data-icon": "plus" })
910
896
  }
911
897
  )
912
898
  ]
@@ -1225,70 +1211,71 @@ var BaseDateInput = ({
1225
1211
  const inputs = segmentOrder.map((segment) => allInputs[segment]);
1226
1212
  const isEmpty = !month && !day && !year && !hasFocus;
1227
1213
  const isError = !isEmpty && !isValidDate(year, month, day) || hasError;
1228
- const containerClasses = classNames(
1229
- "GeckoUIDateInput",
1230
- disabled && "GeckoUIDateInput--disabled",
1231
- readOnly && "GeckoUIDateInput--readOnly",
1232
- !disabled && !readOnly && "GeckoUIDateInput--enabled",
1233
- isError && "GeckoUIDateInput--error",
1234
- isEmpty && "GeckoUIDateInput--empty",
1235
- hasFocus && "GeckoUIDateInput--focus",
1236
- className
1237
- );
1238
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { ref: containerRef, className: containerClasses, onClick: () => handleDisplayClick(), children: [
1239
- Boolean(prefix) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "GeckoUIDateInput__prefix", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DynamicComponentRenderer_default, { component: prefix }) }),
1240
- !!isEmpty && !hasFocus && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: classNames("GeckoUIDateInput__placeholder", placeholderClassName), children: placeholder != null ? placeholder : generatePlaceholder(format, separator) }),
1241
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: classNames("GeckoUIDateInput__display-container"), children: inputs.map(({ ref, value: value2, onChange: onChange2, maxLength, segment, display }, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react8.Fragment, { children: [
1242
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1243
- "label",
1244
- {
1245
- className: classNames(
1246
- "GeckoUIDateInput__segment",
1247
- !value2 && "GeckoUIDateInput__segment--empty"
1214
+ const state = disabled ? "disabled" : readOnly ? "readonly" : "enabled";
1215
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1216
+ "div",
1217
+ {
1218
+ ref: containerRef,
1219
+ className: classNames("GeckoUIDateInput", className),
1220
+ "data-state": state,
1221
+ "data-error": isError || void 0,
1222
+ "data-empty": isEmpty || void 0,
1223
+ "data-focus": hasFocus || void 0,
1224
+ onClick: () => handleDisplayClick(),
1225
+ children: [
1226
+ Boolean(prefix) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "GeckoUIDateInput__prefix", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DynamicComponentRenderer_default, { component: prefix }) }),
1227
+ !!isEmpty && !hasFocus && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: classNames("GeckoUIDateInput__placeholder", placeholderClassName), children: placeholder != null ? placeholder : generatePlaceholder(format, separator) }),
1228
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: classNames("GeckoUIDateInput__display-container"), children: inputs.map(({ ref, value: value2, onChange: onChange2, maxLength, segment, display }, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react8.Fragment, { children: [
1229
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1230
+ "label",
1231
+ {
1232
+ className: "GeckoUIDateInput__segment",
1233
+ "data-empty": !value2 || void 0,
1234
+ tabIndex: -1,
1235
+ onClick: (e) => {
1236
+ e.stopPropagation();
1237
+ handleDisplayClick(segment);
1238
+ },
1239
+ children: [
1240
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1241
+ "input",
1242
+ {
1243
+ ref,
1244
+ type: "text",
1245
+ value: value2,
1246
+ readOnly,
1247
+ disabled,
1248
+ className: "GeckoUIDateInput__hidden-input",
1249
+ onChange: onChange2,
1250
+ onKeyDown: (e) => handleKeyDown(e, segment),
1251
+ maxLength,
1252
+ tabIndex: -1
1253
+ }
1254
+ ),
1255
+ display
1256
+ ]
1257
+ }
1248
1258
  ),
1249
- tabIndex: -1,
1250
- onClick: (e) => {
1251
- e.stopPropagation();
1252
- handleDisplayClick(segment);
1253
- },
1254
- children: [
1255
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1256
- "input",
1257
- {
1258
- ref,
1259
- type: "text",
1260
- value: value2,
1261
- readOnly,
1262
- disabled,
1263
- className: "GeckoUIDateInput__hidden-input",
1264
- onChange: onChange2,
1265
- onKeyDown: (e) => handleKeyDown(e, segment),
1266
- maxLength,
1267
- tabIndex: -1
1268
- }
1269
- ),
1270
- display
1271
- ]
1272
- }
1273
- ),
1274
- index < inputs.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "GeckoUIDateInput__separator", children: separator })
1275
- ] }, segment)) }),
1276
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "GeckoUIDateInput__icons", children: [
1277
- !hideClearIcon && !isEmpty && !disabled && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1278
- "button",
1279
- {
1280
- type: "button",
1281
- disabled: disabled || readOnly,
1282
- className: "GeckoUIDateInput__clear-button",
1283
- onClick: handleClear,
1284
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "GeckoUI-icon__clear" })
1285
- }
1286
- ),
1287
- Boolean(suffix) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "GeckoUIDateInput__suffix", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DynamicComponentRenderer_default, { component: suffix }) }),
1288
- renderCalendarIcon,
1289
- !renderCalendarIcon && !hideCalendarIcon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "GeckoUIDateInput__calendar-icon" })
1290
- ] })
1291
- ] });
1259
+ index < inputs.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "GeckoUIDateInput__separator", children: separator })
1260
+ ] }, segment)) }),
1261
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "GeckoUIDateInput__icons", children: [
1262
+ !hideClearIcon && !isEmpty && !disabled && !readOnly && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1263
+ "button",
1264
+ {
1265
+ type: "button",
1266
+ disabled: disabled || readOnly,
1267
+ className: "GeckoUIDateInput__clear-button",
1268
+ onClick: handleClear,
1269
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "GeckoUI-icon__clear" })
1270
+ }
1271
+ ),
1272
+ Boolean(suffix) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "GeckoUIDateInput__suffix", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DynamicComponentRenderer_default, { component: suffix }) }),
1273
+ renderCalendarIcon,
1274
+ !renderCalendarIcon && !hideCalendarIcon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "GeckoUIDateInput__calendar-icon" })
1275
+ ] })
1276
+ ]
1277
+ }
1278
+ );
1292
1279
  };
1293
1280
  BaseDateInput.displayName = "BaseDateInput";
1294
1281
  var BaseDateInput_default = BaseDateInput;
@@ -1376,7 +1363,7 @@ function CalendarHeader({
1376
1363
  header,
1377
1364
  onClickHeader
1378
1365
  }) {
1379
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: classNames("GeckoUICalendar__header"), children: [
1366
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "GeckoUICalendar__header", children: [
1380
1367
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1381
1368
  "button",
1382
1369
  {
@@ -1389,10 +1376,8 @@ function CalendarHeader({
1389
1376
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1390
1377
  "button",
1391
1378
  {
1392
- className: classNames(
1393
- "GeckoUICalendar__header__title",
1394
- onClickHeader && "GeckoUICalendar__header__title--clickable"
1395
- ),
1379
+ className: "GeckoUICalendar__header__title",
1380
+ "data-clickable": onClickHeader ? "" : void 0,
1396
1381
  onClick: onClickHeader,
1397
1382
  type: "button",
1398
1383
  children: header
@@ -1495,19 +1480,17 @@ function CalendarDayPicker(props) {
1495
1480
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1496
1481
  "button",
1497
1482
  {
1498
- className: classNames(
1499
- "GeckoUICalendar__day-picker__button",
1500
- isToday && "GeckoUICalendar__day-picker__button--today",
1501
- isSelected && "GeckoUICalendar__day-picker__button--selected",
1502
- isRangeStart && "GeckoUICalendar__day-picker__button--range-start",
1503
- isRangeEnd && "GeckoUICalendar__day-picker__button--range-end",
1504
- isInRange && "GeckoUICalendar__day-picker__button--in-range",
1505
- isHoverPreview && "GeckoUICalendar__day-picker__button--hover-preview",
1506
- isHoverPreviewStart && "GeckoUICalendar__day-picker__button--hover-preview-start",
1507
- isHoverPreviewEnd && "GeckoUICalendar__day-picker__button--hover-preview-end",
1508
- isDisable && "GeckoUICalendar__day-picker__button--disabled",
1509
- `GeckoUICalendar__day-picker__button--active-month-${isActiveMonth}`
1510
- ),
1483
+ className: "GeckoUICalendar__day-picker__button",
1484
+ "data-today": isToday || void 0,
1485
+ "data-selected": isSelected || void 0,
1486
+ "data-range-start": isRangeStart || void 0,
1487
+ "data-range-end": isRangeEnd || void 0,
1488
+ "data-in-range": isInRange || void 0,
1489
+ "data-hover-preview": isHoverPreview || void 0,
1490
+ "data-hover-preview-start": isHoverPreviewStart || void 0,
1491
+ "data-hover-preview-end": isHoverPreviewEnd || void 0,
1492
+ "data-disabled": isDisable || void 0,
1493
+ "data-active-month": isActiveMonth || void 0,
1511
1494
  disabled: isDisable,
1512
1495
  onClick: () => handleDateClick(formattedDate),
1513
1496
  onMouseEnter: () => handleDateHover(formattedDate),
@@ -1547,10 +1530,8 @@ function CalendarMonthPicker(_a) {
1547
1530
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1548
1531
  "button",
1549
1532
  {
1550
- className: classNames(
1551
- "GeckoUICalendar__month-picker__button",
1552
- selected && "GeckoUICalendar__month-picker__button--selected"
1553
- ),
1533
+ className: "GeckoUICalendar__month-picker__button",
1534
+ "data-selected": selected || void 0,
1554
1535
  onClick: () => onSelectMonth == null ? void 0 : onSelectMonth(index),
1555
1536
  type: "button",
1556
1537
  children: monthName
@@ -1596,11 +1577,9 @@ function CalendarYearPicker(_a) {
1596
1577
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1597
1578
  "button",
1598
1579
  {
1599
- className: classNames(
1600
- "GeckoUICalendar__year-picker__button",
1601
- selected && "GeckoUICalendar__year-picker__button--selected",
1602
- isPrevNext && "GeckoUICalendar__year-picker__button--prev-next"
1603
- ),
1580
+ className: "GeckoUICalendar__year-picker__button",
1581
+ "data-selected": selected || void 0,
1582
+ "data-prev-next": isPrevNext || void 0,
1604
1583
  onClick: () => onSelectYear == null ? void 0 : onSelectYear(year),
1605
1584
  type: "button",
1606
1585
  children: year
@@ -1742,7 +1721,7 @@ Provided value: ${selectedRange.to}`
1742
1721
  const secondMonth = activeMonth === 11 ? 0 : activeMonth + 1;
1743
1722
  const secondYear = activeMonth === 11 ? activeYear + 1 : activeYear;
1744
1723
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "GeckoUICalendar__dual", children: [
1745
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "GeckoUICalendar__dual--first", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1724
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "GeckoUICalendar__dual__item", "data-position": "first", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1746
1725
  CalendarDayPicker_default,
1747
1726
  {
1748
1727
  mode: "range",
@@ -1759,7 +1738,7 @@ Provided value: ${selectedRange.to}`
1759
1738
  onHoverDate: handleHoverDate
1760
1739
  }
1761
1740
  ) }),
1762
- numberOfMonths === 2 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "GeckoUICalendar__dual--second", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1741
+ numberOfMonths === 2 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "GeckoUICalendar__dual__item", "data-position": "second", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1763
1742
  CalendarDayPicker_default,
1764
1743
  {
1765
1744
  mode: "range",
@@ -1812,13 +1791,10 @@ Provided value: ${selectedRange.to}`
1812
1791
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1813
1792
  "div",
1814
1793
  {
1815
- className: classNames(
1816
- `GeckoUICalendar`,
1817
- `GeckoUICalendar--mode-${view}`,
1818
- `GeckoUICalendar--selection-${mode}`,
1819
- mode === "range" && view === "day" /* Day */ && `GeckoUICalendar--calendars-${numberOfMonths}`,
1820
- className
1821
- ),
1794
+ className: classNames(`GeckoUICalendar`, className),
1795
+ "data-mode": view,
1796
+ "data-selection": mode,
1797
+ "data-calendars": mode === "range" && view === "day" /* Day */ && numberOfMonths || void 0,
1822
1798
  style,
1823
1799
  children: renderContent()
1824
1800
  }
@@ -1924,6 +1900,7 @@ var DateInput = (_a) => {
1924
1900
  "div",
1925
1901
  {
1926
1902
  className: classNames("GeckoUIDateInputWrapper", wrapperClassName),
1903
+ "data-calendar-open": openCalendar || void 0,
1927
1904
  ref: (r) => refs.setReference(r),
1928
1905
  children: [
1929
1906
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
@@ -1936,7 +1913,7 @@ var DateInput = (_a) => {
1936
1913
  prefix,
1937
1914
  suffix,
1938
1915
  hasError,
1939
- className: classNames(className, openCalendar && "GeckoUIDateInput--calendar-open"),
1916
+ className,
1940
1917
  format,
1941
1918
  separator,
1942
1919
  placeholder,
@@ -2336,25 +2313,13 @@ var BaseDateRangeInput = (_a) => {
2336
2313
  const startValid = isValidDate(startYear, startMonth, startDay);
2337
2314
  const endValid = isValidDate(endYear, endMonth, endDay);
2338
2315
  const isError = !isEmpty && (!startEmpty && !startValid || !endEmpty && !endValid) || hasError;
2339
- const containerClasses = classNames(
2340
- "GeckoUIDateInput",
2341
- "GeckoUIDateRangeInput",
2342
- disabled && "GeckoUIDateInput--disabled",
2343
- readOnly && "GeckoUIDateInput--readOnly",
2344
- !disabled && !readOnly && "GeckoUIDateInput--enabled",
2345
- isError && "GeckoUIDateInput--error",
2346
- isEmpty && "GeckoUIDateInput--empty",
2347
- hasFocus && "GeckoUIDateInput--focus",
2348
- className
2349
- );
2316
+ const state = disabled ? "disabled" : readOnly ? "readonly" : "enabled";
2350
2317
  const renderSegments = (segments) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: segments.map(({ ref, value: value2, onChange: onChange2, maxLength, segment, display }, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react13.Fragment, { children: [
2351
2318
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2352
2319
  "label",
2353
2320
  {
2354
- className: classNames(
2355
- "GeckoUIDateInput__segment",
2356
- !value2 && "GeckoUIDateInput__segment--empty"
2357
- ),
2321
+ className: "GeckoUIDateInput__segment",
2322
+ "data-empty": !value2 || void 0,
2358
2323
  tabIndex: -1,
2359
2324
  onClick: (e) => {
2360
2325
  e.stopPropagation();
@@ -2390,7 +2355,11 @@ var BaseDateRangeInput = (_a) => {
2390
2355
  "div",
2391
2356
  __spreadProps(__spreadValues({
2392
2357
  ref: containerRef,
2393
- className: containerClasses
2358
+ className: classNames("GeckoUIDateInput", "GeckoUIDateRangeInput", className),
2359
+ "data-state": state,
2360
+ "data-error": isError || void 0,
2361
+ "data-empty": isEmpty || void 0,
2362
+ "data-focus": hasFocus || void 0
2394
2363
  }, rest), {
2395
2364
  onClick: () => handleDisplayClick(),
2396
2365
  children: [
@@ -2531,6 +2500,7 @@ var DateRangeInput = (_a) => {
2531
2500
  "div",
2532
2501
  {
2533
2502
  className: classNames("GeckoUIDateRangeInputWrapper", wrapperClassName),
2503
+ "data-calendar-open": openCalendar || void 0,
2534
2504
  ref: (r) => refs.setReference(r),
2535
2505
  children: [
2536
2506
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
@@ -2543,7 +2513,7 @@ var DateRangeInput = (_a) => {
2543
2513
  prefix,
2544
2514
  suffix,
2545
2515
  hasError,
2546
- className: classNames(className, openCalendar && "GeckoUIDateInput--calendar-open"),
2516
+ className,
2547
2517
  format,
2548
2518
  separator,
2549
2519
  rangeSeparator,
@@ -2586,12 +2556,9 @@ var Input = (0, import_react16.forwardRef)(
2586
2556
  "label",
2587
2557
  {
2588
2558
  "aria-disabled": disabled,
2589
- className: classNames(
2590
- "GeckoUIInput group",
2591
- disabled ? "GeckoUIInput--disabled" : "GeckoUIInput--enabled",
2592
- readOnly && "GeckoUIInput--readonly",
2593
- className
2594
- ),
2559
+ "data-state": disabled ? "disabled" : "enabled",
2560
+ "data-readonly": readOnly || void 0,
2561
+ className: classNames("GeckoUIInput group", className),
2595
2562
  htmlFor: id != null ? id : _id,
2596
2563
  children: [
2597
2564
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DynamicComponentRenderer_default, { component: prefix, inputRef: ref }),
@@ -2754,13 +2721,10 @@ var Button = (0, import_react19.forwardRef)(
2754
2721
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2755
2722
  "button",
2756
2723
  __spreadProps(__spreadValues({
2757
- className: classNames(
2758
- "GeckoUIButton",
2759
- `GeckoUIButton--${variant}`,
2760
- `GeckoUIButton--${variant}-${color}`,
2761
- `GeckoUIButton--size-${size}`,
2762
- className
2763
- ),
2724
+ "data-variant": variant,
2725
+ "data-color": color,
2726
+ "data-size": size,
2727
+ className: classNames("GeckoUIButton", className),
2764
2728
  ref,
2765
2729
  type: "button"
2766
2730
  }, rest), {
@@ -2833,14 +2797,8 @@ var LoadingButton = (_a) => {
2833
2797
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
2834
2798
  Button_default,
2835
2799
  __spreadProps(__spreadValues({
2836
- className: classNames(
2837
- "GeckoUILoadingButton",
2838
- `GeckoUILoadingButton--${variant}`,
2839
- `GeckoUILoadingButton--${variant}-${color}`,
2840
- `GeckoUILoadingButton--size-${size}`,
2841
- loading && `GeckoUILoadingButton--loading GeckoUILoadingButton--${variant}-loading`,
2842
- className
2843
- ),
2800
+ "data-loading": loading || void 0,
2801
+ className: classNames("GeckoUILoadingButton", className),
2844
2802
  disabled: loading || disabled,
2845
2803
  size,
2846
2804
  color,
@@ -2997,11 +2955,8 @@ var RHFCounterInput = (_a) => {
2997
2955
  return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2998
2956
  CounterInput_default,
2999
2957
  __spreadProps(__spreadValues({
3000
- className: classNames(
3001
- "GeckoUIRHFCounterInput",
3002
- hasError && "GeckoUIRHFCounterInput--error",
3003
- className
3004
- )
2958
+ className: classNames("GeckoUIRHFCounterInput", className),
2959
+ "data-error": hasError || void 0
3005
2960
  }, rest), {
3006
2961
  value: (_a2 = field.value) != null ? _a2 : 0,
3007
2962
  onChange: (value) => {
@@ -3058,11 +3013,8 @@ var RHFInput = (_a) => {
3058
3013
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3059
3014
  Input_default,
3060
3015
  __spreadProps(__spreadValues(__spreadValues({
3061
- className: classNames(
3062
- "GeckoUIRHFInput",
3063
- hasError && "GeckoUIRHFInput--error",
3064
- className
3065
- ),
3016
+ className: classNames("GeckoUIRHFInput", className),
3017
+ "data-error": hasError || void 0,
3066
3018
  prefix: prefix ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DynamicComponentRenderer_default, __spreadValues({ component: prefix }, renderProps)) : null,
3067
3019
  suffix: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DynamicComponentRenderer_default, __spreadValues({ component: suffix }, renderProps))
3068
3020
  }, field), rest), {
@@ -3288,11 +3240,8 @@ var RHFTextarea = (_a) => {
3288
3240
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
3289
3241
  Textarea_default,
3290
3242
  __spreadProps(__spreadValues(__spreadValues({
3291
- className: classNames(
3292
- "GeckoUIRHFTextarea",
3293
- !disabled && fieldState.error && "GeckoUIRHFTextarea--error",
3294
- className
3295
- )
3243
+ className: classNames("GeckoUIRHFTextarea", className),
3244
+ "data-error": !disabled && fieldState.error ? "" : void 0
3296
3245
  }, field), rest), {
3297
3246
  disabled,
3298
3247
  onBlur: (e) => {
@@ -3313,36 +3262,31 @@ RHFTextarea.displayName = "RHFTextarea";
3313
3262
  var RHFTextarea_default = RHFTextarea;
3314
3263
 
3315
3264
  // src/components/Switch/Switch.tsx
3316
- var import_react23 = require("@headlessui/react");
3317
- var import_react24 = require("react");
3265
+ var import_react23 = require("react");
3318
3266
  var import_jsx_runtime34 = require("react/jsx-runtime");
3319
- var Switch = (0, import_react24.forwardRef)(
3267
+ var Switch = (0, import_react23.forwardRef)(
3320
3268
  (_a, ref) => {
3321
- var _b = _a, { className, thumbClassName, size = "md" } = _b, rest = __objRest(_b, ["className", "thumbClassName", "size"]);
3322
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
3323
- import_react23.Switch,
3324
- __spreadProps(__spreadValues({
3325
- onKeyUp: (e) => {
3326
- if (e.key === "Enter") {
3327
- e.preventDefault();
3328
- return true;
3329
- }
3330
- },
3331
- className: classNames("group GeckoUISwitch", `GeckoUISwitch--size-${size}`, className)
3332
- }, rest), {
3333
- ref,
3334
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
3335
- "span",
3336
- {
3337
- className: classNames(
3338
- "GeckoUISwitch__thumb",
3339
- `GeckoUISwitch__thumb--size-${size}`,
3340
- thumbClassName
3341
- )
3269
+ var _b = _a, { size = "md", className, thumbClassName, onChange, onKeyDown } = _b, rest = __objRest(_b, ["size", "className", "thumbClassName", "onChange", "onKeyDown"]);
3270
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("label", { className: classNames("GeckoUISwitch", className), "data-size": size, children: [
3271
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
3272
+ "input",
3273
+ __spreadValues({
3274
+ ref,
3275
+ type: "checkbox",
3276
+ role: "switch",
3277
+ className: "GeckoUISwitch__input",
3278
+ onChange: (e) => onChange == null ? void 0 : onChange(e.target.checked),
3279
+ onKeyDown: (e) => {
3280
+ if (e.key === "Enter") {
3281
+ e.preventDefault();
3282
+ e.currentTarget.click();
3283
+ }
3284
+ onKeyDown == null ? void 0 : onKeyDown(e);
3342
3285
  }
3343
- )
3344
- })
3345
- );
3286
+ }, rest)
3287
+ ),
3288
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: classNames("GeckoUISwitch__thumb", thumbClassName), "data-size": size })
3289
+ ] });
3346
3290
  }
3347
3291
  );
3348
3292
  Switch.displayName = "Switch";
@@ -3399,7 +3343,7 @@ var RHFSwitch = (_a) => {
3399
3343
  __spreadProps(__spreadValues(__spreadValues({}, field), rest), {
3400
3344
  disabled,
3401
3345
  checked: isChecked,
3402
- className: classNames(`GeckoUIRHFSwitch GeckoUIRHFSwitch--size-${size}`, className),
3346
+ className: classNames("GeckoUIRHFSwitch", className),
3403
3347
  onBlur: (e) => {
3404
3348
  field.onBlur();
3405
3349
  onBlur == null ? void 0 : onBlur(e);
@@ -3411,10 +3355,7 @@ var RHFSwitch = (_a) => {
3411
3355
  },
3412
3356
  onChange: handleUpdate,
3413
3357
  size,
3414
- thumbClassName: classNames(
3415
- `GeckoUIRHFSwitch__thumb GeckoUIRHFSwitch__thumb--size-${size}`,
3416
- thumbClassName
3417
- ),
3358
+ thumbClassName: classNames("GeckoUIRHFSwitch__thumb", thumbClassName),
3418
3359
  value: void 0
3419
3360
  })
3420
3361
  );
@@ -3426,12 +3367,12 @@ RHFSwitch.displayName = "RHFSwitch";
3426
3367
  var RHFSwitch_default = RHFSwitch;
3427
3368
 
3428
3369
  // src/components/RHF/RHFRadio/RHFRadio.tsx
3429
- var import_react26 = require("react");
3370
+ var import_react25 = require("react");
3430
3371
 
3431
3372
  // src/components/Radio/Radio.tsx
3432
- var import_react25 = require("react");
3373
+ var import_react24 = require("react");
3433
3374
  var import_jsx_runtime36 = require("react/jsx-runtime");
3434
- var Radio = (0, import_react25.forwardRef)((_a, ref) => {
3375
+ var Radio = (0, import_react24.forwardRef)((_a, ref) => {
3435
3376
  var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
3436
3377
  return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("input", __spreadProps(__spreadValues({ className: classNames("GeckoUIRadio", className), ref }, rest), { type: "radio" }));
3437
3378
  });
@@ -3464,7 +3405,7 @@ var RHFRadio = (_a) => {
3464
3405
  "onChange",
3465
3406
  "onBlur"
3466
3407
  ]);
3467
- const _id = (0, import_react26.useId)();
3408
+ const _id = (0, import_react25.useId)();
3468
3409
  const uniqueId = id || _id;
3469
3410
  if (value === void 0 || value === null) {
3470
3411
  throw new Error("RHFRadio: value cannot be undefined or null");
@@ -3538,7 +3479,17 @@ var RHFDateInput_default = RHFDateInput;
3538
3479
  // src/components/RHF/RHFDateRangeInput/RHFDateRangeInput.tsx
3539
3480
  var import_jsx_runtime39 = require("react/jsx-runtime");
3540
3481
  var RHFDateRangeInput = (_a) => {
3541
- var _b = _a, { name, control, rules, onChange } = _b, rest = __objRest(_b, ["name", "control", "rules", "onChange"]);
3482
+ var _b = _a, {
3483
+ name,
3484
+ control,
3485
+ rules,
3486
+ onChange
3487
+ } = _b, rest = __objRest(_b, [
3488
+ "name",
3489
+ "control",
3490
+ "rules",
3491
+ "onChange"
3492
+ ]);
3542
3493
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
3543
3494
  RHFController_default,
3544
3495
  {
@@ -3603,15 +3554,12 @@ var RHFFileInput = (_a) => {
3603
3554
  rules,
3604
3555
  render: (renderProps) => {
3605
3556
  const { field } = renderProps;
3606
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("label", { className: classNames("GeckoUIRHFFileInput--wrapper", className), id, children: [
3557
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("label", { className: classNames("GeckoUIRHFFileInput", className), id, children: [
3607
3558
  /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
3608
3559
  "input",
3609
3560
  __spreadProps(__spreadValues(__spreadValues({}, field), rest), {
3610
- className: classNames(
3611
- "GeckoUIRHFFileInput",
3612
- Boolean(render) && "GeckoUIRHFFileInput--custom",
3613
- inputClassName
3614
- ),
3561
+ className: classNames("GeckoUIRHFFileInput__input", inputClassName),
3562
+ "data-custom": Boolean(render) || void 0,
3615
3563
  disabled,
3616
3564
  id,
3617
3565
  multiple,
@@ -3647,9 +3595,9 @@ RHFFileInput.displayName = "RHFFileInput";
3647
3595
  var RHFFileInput_default = RHFFileInput;
3648
3596
 
3649
3597
  // src/components/OTPInput/OTPInput.tsx
3650
- var import_react27 = require("react");
3598
+ var import_react26 = require("react");
3651
3599
  var import_jsx_runtime41 = require("react/jsx-runtime");
3652
- var OTPInput = (0, import_react27.forwardRef)(
3600
+ var OTPInput = (0, import_react26.forwardRef)(
3653
3601
  ({
3654
3602
  value = "",
3655
3603
  onChange,
@@ -3662,7 +3610,7 @@ var OTPInput = (0, import_react27.forwardRef)(
3662
3610
  onOTPComplete,
3663
3611
  disabled
3664
3612
  }, ref) => {
3665
- const divRef = (0, import_react27.useRef)(null);
3613
+ const divRef = (0, import_react26.useRef)(null);
3666
3614
  const focus = (index) => {
3667
3615
  var _a, _b;
3668
3616
  const children = (_a = divRef.current) == null ? void 0 : _a.children;
@@ -3694,11 +3642,8 @@ var OTPInput = (0, import_react27.forwardRef)(
3694
3642
  return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
3695
3643
  "div",
3696
3644
  {
3697
- className: classNames(
3698
- "GeckoUIOTPInput",
3699
- disabled ? "GeckoUIOTPInput--disabled" : "GeckoUIOTPInput--enabled",
3700
- className
3701
- ),
3645
+ className: classNames("GeckoUIOTPInput", className),
3646
+ "data-state": disabled ? "disabled" : "enabled",
3702
3647
  ref: divRef,
3703
3648
  style: { gridTemplateColumns: `repeat(${length}, minmax(0, 1fr))` },
3704
3649
  children: Array.from({ length }).map((_, i) => i).map((key, index) => {
@@ -3774,7 +3719,19 @@ var OTPInput_default = OTPInput;
3774
3719
  // src/components/RHF/RHFOTPInput/RHFOTPInput.tsx
3775
3720
  var import_jsx_runtime42 = require("react/jsx-runtime");
3776
3721
  var RHFOTPInput = (_a) => {
3777
- var _b = _a, { control, name, rules, disabled, className } = _b, rest = __objRest(_b, ["control", "name", "rules", "disabled", "className"]);
3722
+ var _b = _a, {
3723
+ control,
3724
+ name,
3725
+ rules,
3726
+ disabled,
3727
+ className
3728
+ } = _b, rest = __objRest(_b, [
3729
+ "control",
3730
+ "name",
3731
+ "rules",
3732
+ "disabled",
3733
+ "className"
3734
+ ]);
3778
3735
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
3779
3736
  RHFController_default,
3780
3737
  {
@@ -3786,11 +3743,8 @@ var RHFOTPInput = (_a) => {
3786
3743
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
3787
3744
  OTPInput_default,
3788
3745
  __spreadValues(__spreadValues({
3789
- className: classNames(
3790
- "GeckoUIRHFOTPInput",
3791
- !disabled && fieldState.error && "GeckoUIRHFOTPInput--error",
3792
- className
3793
- ),
3746
+ className: classNames("GeckoUIRHFOTPInput", className),
3747
+ "data-error": !disabled && fieldState.error ? "" : void 0,
3794
3748
  disabled
3795
3749
  }, rest), field)
3796
3750
  );
@@ -3862,12 +3816,10 @@ function RHFFilePickerRenderer({
3862
3816
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
3863
3817
  "div",
3864
3818
  {
3865
- className: classNames(
3866
- "GeckoUIRHFFilePicker",
3867
- loading && "GeckoUIRHFFilePicker--loading",
3868
- dragging && "GeckoUIRHFFilePicker--dragging",
3869
- error && "GeckoUIRHFFilePicker--error"
3870
- ),
3819
+ className: "GeckoUIRHFFilePicker",
3820
+ "data-loading": loading || void 0,
3821
+ "data-dragging": dragging || void 0,
3822
+ "data-error": error ? "" : void 0,
3871
3823
  children: [
3872
3824
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
3873
3825
  "div",
@@ -3922,8 +3874,8 @@ RHFFilePicker.displayName = "RHFFilePicker";
3922
3874
  var RHFFilePicker_default = RHFFilePicker;
3923
3875
 
3924
3876
  // src/components/Select/Select/Select.tsx
3925
- var import_react32 = require("@floating-ui/react");
3926
- var import_react33 = require("react");
3877
+ var import_react31 = require("@floating-ui/react");
3878
+ var import_react32 = require("react");
3927
3879
 
3928
3880
  // src/utils/isTextIncludes.ts
3929
3881
  function isTextIncludes(baseString = "", searchString) {
@@ -3992,7 +3944,7 @@ function findSelectOptions(el) {
3992
3944
  }
3993
3945
 
3994
3946
  // src/components/Select/SelectButton/SelectButton.tsx
3995
- var import_react30 = require("react");
3947
+ var import_react29 = require("react");
3996
3948
 
3997
3949
  // src/utils/createLabel.ts
3998
3950
  function createLabel(item) {
@@ -4025,13 +3977,13 @@ var createLabel_default = createLabel;
4025
3977
 
4026
3978
  // src/components/Select/hooks/useSelectTrigger.tsx
4027
3979
  var import_lodash2 = __toESM(require("lodash.isequal"));
4028
- var import_react29 = require("react");
3980
+ var import_react28 = require("react");
4029
3981
 
4030
3982
  // src/components/Select/useSelect.tsx
4031
- var import_react28 = require("react");
4032
- var SelectContext = (0, import_react28.createContext)(void 0);
3983
+ var import_react27 = require("react");
3984
+ var SelectContext = (0, import_react27.createContext)(void 0);
4033
3985
  var useSelect = () => {
4034
- const context = (0, import_react28.useContext)(SelectContext);
3986
+ const context = (0, import_react27.useContext)(SelectContext);
4035
3987
  if (context === void 0) {
4036
3988
  throw new Error("SelectContext must be used within a SelectProvider");
4037
3989
  }
@@ -4110,7 +4062,7 @@ var useSelectTrigger = () => {
4110
4062
  handleChange(value.at(-1));
4111
4063
  }
4112
4064
  };
4113
- const hasValue = (0, import_react29.useMemo)(() => {
4065
+ const hasValue = (0, import_react28.useMemo)(() => {
4114
4066
  if (multiple) {
4115
4067
  return Array.isArray(value) && !!(value == null ? void 0 : value.length);
4116
4068
  }
@@ -4170,9 +4122,9 @@ function SelectButton({ prefix, suffix, className }) {
4170
4122
  onChange,
4171
4123
  clearable
4172
4124
  } = useSelect();
4173
- const id = (0, import_react30.useId)();
4125
+ const id = (0, import_react29.useId)();
4174
4126
  const { hasValue, handleInputChange, handleKeyboardInteraction } = useSelectTrigger();
4175
- const trigger = (0, import_react30.useMemo)(() => import_react30.Children.toArray(children).find(isSelectTrigger), [children]);
4127
+ const trigger = (0, import_react29.useMemo)(() => import_react29.Children.toArray(children).find(isSelectTrigger), [children]);
4176
4128
  const handleClear = (e) => {
4177
4129
  e.stopPropagation();
4178
4130
  if (disabled) return;
@@ -4188,14 +4140,10 @@ function SelectButton({ prefix, suffix, className }) {
4188
4140
  const filterable = _filterable === true || _filterable === "inline";
4189
4141
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
4190
4142
  "div",
4191
- {
4192
- className: classNames(
4193
- "GeckoUISelectButton",
4194
- disabled ? "GeckoUISelectButton--disabled" : "GeckoUISelectButton--enabled",
4195
- multiple && hasValue && "GeckoUISelectButton--multi-select-default",
4196
- !filterable && "GeckoUISelectButton--readonly",
4197
- className
4198
- ),
4143
+ __spreadProps(__spreadValues({
4144
+ className: classNames("GeckoUISelectButton", className),
4145
+ "data-state": disabled ? "disabled" : "enabled"
4146
+ }, !filterable && { "data-readonly": "" }), {
4199
4147
  onClick: () => {
4200
4148
  var _a;
4201
4149
  if (open && !keyword) {
@@ -4211,40 +4159,30 @@ function SelectButton({ prefix, suffix, className }) {
4211
4159
  /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "GeckoUISelectButton__content", children: [
4212
4160
  hasValue ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SelectButtonContent, {}) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
4213
4161
  "span",
4214
- {
4215
- className: classNames(
4216
- "GeckoUISelectButton__value GeckoUISelectButton__value--placeholder",
4217
- placeholderClassName,
4218
- keyword && filterable && "GeckoUISelectButton__value--hidden"
4219
- ),
4162
+ __spreadProps(__spreadValues({
4163
+ className: classNames("GeckoUISelectButton__value", placeholderClassName),
4164
+ "data-placeholder": ""
4165
+ }, keyword && filterable && { "data-hidden": "" }), {
4220
4166
  children: placeholder != null ? placeholder : "Select Item"
4221
- }
4167
+ })
4222
4168
  ),
4223
4169
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
4224
4170
  "div",
4225
- {
4226
- className: classNames(
4227
- "GeckoUISelectButton__search",
4228
- !open && hasValue && "GeckoUISelectButton__search--focusonly",
4229
- !filterable && "GeckoUISelectButton__search--focusonly",
4230
- multiple && Array.isArray(value) && !!(value == null ? void 0 : value.length) && "GeckoUISelectButton__search--multi-selected"
4231
- ),
4171
+ __spreadProps(__spreadValues(__spreadValues({
4172
+ className: "GeckoUISelectButton__search"
4173
+ }, (!open && hasValue || !filterable) && { "data-focusonly": "" }), multiple && Array.isArray(value) && !!(value == null ? void 0 : value.length) && { "data-multi-selected": "" }), {
4232
4174
  "data-keyword": filterable ? keyword : "",
4233
4175
  children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
4234
4176
  "input",
4235
- {
4177
+ __spreadProps(__spreadValues(__spreadValues({
4236
4178
  id,
4237
4179
  ref: (r) => {
4238
4180
  setInputRef(r);
4239
4181
  },
4240
4182
  value: filterable ? keyword : "",
4241
4183
  disabled,
4242
- className: classNames(
4243
- "GeckoUISelectButton__search__input",
4244
- open && !hasValue && "GeckoUISelectButton__search__input--initial",
4245
- !multiple && hasValue && "GeckoUISelectButton__search__input--initial",
4246
- !filterable && "GeckoUISelectButton__search__input--readonly"
4247
- ),
4184
+ className: "GeckoUISelectButton__search__input"
4185
+ }, (open && !hasValue || !multiple && hasValue) && { "data-initial": "" }), !filterable && { "data-readonly": "" }), {
4248
4186
  onKeyDown: handleKeyboardInteraction,
4249
4187
  onFocusCapture: openMenu,
4250
4188
  onChange: filterable ? handleInputChange : (
@@ -4255,13 +4193,22 @@ function SelectButton({ prefix, suffix, className }) {
4255
4193
  autoCapitalize: "off",
4256
4194
  autoCorrect: "off",
4257
4195
  spellCheck: false
4258
- }
4196
+ })
4259
4197
  )
4260
- }
4198
+ })
4261
4199
  )
4262
4200
  ] }),
4263
4201
  /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "GeckoUISelectButton__icons", children: [
4264
- hasValue && !disabled && clearable && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { className: "GeckoUISelectButton__clear-button", type: "button", onClick: handleClear, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "GeckoUI-icon__clear" }) }),
4202
+ hasValue && !disabled && clearable && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
4203
+ "button",
4204
+ {
4205
+ className: "GeckoUISelectButton__clear-button",
4206
+ type: "button",
4207
+ onClick: handleClear,
4208
+ "data-disabled": disabled || void 0,
4209
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "GeckoUI-icon__clear" })
4210
+ }
4211
+ ),
4265
4212
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
4266
4213
  DynamicComponentRenderer_default,
4267
4214
  {
@@ -4270,7 +4217,7 @@ function SelectButton({ prefix, suffix, className }) {
4270
4217
  )
4271
4218
  ] })
4272
4219
  ]
4273
- }
4220
+ })
4274
4221
  );
4275
4222
  }
4276
4223
  function SelectButtonContent() {
@@ -4312,10 +4259,8 @@ function SelectButtonContent() {
4312
4259
  return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
4313
4260
  "div",
4314
4261
  {
4315
- className: classNames(
4316
- "GeckoUISelectButton__multiselected-chip",
4317
- disabled && "GeckoUISelectButton__multiselected-chip--disabled"
4318
- ),
4262
+ className: "GeckoUISelectButton__multiselected-chip",
4263
+ "data-disabled": disabled || void 0,
4319
4264
  children: [
4320
4265
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { children: option.label }),
4321
4266
  !disabled && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
@@ -4327,18 +4272,9 @@ function SelectButtonContent() {
4327
4272
  remove();
4328
4273
  },
4329
4274
  disabled,
4330
- className: classNames(
4331
- "GeckoUISelectButton__multiselected-chip__clear-button",
4332
- disabled && "GeckoUISelectButton__multiselected-chip__clear-button--disabled"
4333
- ),
4334
- children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
4335
- "span",
4336
- {
4337
- className: classNames(
4338
- "GeckoUISelectButton__multiselected-chip__clear-button__icon"
4339
- )
4340
- }
4341
- )
4275
+ className: "GeckoUISelectButton__multiselected-chip__clear-button",
4276
+ "data-disabled": disabled || void 0,
4277
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "GeckoUISelectButton__multiselected-chip__clear-button__icon" })
4342
4278
  }
4343
4279
  )
4344
4280
  ]
@@ -4352,15 +4288,15 @@ function SelectButtonContent() {
4352
4288
  }
4353
4289
  const selectedOptionLabel = value !== void 0 ? (_b = (_a = options.find((option) => isEqual_default(option.value, value))) == null ? void 0 : _a.label) != null ? _b : createLabel_default(value) : null;
4354
4290
  if (open && selectedOptionLabel && filterable) {
4355
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "GeckoUISelectButton__value GeckoUISelectButton__value--placeholder", children: selectedOptionLabel });
4291
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "GeckoUISelectButton__value", "data-placeholder": "", children: selectedOptionLabel });
4356
4292
  }
4357
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "GeckoUISelectButton__value GeckoUISelectButton__value--selected", children: selectedOptionLabel });
4293
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "GeckoUISelectButton__value", "data-selected": "", children: selectedOptionLabel });
4358
4294
  }
4359
4295
  SelectButton.displayName = "SelectButton";
4360
4296
  var SelectButton_default = SelectButton;
4361
4297
 
4362
4298
  // src/components/Select/SelectMenu/SelectMenu.tsx
4363
- var import_react31 = require("react");
4299
+ var import_react30 = require("react");
4364
4300
 
4365
4301
  // src/components/Select/SelectDropdownSearch/SelectDropdownSearch.tsx
4366
4302
  var import_lodash3 = __toESM(require("lodash.isequal"));
@@ -4470,8 +4406,8 @@ var SelectMenu = (_a) => {
4470
4406
  menuScrollContainerRef,
4471
4407
  floating: { refs, floatingStyles }
4472
4408
  } = useSelect();
4473
- const menuItems = (0, import_react31.useMemo)(
4474
- () => import_react31.Children.toArray(children).filter((el) => !isSelectTrigger(el)),
4409
+ const menuItems = (0, import_react30.useMemo)(
4410
+ () => import_react30.Children.toArray(children).filter((el) => !isSelectTrigger(el)),
4475
4411
  [children]
4476
4412
  );
4477
4413
  if (!open || disabled) {
@@ -4483,11 +4419,8 @@ var SelectMenu = (_a) => {
4483
4419
  __spreadProps(__spreadValues({
4484
4420
  ref: (r) => refs.setFloating(r),
4485
4421
  style: floatingStyles,
4486
- className: classNames(
4487
- "GeckoUISelectMenu",
4488
- hasDropdownSearch && "GeckoUISelectMenu--with-dropdown-search",
4489
- className
4490
- )
4422
+ className: classNames("GeckoUISelectMenu", className),
4423
+ "data-with-search": hasDropdownSearch || void 0
4491
4424
  }, rest), {
4492
4425
  children: [
4493
4426
  hasDropdownSearch && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SelectDropdownSearch_default, { className: "GeckoUISelectMenu__search-container", autoFocus: true }),
@@ -4502,7 +4435,7 @@ var SelectMenu = (_a) => {
4502
4435
  function Empty({ children }) {
4503
4436
  const { hideDefaultEmptyUI = false } = useSelect();
4504
4437
  if (hideDefaultEmptyUI) return null;
4505
- const customEmpty = import_react31.Children.toArray(children).find(isSelectEmpty);
4438
+ const customEmpty = import_react30.Children.toArray(children).find(isSelectEmpty);
4506
4439
  if (customEmpty) return null;
4507
4440
  return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SelectEmpty_default, {});
4508
4441
  }
@@ -4512,8 +4445,8 @@ var SelectMenu_default = SelectMenu;
4512
4445
  // src/components/Select/Select/Select.tsx
4513
4446
  var import_jsx_runtime48 = require("react/jsx-runtime");
4514
4447
  var Select = (props) => {
4515
- const inputRef = (0, import_react33.useRef)(null);
4516
- const menuScrollContainerRef = (0, import_react33.useRef)(null);
4448
+ const inputRef = (0, import_react32.useRef)(null);
4449
+ const menuScrollContainerRef = (0, import_react32.useRef)(null);
4517
4450
  const _a = props, {
4518
4451
  disabled,
4519
4452
  inputRef: customInputRef,
@@ -4541,22 +4474,22 @@ var Select = (props) => {
4541
4474
  "floatingStrategy",
4542
4475
  "clearable"
4543
4476
  ]);
4544
- const [open, setOpen] = (0, import_react33.useState)(false);
4545
- const [keyword, setKeyword] = (0, import_react33.useState)("");
4546
- const [focusedOption, setFocusedOption] = (0, import_react33.useState)(null);
4547
- const floating = (0, import_react32.useFloating)({
4477
+ const [open, setOpen] = (0, import_react32.useState)(false);
4478
+ const [keyword, setKeyword] = (0, import_react32.useState)("");
4479
+ const [focusedOption, setFocusedOption] = (0, import_react32.useState)(null);
4480
+ const floating = (0, import_react31.useFloating)({
4548
4481
  placement,
4549
4482
  strategy: floatingStrategy,
4550
- middleware: [(0, import_react32.flip)({ padding: 6 }), (0, import_react32.offset)({ mainAxis: 6 })],
4551
- whileElementsMounted: import_react32.autoUpdate,
4483
+ middleware: [(0, import_react31.flip)({ padding: 6 }), (0, import_react31.offset)({ mainAxis: 6 })],
4484
+ whileElementsMounted: import_react31.autoUpdate,
4552
4485
  open,
4553
4486
  onOpenChange: setOpen
4554
4487
  });
4555
4488
  const { refs } = floating;
4556
- const options = (0, import_react33.useMemo)(
4489
+ const options = (0, import_react32.useMemo)(
4557
4490
  () => {
4558
4491
  var _a2;
4559
- return (_a2 = import_react33.Children.toArray(children).map(findSelectOptions).filter(Boolean).flat()) != null ? _a2 : [];
4492
+ return (_a2 = import_react32.Children.toArray(children).map(findSelectOptions).filter(Boolean).flat()) != null ? _a2 : [];
4560
4493
  },
4561
4494
  [children]
4562
4495
  );
@@ -4652,7 +4585,7 @@ Select.displayName = "Select";
4652
4585
  var Select_default = Select;
4653
4586
 
4654
4587
  // src/components/Select/SelectOption/SelectOption.tsx
4655
- var import_react34 = require("react");
4588
+ var import_react33 = require("react");
4656
4589
  var import_jsx_runtime49 = require("react/jsx-runtime");
4657
4590
  var SelectOption = (_a) => {
4658
4591
  var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
@@ -4675,7 +4608,7 @@ var SelectOption = (_a) => {
4675
4608
  "onRemove",
4676
4609
  "disabled"
4677
4610
  ]);
4678
- const ref = (0, import_react34.useRef)(null);
4611
+ const ref = (0, import_react33.useRef)(null);
4679
4612
  const { preventDefault, attachPreventDefault } = usePreventDefault_default();
4680
4613
  const {
4681
4614
  closeMenuOnSelect,
@@ -4693,7 +4626,7 @@ var SelectOption = (_a) => {
4693
4626
  } = useSelect();
4694
4627
  const selected = isSelected(value);
4695
4628
  const focused = !isNil_default(focusedOption) && isEqual_default(focusedOption == null ? void 0 : focusedOption.value, value);
4696
- (0, import_react34.useEffect)(() => {
4629
+ (0, import_react33.useEffect)(() => {
4697
4630
  if (!ref.current || !menuScrollContainerRef.current) return;
4698
4631
  if ((focusedOption == null ? void 0 : focusedOption.focusType) !== "mouse" && focused) {
4699
4632
  const scrollContainer = menuScrollContainerRef.current;
@@ -4765,11 +4698,11 @@ var SelectOption = (_a) => {
4765
4698
  ref,
4766
4699
  className: classNames(
4767
4700
  "GeckoUISelectOption",
4768
- `GeckoUISelectOption--${selected ? "selected" : "unselected"}`,
4769
- focused && "GeckoUISelectOption--focused",
4770
- disabled && "GeckoUISelectOption--disabled",
4771
4701
  typeof className === "function" ? className({ value, selected, focused }) : className
4772
- )
4702
+ ),
4703
+ "data-state": selected ? "selected" : "unselected",
4704
+ "data-focused": focused || void 0,
4705
+ "data-disabled": disabled || void 0
4773
4706
  }, rest), {
4774
4707
  onMouseMove: () => {
4775
4708
  if ((focusedOption == null ? void 0 : focusedOption.value) !== value) {
@@ -4851,11 +4784,8 @@ var RHFSelect = (_a) => {
4851
4784
  inputRef: ref,
4852
4785
  wrapperClassName: classNames("GeckoUIRHFSelect", wrapperClassName)
4853
4786
  }, rest), {
4854
- className: classNames(
4855
- "GeckoUIRHFSelectButton",
4856
- !!error && "GeckoUIRHFSelectButton--error",
4857
- className
4858
- ),
4787
+ className: classNames("GeckoUIRHFSelectButton", className),
4788
+ "data-error": !!error || void 0,
4859
4789
  value,
4860
4790
  onChange: (v) => {
4861
4791
  var _a2;
@@ -4886,31 +4816,19 @@ var Alert = (props) => {
4886
4816
  } = props;
4887
4817
  return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
4888
4818
  "div",
4889
- {
4890
- className: classNames(
4891
- "GeckoUIAlert",
4892
- `GeckoUIAlert--${variant}`,
4893
- condensed && "GeckoUIAlert--condensed",
4894
- className
4895
- ),
4819
+ __spreadProps(__spreadValues({
4820
+ className: classNames("GeckoUIAlert", className),
4821
+ "data-variant": variant
4822
+ }, condensed ? { "data-condensed": "" } : {}), {
4896
4823
  children: [
4897
4824
  /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "GeckoUIAlert__body", children: [
4898
- icon ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(DynamicComponentRenderer_default, { component: icon }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
4899
- "div",
4900
- {
4901
- className: classNames(
4902
- "GeckoUIAlert__icon",
4903
- `GeckoUIAlert__icon--${variant}`,
4904
- iconClassName
4905
- )
4906
- }
4907
- ),
4825
+ icon ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(DynamicComponentRenderer_default, { component: icon }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: classNames("GeckoUIAlert__icon", iconClassName), "data-variant": variant }),
4908
4826
  /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(DynamicComponentRenderer_default, { component: title, className: "GeckoUIAlert__title" }),
4909
4827
  Boolean(onRemove) && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { className: "GeckoUIAlert__remove-button", onClick: onRemove, type: "button", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { className: "GeckoUIAlert__remove-button__icon" }) })
4910
4828
  ] }),
4911
4829
  description ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "GeckoUIAlert__description", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(DynamicComponentRenderer_default, { component: description }) }) : null
4912
4830
  ]
4913
- }
4831
+ })
4914
4832
  );
4915
4833
  };
4916
4834
  var Alert_default = Alert;
@@ -4960,7 +4878,7 @@ var Pagination = ({ currentPage, totalPages, onChange, className }) => {
4960
4878
  onChange(currentPage - 1);
4961
4879
  },
4962
4880
  type: "button",
4963
- children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "GeckoUIPagination__arrow__icon GeckoUIPagination__arrow__icon--previous" })
4881
+ children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "GeckoUIPagination__arrow__icon", "data-direction": "previous" })
4964
4882
  }
4965
4883
  ),
4966
4884
  /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "GeckoUIPagination__page-count", children: [
@@ -4971,11 +4889,9 @@ var Pagination = ({ currentPage, totalPages, onChange, className }) => {
4971
4889
  /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "GeckoUIPagination__page-buttons", children: pages.map((page, index) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
4972
4890
  "button",
4973
4891
  {
4974
- className: classNames(
4975
- "GeckoUIPagination__page-button",
4976
- page === currentPage && "GeckoUIPagination__page-button--active",
4977
- page === "..." && "GeckoUIPagination__page-button--ellipsis"
4978
- ),
4892
+ className: "GeckoUIPagination__page-button",
4893
+ "data-active": page === currentPage || void 0,
4894
+ "data-ellipsis": page === "..." || void 0,
4979
4895
  disabled: page === "...",
4980
4896
  onClick: () => page !== "..." && onChange(Number(page)),
4981
4897
  type: "button",
@@ -4992,7 +4908,7 @@ var Pagination = ({ currentPage, totalPages, onChange, className }) => {
4992
4908
  onChange(currentPage + 1);
4993
4909
  },
4994
4910
  type: "button",
4995
- children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "GeckoUIPagination__arrow__icon GeckoUIPagination__arrow__icon--next" })
4911
+ children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { className: "GeckoUIPagination__arrow__icon", "data-direction": "next" })
4996
4912
  }
4997
4913
  )
4998
4914
  ] });
@@ -5000,10 +4916,10 @@ var Pagination = ({ currentPage, totalPages, onChange, className }) => {
5000
4916
  var Pagination_default = Pagination;
5001
4917
 
5002
4918
  // src/components/ConfirmDialog/ConfirmDialog.tsx
5003
- var import_react36 = require("react");
4919
+ var import_react35 = require("react");
5004
4920
 
5005
4921
  // src/components/Dialog/Dialog.tsx
5006
- var import_react35 = require("react");
4922
+ var import_react34 = require("react");
5007
4923
  var import_client = require("react-dom/client");
5008
4924
 
5009
4925
  // src/components/Dialog/DialogContainer.tsx
@@ -5054,8 +4970,8 @@ function DialogContent(_a) {
5054
4970
  }
5055
4971
  return acc;
5056
4972
  }, {});
5057
- const ref = (0, import_react35.useRef)(null);
5058
- const [animationState, setAnimationState] = (0, import_react35.useState)("entering");
4973
+ const ref = (0, import_react34.useRef)(null);
4974
+ const [animationState, setAnimationState] = (0, import_react34.useState)("entering");
5059
4975
  const handleDismiss = () => {
5060
4976
  setAnimationState("closing");
5061
4977
  setTimeout(() => {
@@ -5066,7 +4982,7 @@ function DialogContent(_a) {
5066
4982
  }
5067
4983
  }, 300);
5068
4984
  };
5069
- (0, import_react35.useEffect)(() => {
4985
+ (0, import_react34.useEffect)(() => {
5070
4986
  dismissCallback = handleDismiss;
5071
4987
  requestAnimationFrame(() => {
5072
4988
  requestAnimationFrame(() => {
@@ -5097,10 +5013,10 @@ function ConfirmDialogContent({
5097
5013
  onConfirm,
5098
5014
  onCancel
5099
5015
  }) {
5100
- const [cancelLoading, setCancelLoading] = (0, import_react36.useState)(false);
5101
- const [confirmLoading, setConfirmLoading] = (0, import_react36.useState)(false);
5016
+ const [cancelLoading, setCancelLoading] = (0, import_react35.useState)(false);
5017
+ const [confirmLoading, setConfirmLoading] = (0, import_react35.useState)(false);
5102
5018
  const { preventDefault, attachPreventDefault } = usePreventDefault_default();
5103
- const handleConfirm = (0, import_react36.useCallback)(() => __async(null, null, function* () {
5019
+ const handleConfirm = (0, import_react35.useCallback)(() => __async(null, null, function* () {
5104
5020
  const isAsync = isAsyncFn(onConfirm);
5105
5021
  if (isAsync) {
5106
5022
  setConfirmLoading(true);
@@ -5118,7 +5034,7 @@ function ConfirmDialogContent({
5118
5034
  setCancelLoading(false);
5119
5035
  attachPreventDefault(dismiss2);
5120
5036
  };
5121
- (0, import_react36.useEffect)(() => {
5037
+ (0, import_react35.useEffect)(() => {
5122
5038
  const onKeyDown = (e) => {
5123
5039
  const el = document.activeElement;
5124
5040
  if (e.key === "Enter") {
@@ -5200,9 +5116,9 @@ var GeckoUIPortal = ({ toastOptions = {} }) => {
5200
5116
  __spreadValues({
5201
5117
  position: "bottom-right",
5202
5118
  style: __spreadValues({
5203
- "--normal-bg": "rgb(var(--gecko-ui-surface-primary))",
5204
- "--normal-text": "rgb(var(--gecko-ui-text-primary))",
5205
- "--normal-border": "rgb(var(--gecko-ui-border-primary))"
5119
+ "--normal-bg": "var(--color-surface-primary)",
5120
+ "--normal-text": "var(--color-text-primary)",
5121
+ "--normal-border": "var(--color-border-primary)"
5206
5122
  }, style)
5207
5123
  }, restToastOptions)
5208
5124
  ),
@@ -5213,25 +5129,9 @@ var GeckoUIPortal = ({ toastOptions = {} }) => {
5213
5129
  var GeckoUIPortal_default = GeckoUIPortal;
5214
5130
 
5215
5131
  // src/components/Drawer/Drawer.tsx
5216
- var import_react37 = require("react");
5132
+ var import_react36 = require("react");
5217
5133
  var import_client2 = require("react-dom/client");
5218
5134
  var import_jsx_runtime58 = require("react/jsx-runtime");
5219
- function getDrawerClasses(placement, open, className) {
5220
- const baseClass = "GeckoUIDrawer__drawer";
5221
- const placementClass = `${baseClass}--${placement}`;
5222
- const stateClass = open ? `${baseClass}--open` : `${baseClass}--closed`;
5223
- let compoundClass = "";
5224
- if (open) {
5225
- if (placement === "right" || placement === "left") {
5226
- compoundClass = `${baseClass}--right-open ${baseClass}--left-open`;
5227
- } else if (placement === "top" || placement === "bottom") {
5228
- compoundClass = `${baseClass}--top-open ${baseClass}--bottom-open`;
5229
- }
5230
- } else {
5231
- compoundClass = `${baseClass}--${placement}-closed`;
5232
- }
5233
- return classNames(baseClass, placementClass, stateClass, compoundClass, className);
5234
- }
5235
5135
  function Drawer({
5236
5136
  open = false,
5237
5137
  allowClickOutside,
@@ -5243,7 +5143,7 @@ function Drawer({
5243
5143
  children,
5244
5144
  dismissOnEscape = true
5245
5145
  }) {
5246
- const drawerRootRef = (0, import_react37.useRef)(null);
5146
+ const drawerRootRef = (0, import_react36.useRef)(null);
5247
5147
  const handleDismiss = () => {
5248
5148
  if (open) handleClose == null ? void 0 : handleClose();
5249
5149
  };
@@ -5256,19 +5156,23 @@ function Drawer({
5256
5156
  /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
5257
5157
  "div",
5258
5158
  {
5259
- className: classNames(
5260
- "GeckoUIDrawer__backdrop",
5261
- open ? "GeckoUIDrawer__backdrop--visible" : "GeckoUIDrawer__backdrop--hidden",
5262
- hideBackdrop && "GeckoUIDrawer__backdrop--hidden",
5263
- allowClickOutside && "GeckoUIDrawer__backdrop--clickthrough",
5264
- backdropClassName
5265
- ),
5159
+ "data-state": open && !hideBackdrop ? "visible" : "hidden",
5160
+ "data-clickthrough": allowClickOutside || void 0,
5161
+ className: classNames("GeckoUIDrawer__backdrop", backdropClassName),
5266
5162
  onClick: handleDismiss,
5267
5163
  onKeyDown: handleDismiss,
5268
5164
  role: "presentation"
5269
5165
  }
5270
5166
  ),
5271
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: getDrawerClasses(placement, open, className), children })
5167
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
5168
+ "div",
5169
+ {
5170
+ "data-placement": placement,
5171
+ "data-state": open ? "open" : "closed",
5172
+ className: classNames("GeckoUIDrawer__drawer", className),
5173
+ children
5174
+ }
5175
+ )
5272
5176
  ] });
5273
5177
  }
5274
5178
  var root2 = null;
@@ -5291,144 +5195,227 @@ Drawer.dismiss = () => {
5291
5195
  };
5292
5196
  var Drawer_default = Drawer;
5293
5197
 
5294
- // src/components/Menu/Menu.tsx
5295
- var import_react38 = require("@headlessui/react");
5198
+ // src/components/Menu/Menu/Menu.tsx
5199
+ var import_react40 = require("@floating-ui/react");
5200
+ var import_react41 = require("react");
5201
+
5202
+ // src/components/Menu/Menu.utils.ts
5203
+ var import_react38 = require("react");
5204
+
5205
+ // src/components/Menu/useMenu.tsx
5206
+ var import_react37 = require("react");
5207
+ var MenuContext = (0, import_react37.createContext)(void 0);
5208
+ var useMenu = () => {
5209
+ const context = (0, import_react37.useContext)(MenuContext);
5210
+ if (context === void 0) {
5211
+ throw new Error("useMenu must be used within a Menu");
5212
+ }
5213
+ return context;
5214
+ };
5215
+
5216
+ // src/components/Menu/MenuTrigger/MenuTrigger.tsx
5217
+ var MenuTrigger = ({ children }) => {
5218
+ const { open, openMenu, closeMenu, toggleMenu, disabled } = useMenu();
5219
+ return children({ open, openMenu, closeMenu, toggleMenu, disabled });
5220
+ };
5221
+ MenuTrigger.displayName = "MenuTrigger";
5222
+ var MenuTrigger_default = MenuTrigger;
5223
+
5224
+ // src/components/Menu/Menu.utils.ts
5225
+ function isMenuTrigger(child) {
5226
+ return (0, import_react38.isValidElement)(child) && child.type === MenuTrigger_default;
5227
+ }
5228
+
5229
+ // src/components/Menu/MenuButton/MenuButton.tsx
5296
5230
  var import_jsx_runtime59 = require("react/jsx-runtime");
5297
- var Menu = import_react38.Menu;
5298
- var MenuButton = (_a) => {
5299
- var _b = _a, { as } = _b, rest = __objRest(_b, ["as"]);
5231
+ var MenuButton = ({ children, className }) => {
5232
+ const { toggleMenu, openMenu, disabled, open, menuRef } = useMenu();
5233
+ const handleKeyDown = (e) => {
5234
+ var _a;
5235
+ if (e.key === "ArrowDown") {
5236
+ e.preventDefault();
5237
+ if (!open) openMenu();
5238
+ const firstItem = (_a = menuRef.current) == null ? void 0 : _a.querySelector("[role=menuitem]");
5239
+ setTimeout(() => firstItem == null ? void 0 : firstItem.focus());
5240
+ }
5241
+ };
5300
5242
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
5301
- import_react38.MenuButton,
5302
- __spreadProps(__spreadValues({
5303
- as: as != null ? as : "button"
5304
- }, rest), {
5305
- className: (args) => {
5306
- const className = rest.className;
5307
- return classNames(
5308
- "GeckoUIMenu__button",
5309
- typeof className === "function" ? className(args) : className
5310
- );
5311
- }
5312
- })
5243
+ "button",
5244
+ {
5245
+ type: "button",
5246
+ className: classNames("GeckoUIMenu__button", className),
5247
+ disabled,
5248
+ "aria-haspopup": "menu",
5249
+ "aria-expanded": open,
5250
+ onClick: toggleMenu,
5251
+ onKeyDown: handleKeyDown,
5252
+ children
5253
+ }
5313
5254
  );
5314
5255
  };
5315
- var MenuItems = (_a) => {
5316
- var _b = _a, { as } = _b, rest = __objRest(_b, ["as"]);
5317
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
5318
- import_react38.MenuItems,
5319
- __spreadProps(__spreadValues({
5320
- as: as != null ? as : "div"
5321
- }, rest), {
5322
- className: (args) => {
5323
- const className = rest.className;
5324
- return classNames(
5325
- "GeckoUIMenu__items",
5326
- typeof className === "function" ? className(args) : className
5327
- );
5256
+ MenuButton.displayName = "MenuButton";
5257
+ var MenuButton_default = MenuButton;
5258
+
5259
+ // src/components/Menu/MenuPanel/MenuPanel.tsx
5260
+ var import_react39 = require("react");
5261
+ var import_jsx_runtime60 = require("react/jsx-runtime");
5262
+ var MenuPanel = ({ children, className }) => {
5263
+ const {
5264
+ open,
5265
+ disabled,
5266
+ closeMenu,
5267
+ menuRef,
5268
+ floating: { refs, floatingStyles }
5269
+ } = useMenu();
5270
+ const panelRef = (0, import_react39.useRef)(null);
5271
+ (0, import_react39.useEffect)(() => {
5272
+ if (!open || !panelRef.current) return;
5273
+ panelRef.current.focus();
5274
+ }, [open]);
5275
+ if (!open || disabled) return null;
5276
+ const handleKeyDown = (e) => {
5277
+ var _a, _b;
5278
+ const items = Array.from(
5279
+ (_b = (_a = panelRef.current) == null ? void 0 : _a.querySelectorAll("[role=menuitem]:not([data-disabled])")) != null ? _b : []
5280
+ );
5281
+ const current = document.activeElement;
5282
+ const currentIndex = items.indexOf(current);
5283
+ switch (e.key) {
5284
+ case "ArrowDown": {
5285
+ e.preventDefault();
5286
+ const next = items[(currentIndex + 1) % items.length];
5287
+ next == null ? void 0 : next.focus();
5288
+ break;
5328
5289
  }
5329
- })
5290
+ case "ArrowUp": {
5291
+ e.preventDefault();
5292
+ const prev = items[(currentIndex - 1 + items.length) % items.length];
5293
+ prev == null ? void 0 : prev.focus();
5294
+ break;
5295
+ }
5296
+ case "Escape":
5297
+ case "Tab":
5298
+ e.preventDefault();
5299
+ closeMenu();
5300
+ break;
5301
+ }
5302
+ };
5303
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
5304
+ "div",
5305
+ {
5306
+ ref: (r) => {
5307
+ refs.setFloating(r);
5308
+ menuRef.current = r;
5309
+ panelRef.current = r;
5310
+ },
5311
+ role: "menu",
5312
+ tabIndex: -1,
5313
+ style: floatingStyles,
5314
+ className: classNames("GeckoUIMenu__items", className),
5315
+ onKeyDown: handleKeyDown,
5316
+ children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "GeckoUIMenu__scroll-container", children })
5317
+ }
5330
5318
  );
5331
5319
  };
5332
- var MenuItem = (_a) => {
5333
- var _b = _a, { children, as } = _b, rest = __objRest(_b, ["children", "as"]);
5334
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
5335
- import_react38.MenuItem,
5336
- __spreadProps(__spreadValues({}, rest), {
5337
- className: (args) => {
5338
- const className = rest.className;
5339
- return classNames(
5340
- "GeckoUIMenu__item",
5341
- typeof className === "function" ? className(args) : className
5342
- );
5320
+ MenuPanel.displayName = "MenuPanel";
5321
+ var MenuPanel_default = MenuPanel;
5322
+
5323
+ // src/components/Menu/Menu/Menu.tsx
5324
+ var import_jsx_runtime61 = require("react/jsx-runtime");
5325
+ var Menu = ({
5326
+ label,
5327
+ disabled = false,
5328
+ placement = "bottom-start",
5329
+ floatingStrategy,
5330
+ className,
5331
+ menuClassName,
5332
+ buttonClassName,
5333
+ children
5334
+ }) => {
5335
+ const menuRef = (0, import_react41.useRef)(null);
5336
+ const [open, setOpen] = (0, import_react41.useState)(false);
5337
+ const floating = (0, import_react40.useFloating)({
5338
+ placement,
5339
+ strategy: floatingStrategy,
5340
+ middleware: [(0, import_react40.flip)({ padding: 6 }), (0, import_react40.offset)({ mainAxis: 6 })],
5341
+ whileElementsMounted: import_react40.autoUpdate,
5342
+ open,
5343
+ onOpenChange: setOpen
5344
+ });
5345
+ const { refs } = floating;
5346
+ const openMenu = (0, import_react41.useCallback)(() => {
5347
+ if (disabled || open) return;
5348
+ setOpen(true);
5349
+ }, [disabled, open]);
5350
+ const closeMenu = (0, import_react41.useCallback)(() => {
5351
+ setOpen(false);
5352
+ }, []);
5353
+ const toggleMenu = (0, import_react41.useCallback)(() => {
5354
+ if (open) {
5355
+ closeMenu();
5356
+ } else {
5357
+ openMenu();
5358
+ }
5359
+ }, [open, openMenu, closeMenu]);
5360
+ useClickOutside_default(() => {
5361
+ closeMenu();
5362
+ }, [refs.reference]);
5363
+ const childArray = import_react41.Children.toArray(children);
5364
+ const trigger = childArray.find(isMenuTrigger);
5365
+ const menuItems = childArray.filter((el) => !isMenuTrigger(el));
5366
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
5367
+ MenuContext.Provider,
5368
+ {
5369
+ value: {
5370
+ open,
5371
+ setOpen,
5372
+ floating,
5373
+ openMenu,
5374
+ closeMenu,
5375
+ toggleMenu,
5376
+ disabled,
5377
+ menuRef
5343
5378
  },
5344
- as: as != null ? as : "button",
5345
- type: "button",
5346
- children
5347
- })
5379
+ children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: classNames("GeckoUIMenu", className), ref: (r) => refs.setReference(r), children: [
5380
+ trigger != null ? trigger : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(MenuButton_default, { className: buttonClassName, children: label != null ? label : "Menu" }),
5381
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(MenuPanel_default, { className: menuClassName, children: menuItems })
5382
+ ] })
5383
+ }
5348
5384
  );
5349
5385
  };
5350
- var MenuHeading = import_react38.MenuHeading;
5351
- var MenuSection = import_react38.MenuSection;
5352
- var MenuSeparator = import_react38.MenuSeparator;
5386
+ Menu.displayName = "Menu";
5387
+ var Menu_default = Menu;
5353
5388
 
5354
- // src/components/Dropdown/Dropdown.tsx
5355
- var import_jsx_runtime60 = require("react/jsx-runtime");
5356
- function Dropdown(_a) {
5357
- var _b = _a, {
5358
- items,
5359
- anchor,
5360
- icon,
5361
- className,
5362
- menuClassName,
5363
- iconClassName,
5364
- children,
5365
- hideArrowIcon
5366
- } = _b, rest = __objRest(_b, [
5367
- "items",
5368
- "anchor",
5369
- "icon",
5370
- "className",
5371
- "menuClassName",
5372
- "iconClassName",
5373
- "children",
5374
- "hideArrowIcon"
5375
- ]);
5376
- const dataAttributes = Object.keys(rest).reduce((acc, key) => {
5377
- if (key.startsWith("data-")) {
5378
- acc[key] = rest[key];
5389
+ // src/components/Menu/MenuItem/MenuItem.tsx
5390
+ var import_jsx_runtime62 = require("react/jsx-runtime");
5391
+ var MenuItem = (_a) => {
5392
+ var _b = _a, { label, disabled, className, onClick, children } = _b, rest = __objRest(_b, ["label", "disabled", "className", "onClick", "children"]);
5393
+ const { closeMenu } = useMenu();
5394
+ const handleClick = () => {
5395
+ if (disabled) return;
5396
+ onClick == null ? void 0 : onClick();
5397
+ closeMenu();
5398
+ };
5399
+ const handleKeyDown = (e) => {
5400
+ if (e.key === "Enter" || e.key === " ") {
5401
+ e.preventDefault();
5402
+ handleClick();
5379
5403
  }
5380
- return acc;
5381
- }, {});
5382
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Menu, { children: [
5383
- /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
5384
- MenuButton,
5385
- __spreadProps(__spreadValues({}, dataAttributes), {
5386
- onClick: (e) => {
5387
- e.stopPropagation();
5388
- setTimeout(() => {
5389
- var _a2;
5390
- return (_a2 = document.activeElement) == null ? void 0 : _a2.blur();
5391
- }, 0);
5392
- },
5393
- type: "button",
5394
- as: "button",
5395
- onKeyDown: (e) => {
5396
- if (e.key === "Enter") {
5397
- setTimeout(() => {
5398
- var _a2;
5399
- return (_a2 = document.activeElement) == null ? void 0 : _a2.blur();
5400
- }, 0);
5401
- }
5402
- },
5403
- className: classNames(`GeckoUIDropdown__button`, className),
5404
- children: [
5405
- children,
5406
- !hideArrowIcon && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: classNames("GeckoUIDropdown__icon", iconClassName) })
5407
- ]
5408
- })
5409
- ),
5410
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
5411
- MenuItems,
5412
- {
5413
- className: classNames("GeckoUIDropdown__menu", menuClassName),
5414
- anchor: anchor || "bottom start",
5415
- children: () => {
5416
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_jsx_runtime60.Fragment, { children: items.map((item, index) => {
5417
- const label = createLabel_default(item);
5418
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
5419
- MenuItem,
5420
- __spreadProps(__spreadValues({}, dataAttributes), {
5421
- className: classNames("GeckoUIDropdown__menu-item", item.className),
5422
- onClick: item.onClick,
5423
- children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DynamicComponentRenderer_default, { component: label })
5424
- }),
5425
- index
5426
- );
5427
- }) });
5428
- }
5429
- }
5430
- )
5431
- ] });
5432
- }
5433
- Dropdown.displayName = "Dropdown";
5434
- var Dropdown_default = Dropdown;
5404
+ };
5405
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
5406
+ "div",
5407
+ __spreadProps(__spreadValues({
5408
+ role: "menuitem",
5409
+ tabIndex: disabled ? -1 : 0,
5410
+ className: classNames("GeckoUIMenu__item", className),
5411
+ "data-disabled": disabled || void 0,
5412
+ onMouseMove: (e) => e.currentTarget.focus(),
5413
+ onClick: disabled ? void 0 : handleClick,
5414
+ onKeyDown: handleKeyDown
5415
+ }, rest), {
5416
+ children: children != null ? children : label
5417
+ })
5418
+ );
5419
+ };
5420
+ MenuItem.displayName = "MenuItem";
5421
+ var MenuItem_default = MenuItem;