@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.mjs CHANGED
@@ -755,27 +755,20 @@ var CounterInput = forwardRef2(
755
755
  return /* @__PURE__ */ jsxs3(
756
756
  "div",
757
757
  {
758
- className: classNames(
759
- "GeckoUICounterInput",
760
- `GeckoUICounterInput--size-${size}`,
761
- disabled && "GeckoUICounterInput--disabled",
762
- readOnly && "GeckoUICounterInput--readonly",
763
- className
764
- ),
758
+ className: classNames("GeckoUICounterInput", className),
759
+ "data-size": size,
760
+ "data-state": disabled ? "disabled" : readOnly ? "readonly" : void 0,
765
761
  children: [
766
762
  /* @__PURE__ */ jsx6(
767
763
  "button",
768
764
  {
769
765
  type: "button",
770
- className: classNames(
771
- "GeckoUICounterInput__button",
772
- "GeckoUICounterInput__button--decrement",
773
- buttonClassName
774
- ),
766
+ className: classNames("GeckoUICounterInput__button", buttonClassName),
767
+ "data-action": "decrement",
775
768
  onClick: handleDecrement,
776
769
  disabled: disabled || readOnly || isAtMin,
777
770
  "aria-label": "Decrement",
778
- children: /* @__PURE__ */ jsx6("span", { className: "GeckoUICounterInput__icon GeckoUICounterInput__icon--minus" })
771
+ children: /* @__PURE__ */ jsx6("span", { className: "GeckoUICounterInput__icon", "data-icon": "minus" })
779
772
  }
780
773
  ),
781
774
  /* @__PURE__ */ jsx6(
@@ -798,15 +791,12 @@ var CounterInput = forwardRef2(
798
791
  "button",
799
792
  {
800
793
  type: "button",
801
- className: classNames(
802
- "GeckoUICounterInput__button",
803
- "GeckoUICounterInput__button--increment",
804
- buttonClassName
805
- ),
794
+ className: classNames("GeckoUICounterInput__button", buttonClassName),
795
+ "data-action": "increment",
806
796
  onClick: handleIncrement,
807
797
  disabled: disabled || readOnly || isAtMax,
808
798
  "aria-label": "Increment",
809
- children: /* @__PURE__ */ jsx6("span", { className: "GeckoUICounterInput__icon GeckoUICounterInput__icon--plus" })
799
+ children: /* @__PURE__ */ jsx6("span", { className: "GeckoUICounterInput__icon", "data-icon": "plus" })
810
800
  }
811
801
  )
812
802
  ]
@@ -1125,70 +1115,71 @@ var BaseDateInput = ({
1125
1115
  const inputs = segmentOrder.map((segment) => allInputs[segment]);
1126
1116
  const isEmpty = !month && !day && !year && !hasFocus;
1127
1117
  const isError = !isEmpty && !isValidDate(year, month, day) || hasError;
1128
- const containerClasses = classNames(
1129
- "GeckoUIDateInput",
1130
- disabled && "GeckoUIDateInput--disabled",
1131
- readOnly && "GeckoUIDateInput--readOnly",
1132
- !disabled && !readOnly && "GeckoUIDateInput--enabled",
1133
- isError && "GeckoUIDateInput--error",
1134
- isEmpty && "GeckoUIDateInput--empty",
1135
- hasFocus && "GeckoUIDateInput--focus",
1136
- className
1137
- );
1138
- return /* @__PURE__ */ jsxs4("div", { ref: containerRef, className: containerClasses, onClick: () => handleDisplayClick(), children: [
1139
- Boolean(prefix) && /* @__PURE__ */ jsx8("div", { className: "GeckoUIDateInput__prefix", children: /* @__PURE__ */ jsx8(DynamicComponentRenderer_default, { component: prefix }) }),
1140
- !!isEmpty && !hasFocus && /* @__PURE__ */ jsx8("span", { className: classNames("GeckoUIDateInput__placeholder", placeholderClassName), children: placeholder != null ? placeholder : generatePlaceholder(format, separator) }),
1141
- /* @__PURE__ */ jsx8("div", { className: classNames("GeckoUIDateInput__display-container"), children: inputs.map(({ ref, value: value2, onChange: onChange2, maxLength, segment, display }, index) => /* @__PURE__ */ jsxs4(Fragment, { children: [
1142
- /* @__PURE__ */ jsxs4(
1143
- "label",
1144
- {
1145
- className: classNames(
1146
- "GeckoUIDateInput__segment",
1147
- !value2 && "GeckoUIDateInput__segment--empty"
1118
+ const state = disabled ? "disabled" : readOnly ? "readonly" : "enabled";
1119
+ return /* @__PURE__ */ jsxs4(
1120
+ "div",
1121
+ {
1122
+ ref: containerRef,
1123
+ className: classNames("GeckoUIDateInput", className),
1124
+ "data-state": state,
1125
+ "data-error": isError || void 0,
1126
+ "data-empty": isEmpty || void 0,
1127
+ "data-focus": hasFocus || void 0,
1128
+ onClick: () => handleDisplayClick(),
1129
+ children: [
1130
+ Boolean(prefix) && /* @__PURE__ */ jsx8("div", { className: "GeckoUIDateInput__prefix", children: /* @__PURE__ */ jsx8(DynamicComponentRenderer_default, { component: prefix }) }),
1131
+ !!isEmpty && !hasFocus && /* @__PURE__ */ jsx8("span", { className: classNames("GeckoUIDateInput__placeholder", placeholderClassName), children: placeholder != null ? placeholder : generatePlaceholder(format, separator) }),
1132
+ /* @__PURE__ */ jsx8("div", { className: classNames("GeckoUIDateInput__display-container"), children: inputs.map(({ ref, value: value2, onChange: onChange2, maxLength, segment, display }, index) => /* @__PURE__ */ jsxs4(Fragment, { children: [
1133
+ /* @__PURE__ */ jsxs4(
1134
+ "label",
1135
+ {
1136
+ className: "GeckoUIDateInput__segment",
1137
+ "data-empty": !value2 || void 0,
1138
+ tabIndex: -1,
1139
+ onClick: (e) => {
1140
+ e.stopPropagation();
1141
+ handleDisplayClick(segment);
1142
+ },
1143
+ children: [
1144
+ /* @__PURE__ */ jsx8(
1145
+ "input",
1146
+ {
1147
+ ref,
1148
+ type: "text",
1149
+ value: value2,
1150
+ readOnly,
1151
+ disabled,
1152
+ className: "GeckoUIDateInput__hidden-input",
1153
+ onChange: onChange2,
1154
+ onKeyDown: (e) => handleKeyDown(e, segment),
1155
+ maxLength,
1156
+ tabIndex: -1
1157
+ }
1158
+ ),
1159
+ display
1160
+ ]
1161
+ }
1148
1162
  ),
1149
- tabIndex: -1,
1150
- onClick: (e) => {
1151
- e.stopPropagation();
1152
- handleDisplayClick(segment);
1153
- },
1154
- children: [
1155
- /* @__PURE__ */ jsx8(
1156
- "input",
1157
- {
1158
- ref,
1159
- type: "text",
1160
- value: value2,
1161
- readOnly,
1162
- disabled,
1163
- className: "GeckoUIDateInput__hidden-input",
1164
- onChange: onChange2,
1165
- onKeyDown: (e) => handleKeyDown(e, segment),
1166
- maxLength,
1167
- tabIndex: -1
1168
- }
1169
- ),
1170
- display
1171
- ]
1172
- }
1173
- ),
1174
- index < inputs.length - 1 && /* @__PURE__ */ jsx8("span", { className: "GeckoUIDateInput__separator", children: separator })
1175
- ] }, segment)) }),
1176
- /* @__PURE__ */ jsxs4("div", { className: "GeckoUIDateInput__icons", children: [
1177
- !hideClearIcon && !isEmpty && !disabled && !readOnly && /* @__PURE__ */ jsx8(
1178
- "button",
1179
- {
1180
- type: "button",
1181
- disabled: disabled || readOnly,
1182
- className: "GeckoUIDateInput__clear-button",
1183
- onClick: handleClear,
1184
- children: /* @__PURE__ */ jsx8("div", { className: "GeckoUI-icon__clear" })
1185
- }
1186
- ),
1187
- Boolean(suffix) && /* @__PURE__ */ jsx8("div", { className: "GeckoUIDateInput__suffix", children: /* @__PURE__ */ jsx8(DynamicComponentRenderer_default, { component: suffix }) }),
1188
- renderCalendarIcon,
1189
- !renderCalendarIcon && !hideCalendarIcon && /* @__PURE__ */ jsx8("div", { className: "GeckoUIDateInput__calendar-icon" })
1190
- ] })
1191
- ] });
1163
+ index < inputs.length - 1 && /* @__PURE__ */ jsx8("span", { className: "GeckoUIDateInput__separator", children: separator })
1164
+ ] }, segment)) }),
1165
+ /* @__PURE__ */ jsxs4("div", { className: "GeckoUIDateInput__icons", children: [
1166
+ !hideClearIcon && !isEmpty && !disabled && !readOnly && /* @__PURE__ */ jsx8(
1167
+ "button",
1168
+ {
1169
+ type: "button",
1170
+ disabled: disabled || readOnly,
1171
+ className: "GeckoUIDateInput__clear-button",
1172
+ onClick: handleClear,
1173
+ children: /* @__PURE__ */ jsx8("div", { className: "GeckoUI-icon__clear" })
1174
+ }
1175
+ ),
1176
+ Boolean(suffix) && /* @__PURE__ */ jsx8("div", { className: "GeckoUIDateInput__suffix", children: /* @__PURE__ */ jsx8(DynamicComponentRenderer_default, { component: suffix }) }),
1177
+ renderCalendarIcon,
1178
+ !renderCalendarIcon && !hideCalendarIcon && /* @__PURE__ */ jsx8("div", { className: "GeckoUIDateInput__calendar-icon" })
1179
+ ] })
1180
+ ]
1181
+ }
1182
+ );
1192
1183
  };
1193
1184
  BaseDateInput.displayName = "BaseDateInput";
1194
1185
  var BaseDateInput_default = BaseDateInput;
@@ -1276,7 +1267,7 @@ function CalendarHeader({
1276
1267
  header,
1277
1268
  onClickHeader
1278
1269
  }) {
1279
- return /* @__PURE__ */ jsxs5("div", { className: classNames("GeckoUICalendar__header"), children: [
1270
+ return /* @__PURE__ */ jsxs5("div", { className: "GeckoUICalendar__header", children: [
1280
1271
  /* @__PURE__ */ jsx9(
1281
1272
  "button",
1282
1273
  {
@@ -1289,10 +1280,8 @@ function CalendarHeader({
1289
1280
  /* @__PURE__ */ jsx9(
1290
1281
  "button",
1291
1282
  {
1292
- className: classNames(
1293
- "GeckoUICalendar__header__title",
1294
- onClickHeader && "GeckoUICalendar__header__title--clickable"
1295
- ),
1283
+ className: "GeckoUICalendar__header__title",
1284
+ "data-clickable": onClickHeader ? "" : void 0,
1296
1285
  onClick: onClickHeader,
1297
1286
  type: "button",
1298
1287
  children: header
@@ -1395,19 +1384,17 @@ function CalendarDayPicker(props) {
1395
1384
  return /* @__PURE__ */ jsx10(
1396
1385
  "button",
1397
1386
  {
1398
- className: classNames(
1399
- "GeckoUICalendar__day-picker__button",
1400
- isToday && "GeckoUICalendar__day-picker__button--today",
1401
- isSelected && "GeckoUICalendar__day-picker__button--selected",
1402
- isRangeStart && "GeckoUICalendar__day-picker__button--range-start",
1403
- isRangeEnd && "GeckoUICalendar__day-picker__button--range-end",
1404
- isInRange && "GeckoUICalendar__day-picker__button--in-range",
1405
- isHoverPreview && "GeckoUICalendar__day-picker__button--hover-preview",
1406
- isHoverPreviewStart && "GeckoUICalendar__day-picker__button--hover-preview-start",
1407
- isHoverPreviewEnd && "GeckoUICalendar__day-picker__button--hover-preview-end",
1408
- isDisable && "GeckoUICalendar__day-picker__button--disabled",
1409
- `GeckoUICalendar__day-picker__button--active-month-${isActiveMonth}`
1410
- ),
1387
+ className: "GeckoUICalendar__day-picker__button",
1388
+ "data-today": isToday || void 0,
1389
+ "data-selected": isSelected || void 0,
1390
+ "data-range-start": isRangeStart || void 0,
1391
+ "data-range-end": isRangeEnd || void 0,
1392
+ "data-in-range": isInRange || void 0,
1393
+ "data-hover-preview": isHoverPreview || void 0,
1394
+ "data-hover-preview-start": isHoverPreviewStart || void 0,
1395
+ "data-hover-preview-end": isHoverPreviewEnd || void 0,
1396
+ "data-disabled": isDisable || void 0,
1397
+ "data-active-month": isActiveMonth || void 0,
1411
1398
  disabled: isDisable,
1412
1399
  onClick: () => handleDateClick(formattedDate),
1413
1400
  onMouseEnter: () => handleDateHover(formattedDate),
@@ -1447,10 +1434,8 @@ function CalendarMonthPicker(_a) {
1447
1434
  return /* @__PURE__ */ jsx11(
1448
1435
  "button",
1449
1436
  {
1450
- className: classNames(
1451
- "GeckoUICalendar__month-picker__button",
1452
- selected && "GeckoUICalendar__month-picker__button--selected"
1453
- ),
1437
+ className: "GeckoUICalendar__month-picker__button",
1438
+ "data-selected": selected || void 0,
1454
1439
  onClick: () => onSelectMonth == null ? void 0 : onSelectMonth(index),
1455
1440
  type: "button",
1456
1441
  children: monthName
@@ -1496,11 +1481,9 @@ function CalendarYearPicker(_a) {
1496
1481
  return /* @__PURE__ */ jsx12(
1497
1482
  "button",
1498
1483
  {
1499
- className: classNames(
1500
- "GeckoUICalendar__year-picker__button",
1501
- selected && "GeckoUICalendar__year-picker__button--selected",
1502
- isPrevNext && "GeckoUICalendar__year-picker__button--prev-next"
1503
- ),
1484
+ className: "GeckoUICalendar__year-picker__button",
1485
+ "data-selected": selected || void 0,
1486
+ "data-prev-next": isPrevNext || void 0,
1504
1487
  onClick: () => onSelectYear == null ? void 0 : onSelectYear(year),
1505
1488
  type: "button",
1506
1489
  children: year
@@ -1642,7 +1625,7 @@ Provided value: ${selectedRange.to}`
1642
1625
  const secondMonth = activeMonth === 11 ? 0 : activeMonth + 1;
1643
1626
  const secondYear = activeMonth === 11 ? activeYear + 1 : activeYear;
1644
1627
  return /* @__PURE__ */ jsxs9("div", { className: "GeckoUICalendar__dual", children: [
1645
- /* @__PURE__ */ jsx13("div", { className: "GeckoUICalendar__dual--first", children: /* @__PURE__ */ jsx13(
1628
+ /* @__PURE__ */ jsx13("div", { className: "GeckoUICalendar__dual__item", "data-position": "first", children: /* @__PURE__ */ jsx13(
1646
1629
  CalendarDayPicker_default,
1647
1630
  {
1648
1631
  mode: "range",
@@ -1659,7 +1642,7 @@ Provided value: ${selectedRange.to}`
1659
1642
  onHoverDate: handleHoverDate
1660
1643
  }
1661
1644
  ) }),
1662
- numberOfMonths === 2 && /* @__PURE__ */ jsx13("div", { className: "GeckoUICalendar__dual--second", children: /* @__PURE__ */ jsx13(
1645
+ numberOfMonths === 2 && /* @__PURE__ */ jsx13("div", { className: "GeckoUICalendar__dual__item", "data-position": "second", children: /* @__PURE__ */ jsx13(
1663
1646
  CalendarDayPicker_default,
1664
1647
  {
1665
1648
  mode: "range",
@@ -1712,13 +1695,10 @@ Provided value: ${selectedRange.to}`
1712
1695
  return /* @__PURE__ */ jsx13(
1713
1696
  "div",
1714
1697
  {
1715
- className: classNames(
1716
- `GeckoUICalendar`,
1717
- `GeckoUICalendar--mode-${view}`,
1718
- `GeckoUICalendar--selection-${mode}`,
1719
- mode === "range" && view === "day" /* Day */ && `GeckoUICalendar--calendars-${numberOfMonths}`,
1720
- className
1721
- ),
1698
+ className: classNames(`GeckoUICalendar`, className),
1699
+ "data-mode": view,
1700
+ "data-selection": mode,
1701
+ "data-calendars": mode === "range" && view === "day" /* Day */ && numberOfMonths || void 0,
1722
1702
  style,
1723
1703
  children: renderContent()
1724
1704
  }
@@ -1824,6 +1804,7 @@ var DateInput = (_a) => {
1824
1804
  "div",
1825
1805
  {
1826
1806
  className: classNames("GeckoUIDateInputWrapper", wrapperClassName),
1807
+ "data-calendar-open": openCalendar || void 0,
1827
1808
  ref: (r) => refs.setReference(r),
1828
1809
  children: [
1829
1810
  /* @__PURE__ */ jsx14(
@@ -1836,7 +1817,7 @@ var DateInput = (_a) => {
1836
1817
  prefix,
1837
1818
  suffix,
1838
1819
  hasError,
1839
- className: classNames(className, openCalendar && "GeckoUIDateInput--calendar-open"),
1820
+ className,
1840
1821
  format,
1841
1822
  separator,
1842
1823
  placeholder,
@@ -2236,25 +2217,13 @@ var BaseDateRangeInput = (_a) => {
2236
2217
  const startValid = isValidDate(startYear, startMonth, startDay);
2237
2218
  const endValid = isValidDate(endYear, endMonth, endDay);
2238
2219
  const isError = !isEmpty && (!startEmpty && !startValid || !endEmpty && !endValid) || hasError;
2239
- const containerClasses = classNames(
2240
- "GeckoUIDateInput",
2241
- "GeckoUIDateRangeInput",
2242
- disabled && "GeckoUIDateInput--disabled",
2243
- readOnly && "GeckoUIDateInput--readOnly",
2244
- !disabled && !readOnly && "GeckoUIDateInput--enabled",
2245
- isError && "GeckoUIDateInput--error",
2246
- isEmpty && "GeckoUIDateInput--empty",
2247
- hasFocus && "GeckoUIDateInput--focus",
2248
- className
2249
- );
2220
+ const state = disabled ? "disabled" : readOnly ? "readonly" : "enabled";
2250
2221
  const renderSegments = (segments) => /* @__PURE__ */ jsx15(Fragment6, { children: segments.map(({ ref, value: value2, onChange: onChange2, maxLength, segment, display }, index) => /* @__PURE__ */ jsxs11(Fragment5, { children: [
2251
2222
  /* @__PURE__ */ jsxs11(
2252
2223
  "label",
2253
2224
  {
2254
- className: classNames(
2255
- "GeckoUIDateInput__segment",
2256
- !value2 && "GeckoUIDateInput__segment--empty"
2257
- ),
2225
+ className: "GeckoUIDateInput__segment",
2226
+ "data-empty": !value2 || void 0,
2258
2227
  tabIndex: -1,
2259
2228
  onClick: (e) => {
2260
2229
  e.stopPropagation();
@@ -2290,7 +2259,11 @@ var BaseDateRangeInput = (_a) => {
2290
2259
  "div",
2291
2260
  __spreadProps(__spreadValues({
2292
2261
  ref: containerRef,
2293
- className: containerClasses
2262
+ className: classNames("GeckoUIDateInput", "GeckoUIDateRangeInput", className),
2263
+ "data-state": state,
2264
+ "data-error": isError || void 0,
2265
+ "data-empty": isEmpty || void 0,
2266
+ "data-focus": hasFocus || void 0
2294
2267
  }, rest), {
2295
2268
  onClick: () => handleDisplayClick(),
2296
2269
  children: [
@@ -2431,6 +2404,7 @@ var DateRangeInput = (_a) => {
2431
2404
  "div",
2432
2405
  {
2433
2406
  className: classNames("GeckoUIDateRangeInputWrapper", wrapperClassName),
2407
+ "data-calendar-open": openCalendar || void 0,
2434
2408
  ref: (r) => refs.setReference(r),
2435
2409
  children: [
2436
2410
  /* @__PURE__ */ jsx16(
@@ -2443,7 +2417,7 @@ var DateRangeInput = (_a) => {
2443
2417
  prefix,
2444
2418
  suffix,
2445
2419
  hasError,
2446
- className: classNames(className, openCalendar && "GeckoUIDateInput--calendar-open"),
2420
+ className,
2447
2421
  format,
2448
2422
  separator,
2449
2423
  rangeSeparator,
@@ -2486,12 +2460,9 @@ var Input = forwardRef3(
2486
2460
  "label",
2487
2461
  {
2488
2462
  "aria-disabled": disabled,
2489
- className: classNames(
2490
- "GeckoUIInput group",
2491
- disabled ? "GeckoUIInput--disabled" : "GeckoUIInput--enabled",
2492
- readOnly && "GeckoUIInput--readonly",
2493
- className
2494
- ),
2463
+ "data-state": disabled ? "disabled" : "enabled",
2464
+ "data-readonly": readOnly || void 0,
2465
+ className: classNames("GeckoUIInput group", className),
2495
2466
  htmlFor: id != null ? id : _id,
2496
2467
  children: [
2497
2468
  /* @__PURE__ */ jsx17(DynamicComponentRenderer_default, { component: prefix, inputRef: ref }),
@@ -2662,13 +2633,10 @@ var Button = forwardRef4(
2662
2633
  return /* @__PURE__ */ jsx21(
2663
2634
  "button",
2664
2635
  __spreadProps(__spreadValues({
2665
- className: classNames(
2666
- "GeckoUIButton",
2667
- `GeckoUIButton--${variant}`,
2668
- `GeckoUIButton--${variant}-${color}`,
2669
- `GeckoUIButton--size-${size}`,
2670
- className
2671
- ),
2636
+ "data-variant": variant,
2637
+ "data-color": color,
2638
+ "data-size": size,
2639
+ className: classNames("GeckoUIButton", className),
2672
2640
  ref,
2673
2641
  type: "button"
2674
2642
  }, rest), {
@@ -2741,14 +2709,8 @@ var LoadingButton = (_a) => {
2741
2709
  return /* @__PURE__ */ jsxs16(
2742
2710
  Button_default,
2743
2711
  __spreadProps(__spreadValues({
2744
- className: classNames(
2745
- "GeckoUILoadingButton",
2746
- `GeckoUILoadingButton--${variant}`,
2747
- `GeckoUILoadingButton--${variant}-${color}`,
2748
- `GeckoUILoadingButton--size-${size}`,
2749
- loading && `GeckoUILoadingButton--loading GeckoUILoadingButton--${variant}-loading`,
2750
- className
2751
- ),
2712
+ "data-loading": loading || void 0,
2713
+ className: classNames("GeckoUILoadingButton", className),
2752
2714
  disabled: loading || disabled,
2753
2715
  size,
2754
2716
  color,
@@ -2905,11 +2867,8 @@ var RHFCounterInput = (_a) => {
2905
2867
  return /* @__PURE__ */ jsx26(
2906
2868
  CounterInput_default,
2907
2869
  __spreadProps(__spreadValues({
2908
- className: classNames(
2909
- "GeckoUIRHFCounterInput",
2910
- hasError && "GeckoUIRHFCounterInput--error",
2911
- className
2912
- )
2870
+ className: classNames("GeckoUIRHFCounterInput", className),
2871
+ "data-error": hasError || void 0
2913
2872
  }, rest), {
2914
2873
  value: (_a2 = field.value) != null ? _a2 : 0,
2915
2874
  onChange: (value) => {
@@ -2966,11 +2925,8 @@ var RHFInput = (_a) => {
2966
2925
  return /* @__PURE__ */ jsx27(
2967
2926
  Input_default,
2968
2927
  __spreadProps(__spreadValues(__spreadValues({
2969
- className: classNames(
2970
- "GeckoUIRHFInput",
2971
- hasError && "GeckoUIRHFInput--error",
2972
- className
2973
- ),
2928
+ className: classNames("GeckoUIRHFInput", className),
2929
+ "data-error": hasError || void 0,
2974
2930
  prefix: prefix ? /* @__PURE__ */ jsx27(DynamicComponentRenderer_default, __spreadValues({ component: prefix }, renderProps)) : null,
2975
2931
  suffix: /* @__PURE__ */ jsx27(DynamicComponentRenderer_default, __spreadValues({ component: suffix }, renderProps))
2976
2932
  }, field), rest), {
@@ -3196,11 +3152,8 @@ var RHFTextarea = (_a) => {
3196
3152
  return /* @__PURE__ */ jsx33(
3197
3153
  Textarea_default,
3198
3154
  __spreadProps(__spreadValues(__spreadValues({
3199
- className: classNames(
3200
- "GeckoUIRHFTextarea",
3201
- !disabled && fieldState.error && "GeckoUIRHFTextarea--error",
3202
- className
3203
- )
3155
+ className: classNames("GeckoUIRHFTextarea", className),
3156
+ "data-error": !disabled && fieldState.error ? "" : void 0
3204
3157
  }, field), rest), {
3205
3158
  disabled,
3206
3159
  onBlur: (e) => {
@@ -3221,36 +3174,31 @@ RHFTextarea.displayName = "RHFTextarea";
3221
3174
  var RHFTextarea_default = RHFTextarea;
3222
3175
 
3223
3176
  // src/components/Switch/Switch.tsx
3224
- import { Switch as HeadlessSwitch } from "@headlessui/react";
3225
3177
  import { forwardRef as forwardRef6 } from "react";
3226
- import { jsx as jsx34 } from "react/jsx-runtime";
3178
+ import { jsx as jsx34, jsxs as jsxs19 } from "react/jsx-runtime";
3227
3179
  var Switch = forwardRef6(
3228
3180
  (_a, ref) => {
3229
- var _b = _a, { className, thumbClassName, size = "md" } = _b, rest = __objRest(_b, ["className", "thumbClassName", "size"]);
3230
- return /* @__PURE__ */ jsx34(
3231
- HeadlessSwitch,
3232
- __spreadProps(__spreadValues({
3233
- onKeyUp: (e) => {
3234
- if (e.key === "Enter") {
3235
- e.preventDefault();
3236
- return true;
3237
- }
3238
- },
3239
- className: classNames("group GeckoUISwitch", `GeckoUISwitch--size-${size}`, className)
3240
- }, rest), {
3241
- ref,
3242
- children: /* @__PURE__ */ jsx34(
3243
- "span",
3244
- {
3245
- className: classNames(
3246
- "GeckoUISwitch__thumb",
3247
- `GeckoUISwitch__thumb--size-${size}`,
3248
- thumbClassName
3249
- )
3181
+ var _b = _a, { size = "md", className, thumbClassName, onChange, onKeyDown } = _b, rest = __objRest(_b, ["size", "className", "thumbClassName", "onChange", "onKeyDown"]);
3182
+ return /* @__PURE__ */ jsxs19("label", { className: classNames("GeckoUISwitch", className), "data-size": size, children: [
3183
+ /* @__PURE__ */ jsx34(
3184
+ "input",
3185
+ __spreadValues({
3186
+ ref,
3187
+ type: "checkbox",
3188
+ role: "switch",
3189
+ className: "GeckoUISwitch__input",
3190
+ onChange: (e) => onChange == null ? void 0 : onChange(e.target.checked),
3191
+ onKeyDown: (e) => {
3192
+ if (e.key === "Enter") {
3193
+ e.preventDefault();
3194
+ e.currentTarget.click();
3195
+ }
3196
+ onKeyDown == null ? void 0 : onKeyDown(e);
3250
3197
  }
3251
- )
3252
- })
3253
- );
3198
+ }, rest)
3199
+ ),
3200
+ /* @__PURE__ */ jsx34("span", { className: classNames("GeckoUISwitch__thumb", thumbClassName), "data-size": size })
3201
+ ] });
3254
3202
  }
3255
3203
  );
3256
3204
  Switch.displayName = "Switch";
@@ -3307,7 +3255,7 @@ var RHFSwitch = (_a) => {
3307
3255
  __spreadProps(__spreadValues(__spreadValues({}, field), rest), {
3308
3256
  disabled,
3309
3257
  checked: isChecked,
3310
- className: classNames(`GeckoUIRHFSwitch GeckoUIRHFSwitch--size-${size}`, className),
3258
+ className: classNames("GeckoUIRHFSwitch", className),
3311
3259
  onBlur: (e) => {
3312
3260
  field.onBlur();
3313
3261
  onBlur == null ? void 0 : onBlur(e);
@@ -3319,10 +3267,7 @@ var RHFSwitch = (_a) => {
3319
3267
  },
3320
3268
  onChange: handleUpdate,
3321
3269
  size,
3322
- thumbClassName: classNames(
3323
- `GeckoUIRHFSwitch__thumb GeckoUIRHFSwitch__thumb--size-${size}`,
3324
- thumbClassName
3325
- ),
3270
+ thumbClassName: classNames("GeckoUIRHFSwitch__thumb", thumbClassName),
3326
3271
  value: void 0
3327
3272
  })
3328
3273
  );
@@ -3347,7 +3292,7 @@ Radio.displayName = "Radio";
3347
3292
  var Radio_default = Radio;
3348
3293
 
3349
3294
  // src/components/RHF/RHFRadio/RHFRadio.tsx
3350
- import { jsx as jsx37, jsxs as jsxs19 } from "react/jsx-runtime";
3295
+ import { jsx as jsx37, jsxs as jsxs20 } from "react/jsx-runtime";
3351
3296
  var RHFRadio = (_a) => {
3352
3297
  var _b = _a, {
3353
3298
  name,
@@ -3384,7 +3329,7 @@ var RHFRadio = (_a) => {
3384
3329
  name,
3385
3330
  rules,
3386
3331
  render: ({ field }) => {
3387
- return /* @__PURE__ */ jsxs19("label", { className: "GeckoUIRHFRadio group", htmlFor: uniqueId, children: [
3332
+ return /* @__PURE__ */ jsxs20("label", { className: "GeckoUIRHFRadio group", htmlFor: uniqueId, children: [
3388
3333
  /* @__PURE__ */ jsx37(
3389
3334
  Radio_default,
3390
3335
  __spreadProps(__spreadValues(__spreadValues({}, field), rest), {
@@ -3446,7 +3391,17 @@ var RHFDateInput_default = RHFDateInput;
3446
3391
  // src/components/RHF/RHFDateRangeInput/RHFDateRangeInput.tsx
3447
3392
  import { jsx as jsx39 } from "react/jsx-runtime";
3448
3393
  var RHFDateRangeInput = (_a) => {
3449
- var _b = _a, { name, control, rules, onChange } = _b, rest = __objRest(_b, ["name", "control", "rules", "onChange"]);
3394
+ var _b = _a, {
3395
+ name,
3396
+ control,
3397
+ rules,
3398
+ onChange
3399
+ } = _b, rest = __objRest(_b, [
3400
+ "name",
3401
+ "control",
3402
+ "rules",
3403
+ "onChange"
3404
+ ]);
3450
3405
  return /* @__PURE__ */ jsx39(
3451
3406
  RHFController_default,
3452
3407
  {
@@ -3476,7 +3431,7 @@ RHFDateRangeInput.displayName = "RHFDateRangeInput";
3476
3431
  var RHFDateRangeInput_default = RHFDateRangeInput;
3477
3432
 
3478
3433
  // src/components/RHF/RHFFileInput/RHFFileInput.tsx
3479
- import { jsx as jsx40, jsxs as jsxs20 } from "react/jsx-runtime";
3434
+ import { jsx as jsx40, jsxs as jsxs21 } from "react/jsx-runtime";
3480
3435
  var RHFFileInput = (_a) => {
3481
3436
  var _b = _a, {
3482
3437
  id,
@@ -3511,15 +3466,12 @@ var RHFFileInput = (_a) => {
3511
3466
  rules,
3512
3467
  render: (renderProps) => {
3513
3468
  const { field } = renderProps;
3514
- return /* @__PURE__ */ jsxs20("label", { className: classNames("GeckoUIRHFFileInput--wrapper", className), id, children: [
3469
+ return /* @__PURE__ */ jsxs21("label", { className: classNames("GeckoUIRHFFileInput", className), id, children: [
3515
3470
  /* @__PURE__ */ jsx40(
3516
3471
  "input",
3517
3472
  __spreadProps(__spreadValues(__spreadValues({}, field), rest), {
3518
- className: classNames(
3519
- "GeckoUIRHFFileInput",
3520
- Boolean(render) && "GeckoUIRHFFileInput--custom",
3521
- inputClassName
3522
- ),
3473
+ className: classNames("GeckoUIRHFFileInput__input", inputClassName),
3474
+ "data-custom": Boolean(render) || void 0,
3523
3475
  disabled,
3524
3476
  id,
3525
3477
  multiple,
@@ -3556,7 +3508,7 @@ var RHFFileInput_default = RHFFileInput;
3556
3508
 
3557
3509
  // src/components/OTPInput/OTPInput.tsx
3558
3510
  import { forwardRef as forwardRef8, useRef as useRef8 } from "react";
3559
- import { jsx as jsx41, jsxs as jsxs21 } from "react/jsx-runtime";
3511
+ import { jsx as jsx41, jsxs as jsxs22 } from "react/jsx-runtime";
3560
3512
  var OTPInput = forwardRef8(
3561
3513
  ({
3562
3514
  value = "",
@@ -3602,16 +3554,13 @@ var OTPInput = forwardRef8(
3602
3554
  return /* @__PURE__ */ jsx41(
3603
3555
  "div",
3604
3556
  {
3605
- className: classNames(
3606
- "GeckoUIOTPInput",
3607
- disabled ? "GeckoUIOTPInput--disabled" : "GeckoUIOTPInput--enabled",
3608
- className
3609
- ),
3557
+ className: classNames("GeckoUIOTPInput", className),
3558
+ "data-state": disabled ? "disabled" : "enabled",
3610
3559
  ref: divRef,
3611
3560
  style: { gridTemplateColumns: `repeat(${length}, minmax(0, 1fr))` },
3612
3561
  children: Array.from({ length }).map((_, i) => i).map((key, index) => {
3613
3562
  const isLast = index === length - 1;
3614
- return /* @__PURE__ */ jsxs21(
3563
+ return /* @__PURE__ */ jsxs22(
3615
3564
  "div",
3616
3565
  {
3617
3566
  style: {
@@ -3682,7 +3631,19 @@ var OTPInput_default = OTPInput;
3682
3631
  // src/components/RHF/RHFOTPInput/RHFOTPInput.tsx
3683
3632
  import { jsx as jsx42 } from "react/jsx-runtime";
3684
3633
  var RHFOTPInput = (_a) => {
3685
- var _b = _a, { control, name, rules, disabled, className } = _b, rest = __objRest(_b, ["control", "name", "rules", "disabled", "className"]);
3634
+ var _b = _a, {
3635
+ control,
3636
+ name,
3637
+ rules,
3638
+ disabled,
3639
+ className
3640
+ } = _b, rest = __objRest(_b, [
3641
+ "control",
3642
+ "name",
3643
+ "rules",
3644
+ "disabled",
3645
+ "className"
3646
+ ]);
3686
3647
  return /* @__PURE__ */ jsx42(
3687
3648
  RHFController_default,
3688
3649
  {
@@ -3694,11 +3655,8 @@ var RHFOTPInput = (_a) => {
3694
3655
  return /* @__PURE__ */ jsx42(
3695
3656
  OTPInput_default,
3696
3657
  __spreadValues(__spreadValues({
3697
- className: classNames(
3698
- "GeckoUIRHFOTPInput",
3699
- !disabled && fieldState.error && "GeckoUIRHFOTPInput--error",
3700
- className
3701
- ),
3658
+ className: classNames("GeckoUIRHFOTPInput", className),
3659
+ "data-error": !disabled && fieldState.error ? "" : void 0,
3702
3660
  disabled
3703
3661
  }, rest), field)
3704
3662
  );
@@ -3710,7 +3668,7 @@ RHFOTPInput.displayName = "RHFOTPInput";
3710
3668
  var RHFOTPInput_default = RHFOTPInput;
3711
3669
 
3712
3670
  // src/components/RHF/RHFFilePicker/RHFFilePicker.tsx
3713
- import { jsx as jsx43, jsxs as jsxs22 } from "react/jsx-runtime";
3671
+ import { jsx as jsx43, jsxs as jsxs23 } from "react/jsx-runtime";
3714
3672
  function formatFileSize(bytes) {
3715
3673
  if (bytes === 0) return "0 B";
3716
3674
  const k = 1024;
@@ -3767,17 +3725,15 @@ function RHFFilePickerRenderer({
3767
3725
  const updatedFiles = value.filter((file) => file.preview !== fileToRemove.preview);
3768
3726
  field.onChange(updatedFiles);
3769
3727
  };
3770
- return /* @__PURE__ */ jsxs22(
3728
+ return /* @__PURE__ */ jsxs23(
3771
3729
  "div",
3772
3730
  {
3773
- className: classNames(
3774
- "GeckoUIRHFFilePicker",
3775
- loading && "GeckoUIRHFFilePicker--loading",
3776
- dragging && "GeckoUIRHFFilePicker--dragging",
3777
- error && "GeckoUIRHFFilePicker--error"
3778
- ),
3731
+ className: "GeckoUIRHFFilePicker",
3732
+ "data-loading": loading || void 0,
3733
+ "data-dragging": dragging || void 0,
3734
+ "data-error": error ? "" : void 0,
3779
3735
  children: [
3780
- /* @__PURE__ */ jsxs22(
3736
+ /* @__PURE__ */ jsxs23(
3781
3737
  "div",
3782
3738
  {
3783
3739
  className: "GeckoUIRHFFilePicker__upload-area",
@@ -3785,7 +3741,7 @@ function RHFFilePickerRenderer({
3785
3741
  children: [
3786
3742
  /* @__PURE__ */ jsx43(Upload_default, { className: "GeckoUIRHFFilePicker__upload-icon" }),
3787
3743
  /* @__PURE__ */ jsx43("p", { className: "GeckoUIRHFFilePicker__upload-text", children: "Drag and drop files here, or browse" }),
3788
- /* @__PURE__ */ jsxs22("div", { className: "GeckoUIRHFFilePicker__upload-buttons", children: [
3744
+ /* @__PURE__ */ jsxs23("div", { className: "GeckoUIRHFFilePicker__upload-buttons", children: [
3789
3745
  /* @__PURE__ */ jsx43(
3790
3746
  "button",
3791
3747
  {
@@ -3809,7 +3765,7 @@ function RHFFilePickerRenderer({
3809
3765
  ]
3810
3766
  }
3811
3767
  ),
3812
- Boolean(value == null ? void 0 : value.length) && /* @__PURE__ */ jsx43("div", { className: "GeckoUIRHFFilePicker__file-list", children: value.map((file) => /* @__PURE__ */ jsxs22("div", { className: "GeckoUIRHFFilePicker__file-row", children: [
3768
+ Boolean(value == null ? void 0 : value.length) && /* @__PURE__ */ jsx43("div", { className: "GeckoUIRHFFilePicker__file-list", children: value.map((file) => /* @__PURE__ */ jsxs23("div", { className: "GeckoUIRHFFilePicker__file-row", children: [
3813
3769
  /* @__PURE__ */ jsx43("span", { className: "GeckoUIRHFFilePicker__file-name", children: file.name }),
3814
3770
  /* @__PURE__ */ jsx43("span", { className: "GeckoUIRHFFilePicker__file-size", children: formatFileSize(file.size) }),
3815
3771
  /* @__PURE__ */ jsx43(
@@ -4058,7 +4014,7 @@ var sortMultiSelectValue = (value, options) => {
4058
4014
  };
4059
4015
 
4060
4016
  // src/components/Select/SelectButton/SelectButton.tsx
4061
- import { jsx as jsx44, jsxs as jsxs23 } from "react/jsx-runtime";
4017
+ import { jsx as jsx44, jsxs as jsxs24 } from "react/jsx-runtime";
4062
4018
  function SelectButton({ prefix, suffix, className }) {
4063
4019
  const {
4064
4020
  disabled,
@@ -4094,16 +4050,12 @@ function SelectButton({ prefix, suffix, className }) {
4094
4050
  return trigger;
4095
4051
  }
4096
4052
  const filterable = _filterable === true || _filterable === "inline";
4097
- return /* @__PURE__ */ jsxs23(
4053
+ return /* @__PURE__ */ jsxs24(
4098
4054
  "div",
4099
- {
4100
- className: classNames(
4101
- "GeckoUISelectButton",
4102
- disabled ? "GeckoUISelectButton--disabled" : "GeckoUISelectButton--enabled",
4103
- multiple && hasValue && "GeckoUISelectButton--multi-select-default",
4104
- !filterable && "GeckoUISelectButton--readonly",
4105
- className
4106
- ),
4055
+ __spreadProps(__spreadValues({
4056
+ className: classNames("GeckoUISelectButton", className),
4057
+ "data-state": disabled ? "disabled" : "enabled"
4058
+ }, !filterable && { "data-readonly": "" }), {
4107
4059
  onClick: () => {
4108
4060
  var _a;
4109
4061
  if (open && !keyword) {
@@ -4116,43 +4068,33 @@ function SelectButton({ prefix, suffix, className }) {
4116
4068
  "aria-disabled": disabled,
4117
4069
  children: [
4118
4070
  /* @__PURE__ */ jsx44(DynamicComponentRenderer_default, { component: prefix }),
4119
- /* @__PURE__ */ jsxs23("div", { className: "GeckoUISelectButton__content", children: [
4071
+ /* @__PURE__ */ jsxs24("div", { className: "GeckoUISelectButton__content", children: [
4120
4072
  hasValue ? /* @__PURE__ */ jsx44(SelectButtonContent, {}) : /* @__PURE__ */ jsx44(
4121
4073
  "span",
4122
- {
4123
- className: classNames(
4124
- "GeckoUISelectButton__value GeckoUISelectButton__value--placeholder",
4125
- placeholderClassName,
4126
- keyword && filterable && "GeckoUISelectButton__value--hidden"
4127
- ),
4074
+ __spreadProps(__spreadValues({
4075
+ className: classNames("GeckoUISelectButton__value", placeholderClassName),
4076
+ "data-placeholder": ""
4077
+ }, keyword && filterable && { "data-hidden": "" }), {
4128
4078
  children: placeholder != null ? placeholder : "Select Item"
4129
- }
4079
+ })
4130
4080
  ),
4131
4081
  /* @__PURE__ */ jsx44(
4132
4082
  "div",
4133
- {
4134
- className: classNames(
4135
- "GeckoUISelectButton__search",
4136
- !open && hasValue && "GeckoUISelectButton__search--focusonly",
4137
- !filterable && "GeckoUISelectButton__search--focusonly",
4138
- multiple && Array.isArray(value) && !!(value == null ? void 0 : value.length) && "GeckoUISelectButton__search--multi-selected"
4139
- ),
4083
+ __spreadProps(__spreadValues(__spreadValues({
4084
+ className: "GeckoUISelectButton__search"
4085
+ }, (!open && hasValue || !filterable) && { "data-focusonly": "" }), multiple && Array.isArray(value) && !!(value == null ? void 0 : value.length) && { "data-multi-selected": "" }), {
4140
4086
  "data-keyword": filterable ? keyword : "",
4141
4087
  children: /* @__PURE__ */ jsx44(
4142
4088
  "input",
4143
- {
4089
+ __spreadProps(__spreadValues(__spreadValues({
4144
4090
  id,
4145
4091
  ref: (r) => {
4146
4092
  setInputRef(r);
4147
4093
  },
4148
4094
  value: filterable ? keyword : "",
4149
4095
  disabled,
4150
- className: classNames(
4151
- "GeckoUISelectButton__search__input",
4152
- open && !hasValue && "GeckoUISelectButton__search__input--initial",
4153
- !multiple && hasValue && "GeckoUISelectButton__search__input--initial",
4154
- !filterable && "GeckoUISelectButton__search__input--readonly"
4155
- ),
4096
+ className: "GeckoUISelectButton__search__input"
4097
+ }, (open && !hasValue || !multiple && hasValue) && { "data-initial": "" }), !filterable && { "data-readonly": "" }), {
4156
4098
  onKeyDown: handleKeyboardInteraction,
4157
4099
  onFocusCapture: openMenu,
4158
4100
  onChange: filterable ? handleInputChange : (
@@ -4163,13 +4105,22 @@ function SelectButton({ prefix, suffix, className }) {
4163
4105
  autoCapitalize: "off",
4164
4106
  autoCorrect: "off",
4165
4107
  spellCheck: false
4166
- }
4108
+ })
4167
4109
  )
4168
- }
4110
+ })
4169
4111
  )
4170
4112
  ] }),
4171
- /* @__PURE__ */ jsxs23("div", { className: "GeckoUISelectButton__icons", children: [
4172
- hasValue && !disabled && clearable && /* @__PURE__ */ jsx44("button", { className: "GeckoUISelectButton__clear-button", type: "button", onClick: handleClear, children: /* @__PURE__ */ jsx44("div", { className: "GeckoUI-icon__clear" }) }),
4113
+ /* @__PURE__ */ jsxs24("div", { className: "GeckoUISelectButton__icons", children: [
4114
+ hasValue && !disabled && clearable && /* @__PURE__ */ jsx44(
4115
+ "button",
4116
+ {
4117
+ className: "GeckoUISelectButton__clear-button",
4118
+ type: "button",
4119
+ onClick: handleClear,
4120
+ "data-disabled": disabled || void 0,
4121
+ children: /* @__PURE__ */ jsx44("div", { className: "GeckoUI-icon__clear" })
4122
+ }
4123
+ ),
4173
4124
  /* @__PURE__ */ jsx44(
4174
4125
  DynamicComponentRenderer_default,
4175
4126
  {
@@ -4178,7 +4129,7 @@ function SelectButton({ prefix, suffix, className }) {
4178
4129
  )
4179
4130
  ] })
4180
4131
  ]
4181
- }
4132
+ })
4182
4133
  );
4183
4134
  }
4184
4135
  function SelectButtonContent() {
@@ -4217,13 +4168,11 @@ function SelectButtonContent() {
4217
4168
  });
4218
4169
  return selectedOptions.map((option) => {
4219
4170
  const { remove, value: value2, label } = option;
4220
- return /* @__PURE__ */ jsxs23(
4171
+ return /* @__PURE__ */ jsxs24(
4221
4172
  "div",
4222
4173
  {
4223
- className: classNames(
4224
- "GeckoUISelectButton__multiselected-chip",
4225
- disabled && "GeckoUISelectButton__multiselected-chip--disabled"
4226
- ),
4174
+ className: "GeckoUISelectButton__multiselected-chip",
4175
+ "data-disabled": disabled || void 0,
4227
4176
  children: [
4228
4177
  /* @__PURE__ */ jsx44("span", { children: option.label }),
4229
4178
  !disabled && /* @__PURE__ */ jsx44(
@@ -4235,18 +4184,9 @@ function SelectButtonContent() {
4235
4184
  remove();
4236
4185
  },
4237
4186
  disabled,
4238
- className: classNames(
4239
- "GeckoUISelectButton__multiselected-chip__clear-button",
4240
- disabled && "GeckoUISelectButton__multiselected-chip__clear-button--disabled"
4241
- ),
4242
- children: /* @__PURE__ */ jsx44(
4243
- "span",
4244
- {
4245
- className: classNames(
4246
- "GeckoUISelectButton__multiselected-chip__clear-button__icon"
4247
- )
4248
- }
4249
- )
4187
+ className: "GeckoUISelectButton__multiselected-chip__clear-button",
4188
+ "data-disabled": disabled || void 0,
4189
+ children: /* @__PURE__ */ jsx44("span", { className: "GeckoUISelectButton__multiselected-chip__clear-button__icon" })
4250
4190
  }
4251
4191
  )
4252
4192
  ]
@@ -4260,9 +4200,9 @@ function SelectButtonContent() {
4260
4200
  }
4261
4201
  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;
4262
4202
  if (open && selectedOptionLabel && filterable) {
4263
- return /* @__PURE__ */ jsx44("span", { className: "GeckoUISelectButton__value GeckoUISelectButton__value--placeholder", children: selectedOptionLabel });
4203
+ return /* @__PURE__ */ jsx44("span", { className: "GeckoUISelectButton__value", "data-placeholder": "", children: selectedOptionLabel });
4264
4204
  }
4265
- return /* @__PURE__ */ jsx44("span", { className: "GeckoUISelectButton__value GeckoUISelectButton__value--selected", children: selectedOptionLabel });
4205
+ return /* @__PURE__ */ jsx44("span", { className: "GeckoUISelectButton__value", "data-selected": "", children: selectedOptionLabel });
4266
4206
  }
4267
4207
  SelectButton.displayName = "SelectButton";
4268
4208
  var SelectButton_default = SelectButton;
@@ -4368,7 +4308,7 @@ SelectEmpty.displayName = "SelectEmpty";
4368
4308
  var SelectEmpty_default = SelectEmpty;
4369
4309
 
4370
4310
  // src/components/Select/SelectMenu/SelectMenu.tsx
4371
- import { jsx as jsx47, jsxs as jsxs24 } from "react/jsx-runtime";
4311
+ import { jsx as jsx47, jsxs as jsxs25 } from "react/jsx-runtime";
4372
4312
  var SelectMenu = (_a) => {
4373
4313
  var _b = _a, { children, className } = _b, rest = __objRest(_b, ["children", "className"]);
4374
4314
  const {
@@ -4386,20 +4326,17 @@ var SelectMenu = (_a) => {
4386
4326
  return null;
4387
4327
  }
4388
4328
  const hasDropdownSearch = filterable === "dropdown";
4389
- return /* @__PURE__ */ jsxs24(
4329
+ return /* @__PURE__ */ jsxs25(
4390
4330
  "div",
4391
4331
  __spreadProps(__spreadValues({
4392
4332
  ref: (r) => refs.setFloating(r),
4393
4333
  style: floatingStyles,
4394
- className: classNames(
4395
- "GeckoUISelectMenu",
4396
- hasDropdownSearch && "GeckoUISelectMenu--with-dropdown-search",
4397
- className
4398
- )
4334
+ className: classNames("GeckoUISelectMenu", className),
4335
+ "data-with-search": hasDropdownSearch || void 0
4399
4336
  }, rest), {
4400
4337
  children: [
4401
4338
  hasDropdownSearch && /* @__PURE__ */ jsx47(SelectDropdownSearch_default, { className: "GeckoUISelectMenu__search-container", autoFocus: true }),
4402
- /* @__PURE__ */ jsxs24("div", { ref: menuScrollContainerRef, className: "GeckoUISelectMenu__items", children: [
4339
+ /* @__PURE__ */ jsxs25("div", { ref: menuScrollContainerRef, className: "GeckoUISelectMenu__items", children: [
4403
4340
  menuItems,
4404
4341
  /* @__PURE__ */ jsx47(Empty, { children: menuItems })
4405
4342
  ] })
@@ -4418,7 +4355,7 @@ SelectMenu.displayName = "SelectMenu";
4418
4355
  var SelectMenu_default = SelectMenu;
4419
4356
 
4420
4357
  // src/components/Select/Select/Select.tsx
4421
- import { jsx as jsx48, jsxs as jsxs25 } from "react/jsx-runtime";
4358
+ import { jsx as jsx48, jsxs as jsxs26 } from "react/jsx-runtime";
4422
4359
  var Select = (props) => {
4423
4360
  const inputRef = useRef9(null);
4424
4361
  const menuScrollContainerRef = useRef9(null);
@@ -4542,7 +4479,7 @@ var Select = (props) => {
4542
4479
  onChange,
4543
4480
  clearable
4544
4481
  }, rest),
4545
- children: /* @__PURE__ */ jsxs25(
4482
+ children: /* @__PURE__ */ jsxs26(
4546
4483
  "div",
4547
4484
  {
4548
4485
  className: classNames("GeckoUISelect", wrapperClassName),
@@ -4561,7 +4498,7 @@ var Select_default = Select;
4561
4498
 
4562
4499
  // src/components/Select/SelectOption/SelectOption.tsx
4563
4500
  import { useEffect as useEffect8, useRef as useRef10 } from "react";
4564
- import { jsx as jsx49, jsxs as jsxs26 } from "react/jsx-runtime";
4501
+ import { jsx as jsx49, jsxs as jsxs27 } from "react/jsx-runtime";
4565
4502
  var SelectOption = (_a) => {
4566
4503
  var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
4567
4504
  const _a2 = props, {
@@ -4666,18 +4603,18 @@ var SelectOption = (_a) => {
4666
4603
  }
4667
4604
  return children;
4668
4605
  };
4669
- return /* @__PURE__ */ jsxs26(
4606
+ return /* @__PURE__ */ jsxs27(
4670
4607
  "div",
4671
4608
  __spreadProps(__spreadValues({
4672
4609
  tabIndex: -1,
4673
4610
  ref,
4674
4611
  className: classNames(
4675
4612
  "GeckoUISelectOption",
4676
- `GeckoUISelectOption--${selected ? "selected" : "unselected"}`,
4677
- focused && "GeckoUISelectOption--focused",
4678
- disabled && "GeckoUISelectOption--disabled",
4679
4613
  typeof className === "function" ? className({ value, selected, focused }) : className
4680
- )
4614
+ ),
4615
+ "data-state": selected ? "selected" : "unselected",
4616
+ "data-focused": focused || void 0,
4617
+ "data-disabled": disabled || void 0
4681
4618
  }, rest), {
4682
4619
  onMouseMove: () => {
4683
4620
  if ((focusedOption == null ? void 0 : focusedOption.value) !== value) {
@@ -4759,11 +4696,8 @@ var RHFSelect = (_a) => {
4759
4696
  inputRef: ref,
4760
4697
  wrapperClassName: classNames("GeckoUIRHFSelect", wrapperClassName)
4761
4698
  }, rest), {
4762
- className: classNames(
4763
- "GeckoUIRHFSelectButton",
4764
- !!error && "GeckoUIRHFSelectButton--error",
4765
- className
4766
- ),
4699
+ className: classNames("GeckoUIRHFSelectButton", className),
4700
+ "data-error": !!error || void 0,
4767
4701
  value,
4768
4702
  onChange: (v) => {
4769
4703
  var _a2;
@@ -4780,7 +4714,7 @@ RHFSelect.displayName = "RHFSelect";
4780
4714
  var RHFSelect_default = RHFSelect;
4781
4715
 
4782
4716
  // src/components/Alert/Alert.tsx
4783
- import { jsx as jsx51, jsxs as jsxs27 } from "react/jsx-runtime";
4717
+ import { jsx as jsx51, jsxs as jsxs28 } from "react/jsx-runtime";
4784
4718
  var Alert = (props) => {
4785
4719
  const {
4786
4720
  variant = "default",
@@ -4792,39 +4726,27 @@ var Alert = (props) => {
4792
4726
  icon,
4793
4727
  iconClassName
4794
4728
  } = props;
4795
- return /* @__PURE__ */ jsxs27(
4729
+ return /* @__PURE__ */ jsxs28(
4796
4730
  "div",
4797
- {
4798
- className: classNames(
4799
- "GeckoUIAlert",
4800
- `GeckoUIAlert--${variant}`,
4801
- condensed && "GeckoUIAlert--condensed",
4802
- className
4803
- ),
4731
+ __spreadProps(__spreadValues({
4732
+ className: classNames("GeckoUIAlert", className),
4733
+ "data-variant": variant
4734
+ }, condensed ? { "data-condensed": "" } : {}), {
4804
4735
  children: [
4805
- /* @__PURE__ */ jsxs27("div", { className: "GeckoUIAlert__body", children: [
4806
- icon ? /* @__PURE__ */ jsx51(DynamicComponentRenderer_default, { component: icon }) : /* @__PURE__ */ jsx51(
4807
- "div",
4808
- {
4809
- className: classNames(
4810
- "GeckoUIAlert__icon",
4811
- `GeckoUIAlert__icon--${variant}`,
4812
- iconClassName
4813
- )
4814
- }
4815
- ),
4736
+ /* @__PURE__ */ jsxs28("div", { className: "GeckoUIAlert__body", children: [
4737
+ icon ? /* @__PURE__ */ jsx51(DynamicComponentRenderer_default, { component: icon }) : /* @__PURE__ */ jsx51("div", { className: classNames("GeckoUIAlert__icon", iconClassName), "data-variant": variant }),
4816
4738
  /* @__PURE__ */ jsx51(DynamicComponentRenderer_default, { component: title, className: "GeckoUIAlert__title" }),
4817
4739
  Boolean(onRemove) && /* @__PURE__ */ jsx51("button", { className: "GeckoUIAlert__remove-button", onClick: onRemove, type: "button", children: /* @__PURE__ */ jsx51("span", { className: "GeckoUIAlert__remove-button__icon" }) })
4818
4740
  ] }),
4819
4741
  description ? /* @__PURE__ */ jsx51("div", { className: "GeckoUIAlert__description", children: /* @__PURE__ */ jsx51(DynamicComponentRenderer_default, { component: description }) }) : null
4820
4742
  ]
4821
- }
4743
+ })
4822
4744
  );
4823
4745
  };
4824
4746
  var Alert_default = Alert;
4825
4747
 
4826
4748
  // src/components/Pagination/Pagination.tsx
4827
- import { jsx as jsx52, jsxs as jsxs28 } from "react/jsx-runtime";
4749
+ import { jsx as jsx52, jsxs as jsxs29 } from "react/jsx-runtime";
4828
4750
  var Pagination = ({ currentPage, totalPages, onChange, className }) => {
4829
4751
  if (totalPages <= 1) return null;
4830
4752
  const getPages = () => {
@@ -4858,7 +4780,7 @@ var Pagination = ({ currentPage, totalPages, onChange, className }) => {
4858
4780
  return pages2;
4859
4781
  };
4860
4782
  const pages = getPages();
4861
- return /* @__PURE__ */ jsxs28("div", { className: classNames("GeckoUIPagination", className), children: [
4783
+ return /* @__PURE__ */ jsxs29("div", { className: classNames("GeckoUIPagination", className), children: [
4862
4784
  /* @__PURE__ */ jsx52(
4863
4785
  "button",
4864
4786
  {
@@ -4868,10 +4790,10 @@ var Pagination = ({ currentPage, totalPages, onChange, className }) => {
4868
4790
  onChange(currentPage - 1);
4869
4791
  },
4870
4792
  type: "button",
4871
- children: /* @__PURE__ */ jsx52("span", { className: "GeckoUIPagination__arrow__icon GeckoUIPagination__arrow__icon--previous" })
4793
+ children: /* @__PURE__ */ jsx52("span", { className: "GeckoUIPagination__arrow__icon", "data-direction": "previous" })
4872
4794
  }
4873
4795
  ),
4874
- /* @__PURE__ */ jsxs28("div", { className: "GeckoUIPagination__page-count", children: [
4796
+ /* @__PURE__ */ jsxs29("div", { className: "GeckoUIPagination__page-count", children: [
4875
4797
  /* @__PURE__ */ jsx52("span", { children: currentPage }),
4876
4798
  /* @__PURE__ */ jsx52("span", { children: "/" }),
4877
4799
  /* @__PURE__ */ jsx52("span", { children: totalPages })
@@ -4879,11 +4801,9 @@ var Pagination = ({ currentPage, totalPages, onChange, className }) => {
4879
4801
  /* @__PURE__ */ jsx52("div", { className: "GeckoUIPagination__page-buttons", children: pages.map((page, index) => /* @__PURE__ */ jsx52(
4880
4802
  "button",
4881
4803
  {
4882
- className: classNames(
4883
- "GeckoUIPagination__page-button",
4884
- page === currentPage && "GeckoUIPagination__page-button--active",
4885
- page === "..." && "GeckoUIPagination__page-button--ellipsis"
4886
- ),
4804
+ className: "GeckoUIPagination__page-button",
4805
+ "data-active": page === currentPage || void 0,
4806
+ "data-ellipsis": page === "..." || void 0,
4887
4807
  disabled: page === "...",
4888
4808
  onClick: () => page !== "..." && onChange(Number(page)),
4889
4809
  type: "button",
@@ -4900,7 +4820,7 @@ var Pagination = ({ currentPage, totalPages, onChange, className }) => {
4900
4820
  onChange(currentPage + 1);
4901
4821
  },
4902
4822
  type: "button",
4903
- children: /* @__PURE__ */ jsx52("span", { className: "GeckoUIPagination__arrow__icon GeckoUIPagination__arrow__icon--next" })
4823
+ children: /* @__PURE__ */ jsx52("span", { className: "GeckoUIPagination__arrow__icon", "data-direction": "next" })
4904
4824
  }
4905
4825
  )
4906
4826
  ] });
@@ -4993,7 +4913,7 @@ var Dialog = { show, dismiss };
4993
4913
  var Dialog_default = Dialog;
4994
4914
 
4995
4915
  // src/components/ConfirmDialog/ConfirmDialog.tsx
4996
- import { Fragment as Fragment10, jsx as jsx55, jsxs as jsxs29 } from "react/jsx-runtime";
4916
+ import { Fragment as Fragment10, jsx as jsx55, jsxs as jsxs30 } from "react/jsx-runtime";
4997
4917
  function ConfirmDialogContent({
4998
4918
  confirmButtonLabel = "Ok",
4999
4919
  cancelButtonLabel = "Cancel",
@@ -5043,10 +4963,10 @@ function ConfirmDialogContent({
5043
4963
  return document.removeEventListener("keydown", onKeyDown);
5044
4964
  };
5045
4965
  }, [handleConfirm]);
5046
- return /* @__PURE__ */ jsxs29(Fragment10, { children: [
4966
+ return /* @__PURE__ */ jsxs30(Fragment10, { children: [
5047
4967
  /* @__PURE__ */ jsx55("div", { className: classNames("GeckoUIConfirmDialog__title", titleClassName), children: /* @__PURE__ */ jsx55(DynamicComponentRenderer_default, { component: title }) }),
5048
4968
  /* @__PURE__ */ jsx55("div", { className: classNames("GeckoUIConfirmDialog__content", contentClassName), children: /* @__PURE__ */ jsx55(DynamicComponentRenderer_default, { component: content, dismiss: dismiss2 }) }),
5049
- /* @__PURE__ */ jsxs29("div", { className: "GeckoUIConfirmDialog__actions", children: [
4969
+ /* @__PURE__ */ jsxs30("div", { className: "GeckoUIConfirmDialog__actions", children: [
5050
4970
  /* @__PURE__ */ jsx55(
5051
4971
  LoadingButton_default,
5052
4972
  {
@@ -5099,18 +5019,18 @@ function DrawerContainer() {
5099
5019
  }
5100
5020
 
5101
5021
  // src/components/GeckoUIPortal/GeckoUIPortal.tsx
5102
- import { Fragment as Fragment11, jsx as jsx57, jsxs as jsxs30 } from "react/jsx-runtime";
5022
+ import { Fragment as Fragment11, jsx as jsx57, jsxs as jsxs31 } from "react/jsx-runtime";
5103
5023
  var GeckoUIPortal = ({ toastOptions = {} }) => {
5104
5024
  const _a = toastOptions, { style } = _a, restToastOptions = __objRest(_a, ["style"]);
5105
- return /* @__PURE__ */ jsxs30(Fragment11, { children: [
5025
+ return /* @__PURE__ */ jsxs31(Fragment11, { children: [
5106
5026
  /* @__PURE__ */ jsx57(
5107
5027
  Toaster,
5108
5028
  __spreadValues({
5109
5029
  position: "bottom-right",
5110
5030
  style: __spreadValues({
5111
- "--normal-bg": "rgb(var(--gecko-ui-surface-primary))",
5112
- "--normal-text": "rgb(var(--gecko-ui-text-primary))",
5113
- "--normal-border": "rgb(var(--gecko-ui-border-primary))"
5031
+ "--normal-bg": "var(--color-surface-primary)",
5032
+ "--normal-text": "var(--color-text-primary)",
5033
+ "--normal-border": "var(--color-border-primary)"
5114
5034
  }, style)
5115
5035
  }, restToastOptions)
5116
5036
  ),
@@ -5123,23 +5043,7 @@ var GeckoUIPortal_default = GeckoUIPortal;
5123
5043
  // src/components/Drawer/Drawer.tsx
5124
5044
  import { useRef as useRef12 } from "react";
5125
5045
  import { createRoot as createRoot2 } from "react-dom/client";
5126
- import { jsx as jsx58, jsxs as jsxs31 } from "react/jsx-runtime";
5127
- function getDrawerClasses(placement, open, className) {
5128
- const baseClass = "GeckoUIDrawer__drawer";
5129
- const placementClass = `${baseClass}--${placement}`;
5130
- const stateClass = open ? `${baseClass}--open` : `${baseClass}--closed`;
5131
- let compoundClass = "";
5132
- if (open) {
5133
- if (placement === "right" || placement === "left") {
5134
- compoundClass = `${baseClass}--right-open ${baseClass}--left-open`;
5135
- } else if (placement === "top" || placement === "bottom") {
5136
- compoundClass = `${baseClass}--top-open ${baseClass}--bottom-open`;
5137
- }
5138
- } else {
5139
- compoundClass = `${baseClass}--${placement}-closed`;
5140
- }
5141
- return classNames(baseClass, placementClass, stateClass, compoundClass, className);
5142
- }
5046
+ import { jsx as jsx58, jsxs as jsxs32 } from "react/jsx-runtime";
5143
5047
  function Drawer({
5144
5048
  open = false,
5145
5049
  allowClickOutside,
@@ -5160,23 +5064,27 @@ function Drawer({
5160
5064
  handleDismiss();
5161
5065
  }, [drawerRootRef]);
5162
5066
  useEscListener_default(dismissOnEscape ? handleDismiss : void 0);
5163
- return /* @__PURE__ */ jsxs31("div", { className: "GeckoUIDrawer", ref: drawerRootRef, role: "dialog", children: [
5067
+ return /* @__PURE__ */ jsxs32("div", { className: "GeckoUIDrawer", ref: drawerRootRef, role: "dialog", children: [
5164
5068
  /* @__PURE__ */ jsx58(
5165
5069
  "div",
5166
5070
  {
5167
- className: classNames(
5168
- "GeckoUIDrawer__backdrop",
5169
- open ? "GeckoUIDrawer__backdrop--visible" : "GeckoUIDrawer__backdrop--hidden",
5170
- hideBackdrop && "GeckoUIDrawer__backdrop--hidden",
5171
- allowClickOutside && "GeckoUIDrawer__backdrop--clickthrough",
5172
- backdropClassName
5173
- ),
5071
+ "data-state": open && !hideBackdrop ? "visible" : "hidden",
5072
+ "data-clickthrough": allowClickOutside || void 0,
5073
+ className: classNames("GeckoUIDrawer__backdrop", backdropClassName),
5174
5074
  onClick: handleDismiss,
5175
5075
  onKeyDown: handleDismiss,
5176
5076
  role: "presentation"
5177
5077
  }
5178
5078
  ),
5179
- /* @__PURE__ */ jsx58("div", { className: getDrawerClasses(placement, open, className), children })
5079
+ /* @__PURE__ */ jsx58(
5080
+ "div",
5081
+ {
5082
+ "data-placement": placement,
5083
+ "data-state": open ? "open" : "closed",
5084
+ className: classNames("GeckoUIDrawer__drawer", className),
5085
+ children
5086
+ }
5087
+ )
5180
5088
  ] });
5181
5089
  }
5182
5090
  var root2 = null;
@@ -5199,155 +5107,230 @@ Drawer.dismiss = () => {
5199
5107
  };
5200
5108
  var Drawer_default = Drawer;
5201
5109
 
5202
- // src/components/Menu/Menu.tsx
5203
- import {
5204
- Menu as HeadlessMenu,
5205
- MenuButton as HeadlessMenuButton,
5206
- MenuHeading as HeadlessMenuHeading,
5207
- MenuItem as HeadlessMenuItem,
5208
- MenuItems as HeadlessMenuItems,
5209
- MenuSection as HeadlessMenuSection,
5210
- MenuSeparator as HeadlessMenuSeparator
5211
- } from "@headlessui/react";
5110
+ // src/components/Menu/Menu/Menu.tsx
5111
+ import { autoUpdate as autoUpdate4, flip as flip5, offset as offset5, useFloating as useFloating5 } from "@floating-ui/react";
5112
+ import { Children as Children5, useCallback as useCallback4, useRef as useRef14, useState as useState13 } from "react";
5113
+
5114
+ // src/components/Menu/Menu.utils.ts
5115
+ import { isValidElement as isValidElement3 } from "react";
5116
+
5117
+ // src/components/Menu/useMenu.tsx
5118
+ import { createContext as createContext2, useContext as useContext2 } from "react";
5119
+ var MenuContext = createContext2(void 0);
5120
+ var useMenu = () => {
5121
+ const context = useContext2(MenuContext);
5122
+ if (context === void 0) {
5123
+ throw new Error("useMenu must be used within a Menu");
5124
+ }
5125
+ return context;
5126
+ };
5127
+
5128
+ // src/components/Menu/MenuTrigger/MenuTrigger.tsx
5129
+ var MenuTrigger = ({ children }) => {
5130
+ const { open, openMenu, closeMenu, toggleMenu, disabled } = useMenu();
5131
+ return children({ open, openMenu, closeMenu, toggleMenu, disabled });
5132
+ };
5133
+ MenuTrigger.displayName = "MenuTrigger";
5134
+ var MenuTrigger_default = MenuTrigger;
5135
+
5136
+ // src/components/Menu/Menu.utils.ts
5137
+ function isMenuTrigger(child) {
5138
+ return isValidElement3(child) && child.type === MenuTrigger_default;
5139
+ }
5140
+
5141
+ // src/components/Menu/MenuButton/MenuButton.tsx
5212
5142
  import { jsx as jsx59 } from "react/jsx-runtime";
5213
- var Menu = HeadlessMenu;
5214
- var MenuButton = (_a) => {
5215
- var _b = _a, { as } = _b, rest = __objRest(_b, ["as"]);
5143
+ var MenuButton = ({ children, className }) => {
5144
+ const { toggleMenu, openMenu, disabled, open, menuRef } = useMenu();
5145
+ const handleKeyDown = (e) => {
5146
+ var _a;
5147
+ if (e.key === "ArrowDown") {
5148
+ e.preventDefault();
5149
+ if (!open) openMenu();
5150
+ const firstItem = (_a = menuRef.current) == null ? void 0 : _a.querySelector("[role=menuitem]");
5151
+ setTimeout(() => firstItem == null ? void 0 : firstItem.focus());
5152
+ }
5153
+ };
5216
5154
  return /* @__PURE__ */ jsx59(
5217
- HeadlessMenuButton,
5218
- __spreadProps(__spreadValues({
5219
- as: as != null ? as : "button"
5220
- }, rest), {
5221
- className: (args) => {
5222
- const className = rest.className;
5223
- return classNames(
5224
- "GeckoUIMenu__button",
5225
- typeof className === "function" ? className(args) : className
5226
- );
5227
- }
5228
- })
5155
+ "button",
5156
+ {
5157
+ type: "button",
5158
+ className: classNames("GeckoUIMenu__button", className),
5159
+ disabled,
5160
+ "aria-haspopup": "menu",
5161
+ "aria-expanded": open,
5162
+ onClick: toggleMenu,
5163
+ onKeyDown: handleKeyDown,
5164
+ children
5165
+ }
5229
5166
  );
5230
5167
  };
5231
- var MenuItems = (_a) => {
5232
- var _b = _a, { as } = _b, rest = __objRest(_b, ["as"]);
5233
- return /* @__PURE__ */ jsx59(
5234
- HeadlessMenuItems,
5235
- __spreadProps(__spreadValues({
5236
- as: as != null ? as : "div"
5237
- }, rest), {
5238
- className: (args) => {
5239
- const className = rest.className;
5240
- return classNames(
5241
- "GeckoUIMenu__items",
5242
- typeof className === "function" ? className(args) : className
5243
- );
5168
+ MenuButton.displayName = "MenuButton";
5169
+ var MenuButton_default = MenuButton;
5170
+
5171
+ // src/components/Menu/MenuPanel/MenuPanel.tsx
5172
+ import { useEffect as useEffect11, useRef as useRef13 } from "react";
5173
+ import { jsx as jsx60 } from "react/jsx-runtime";
5174
+ var MenuPanel = ({ children, className }) => {
5175
+ const {
5176
+ open,
5177
+ disabled,
5178
+ closeMenu,
5179
+ menuRef,
5180
+ floating: { refs, floatingStyles }
5181
+ } = useMenu();
5182
+ const panelRef = useRef13(null);
5183
+ useEffect11(() => {
5184
+ if (!open || !panelRef.current) return;
5185
+ panelRef.current.focus();
5186
+ }, [open]);
5187
+ if (!open || disabled) return null;
5188
+ const handleKeyDown = (e) => {
5189
+ var _a, _b;
5190
+ const items = Array.from(
5191
+ (_b = (_a = panelRef.current) == null ? void 0 : _a.querySelectorAll("[role=menuitem]:not([data-disabled])")) != null ? _b : []
5192
+ );
5193
+ const current = document.activeElement;
5194
+ const currentIndex = items.indexOf(current);
5195
+ switch (e.key) {
5196
+ case "ArrowDown": {
5197
+ e.preventDefault();
5198
+ const next = items[(currentIndex + 1) % items.length];
5199
+ next == null ? void 0 : next.focus();
5200
+ break;
5244
5201
  }
5245
- })
5202
+ case "ArrowUp": {
5203
+ e.preventDefault();
5204
+ const prev = items[(currentIndex - 1 + items.length) % items.length];
5205
+ prev == null ? void 0 : prev.focus();
5206
+ break;
5207
+ }
5208
+ case "Escape":
5209
+ case "Tab":
5210
+ e.preventDefault();
5211
+ closeMenu();
5212
+ break;
5213
+ }
5214
+ };
5215
+ return /* @__PURE__ */ jsx60(
5216
+ "div",
5217
+ {
5218
+ ref: (r) => {
5219
+ refs.setFloating(r);
5220
+ menuRef.current = r;
5221
+ panelRef.current = r;
5222
+ },
5223
+ role: "menu",
5224
+ tabIndex: -1,
5225
+ style: floatingStyles,
5226
+ className: classNames("GeckoUIMenu__items", className),
5227
+ onKeyDown: handleKeyDown,
5228
+ children: /* @__PURE__ */ jsx60("div", { className: "GeckoUIMenu__scroll-container", children })
5229
+ }
5246
5230
  );
5247
5231
  };
5248
- var MenuItem = (_a) => {
5249
- var _b = _a, { children, as } = _b, rest = __objRest(_b, ["children", "as"]);
5250
- return /* @__PURE__ */ jsx59(
5251
- HeadlessMenuItem,
5252
- __spreadProps(__spreadValues({}, rest), {
5253
- className: (args) => {
5254
- const className = rest.className;
5255
- return classNames(
5256
- "GeckoUIMenu__item",
5257
- typeof className === "function" ? className(args) : className
5258
- );
5232
+ MenuPanel.displayName = "MenuPanel";
5233
+ var MenuPanel_default = MenuPanel;
5234
+
5235
+ // src/components/Menu/Menu/Menu.tsx
5236
+ import { jsx as jsx61, jsxs as jsxs33 } from "react/jsx-runtime";
5237
+ var Menu = ({
5238
+ label,
5239
+ disabled = false,
5240
+ placement = "bottom-start",
5241
+ floatingStrategy,
5242
+ className,
5243
+ menuClassName,
5244
+ buttonClassName,
5245
+ children
5246
+ }) => {
5247
+ const menuRef = useRef14(null);
5248
+ const [open, setOpen] = useState13(false);
5249
+ const floating = useFloating5({
5250
+ placement,
5251
+ strategy: floatingStrategy,
5252
+ middleware: [flip5({ padding: 6 }), offset5({ mainAxis: 6 })],
5253
+ whileElementsMounted: autoUpdate4,
5254
+ open,
5255
+ onOpenChange: setOpen
5256
+ });
5257
+ const { refs } = floating;
5258
+ const openMenu = useCallback4(() => {
5259
+ if (disabled || open) return;
5260
+ setOpen(true);
5261
+ }, [disabled, open]);
5262
+ const closeMenu = useCallback4(() => {
5263
+ setOpen(false);
5264
+ }, []);
5265
+ const toggleMenu = useCallback4(() => {
5266
+ if (open) {
5267
+ closeMenu();
5268
+ } else {
5269
+ openMenu();
5270
+ }
5271
+ }, [open, openMenu, closeMenu]);
5272
+ useClickOutside_default(() => {
5273
+ closeMenu();
5274
+ }, [refs.reference]);
5275
+ const childArray = Children5.toArray(children);
5276
+ const trigger = childArray.find(isMenuTrigger);
5277
+ const menuItems = childArray.filter((el) => !isMenuTrigger(el));
5278
+ return /* @__PURE__ */ jsx61(
5279
+ MenuContext.Provider,
5280
+ {
5281
+ value: {
5282
+ open,
5283
+ setOpen,
5284
+ floating,
5285
+ openMenu,
5286
+ closeMenu,
5287
+ toggleMenu,
5288
+ disabled,
5289
+ menuRef
5259
5290
  },
5260
- as: as != null ? as : "button",
5261
- type: "button",
5262
- children
5263
- })
5291
+ children: /* @__PURE__ */ jsxs33("div", { className: classNames("GeckoUIMenu", className), ref: (r) => refs.setReference(r), children: [
5292
+ trigger != null ? trigger : /* @__PURE__ */ jsx61(MenuButton_default, { className: buttonClassName, children: label != null ? label : "Menu" }),
5293
+ /* @__PURE__ */ jsx61(MenuPanel_default, { className: menuClassName, children: menuItems })
5294
+ ] })
5295
+ }
5264
5296
  );
5265
5297
  };
5266
- var MenuHeading = HeadlessMenuHeading;
5267
- var MenuSection = HeadlessMenuSection;
5268
- var MenuSeparator = HeadlessMenuSeparator;
5298
+ Menu.displayName = "Menu";
5299
+ var Menu_default = Menu;
5269
5300
 
5270
- // src/components/Dropdown/Dropdown.tsx
5271
- import { Fragment as Fragment12, jsx as jsx60, jsxs as jsxs32 } from "react/jsx-runtime";
5272
- function Dropdown(_a) {
5273
- var _b = _a, {
5274
- items,
5275
- anchor,
5276
- icon,
5277
- className,
5278
- menuClassName,
5279
- iconClassName,
5280
- children,
5281
- hideArrowIcon
5282
- } = _b, rest = __objRest(_b, [
5283
- "items",
5284
- "anchor",
5285
- "icon",
5286
- "className",
5287
- "menuClassName",
5288
- "iconClassName",
5289
- "children",
5290
- "hideArrowIcon"
5291
- ]);
5292
- const dataAttributes = Object.keys(rest).reduce((acc, key) => {
5293
- if (key.startsWith("data-")) {
5294
- acc[key] = rest[key];
5301
+ // src/components/Menu/MenuItem/MenuItem.tsx
5302
+ import { jsx as jsx62 } from "react/jsx-runtime";
5303
+ var MenuItem = (_a) => {
5304
+ var _b = _a, { label, disabled, className, onClick, children } = _b, rest = __objRest(_b, ["label", "disabled", "className", "onClick", "children"]);
5305
+ const { closeMenu } = useMenu();
5306
+ const handleClick = () => {
5307
+ if (disabled) return;
5308
+ onClick == null ? void 0 : onClick();
5309
+ closeMenu();
5310
+ };
5311
+ const handleKeyDown = (e) => {
5312
+ if (e.key === "Enter" || e.key === " ") {
5313
+ e.preventDefault();
5314
+ handleClick();
5295
5315
  }
5296
- return acc;
5297
- }, {});
5298
- return /* @__PURE__ */ jsxs32(Menu, { children: [
5299
- /* @__PURE__ */ jsxs32(
5300
- MenuButton,
5301
- __spreadProps(__spreadValues({}, dataAttributes), {
5302
- onClick: (e) => {
5303
- e.stopPropagation();
5304
- setTimeout(() => {
5305
- var _a2;
5306
- return (_a2 = document.activeElement) == null ? void 0 : _a2.blur();
5307
- }, 0);
5308
- },
5309
- type: "button",
5310
- as: "button",
5311
- onKeyDown: (e) => {
5312
- if (e.key === "Enter") {
5313
- setTimeout(() => {
5314
- var _a2;
5315
- return (_a2 = document.activeElement) == null ? void 0 : _a2.blur();
5316
- }, 0);
5317
- }
5318
- },
5319
- className: classNames(`GeckoUIDropdown__button`, className),
5320
- children: [
5321
- children,
5322
- !hideArrowIcon && /* @__PURE__ */ jsx60("span", { className: classNames("GeckoUIDropdown__icon", iconClassName) })
5323
- ]
5324
- })
5325
- ),
5326
- /* @__PURE__ */ jsx60(
5327
- MenuItems,
5328
- {
5329
- className: classNames("GeckoUIDropdown__menu", menuClassName),
5330
- anchor: anchor || "bottom start",
5331
- children: () => {
5332
- return /* @__PURE__ */ jsx60(Fragment12, { children: items.map((item, index) => {
5333
- const label = createLabel_default(item);
5334
- return /* @__PURE__ */ jsx60(
5335
- MenuItem,
5336
- __spreadProps(__spreadValues({}, dataAttributes), {
5337
- className: classNames("GeckoUIDropdown__menu-item", item.className),
5338
- onClick: item.onClick,
5339
- children: /* @__PURE__ */ jsx60(DynamicComponentRenderer_default, { component: label })
5340
- }),
5341
- index
5342
- );
5343
- }) });
5344
- }
5345
- }
5346
- )
5347
- ] });
5348
- }
5349
- Dropdown.displayName = "Dropdown";
5350
- var Dropdown_default = Dropdown;
5316
+ };
5317
+ return /* @__PURE__ */ jsx62(
5318
+ "div",
5319
+ __spreadProps(__spreadValues({
5320
+ role: "menuitem",
5321
+ tabIndex: disabled ? -1 : 0,
5322
+ className: classNames("GeckoUIMenu__item", className),
5323
+ "data-disabled": disabled || void 0,
5324
+ onMouseMove: (e) => e.currentTarget.focus(),
5325
+ onClick: disabled ? void 0 : handleClick,
5326
+ onKeyDown: handleKeyDown
5327
+ }, rest), {
5328
+ children: children != null ? children : label
5329
+ })
5330
+ );
5331
+ };
5332
+ MenuItem.displayName = "MenuItem";
5333
+ var MenuItem_default = MenuItem;
5351
5334
  export {
5352
5335
  Alert_default as Alert,
5353
5336
  BaseDateRangeInput_default as BaseDateRangeInput,
@@ -5361,20 +5344,15 @@ export {
5361
5344
  DateRangeInput_default as DateRangeInput,
5362
5345
  Dialog_default as Dialog,
5363
5346
  Drawer_default as Drawer,
5364
- Dropdown_default as Dropdown,
5365
5347
  FilePicker_default as FilePicker,
5366
5348
  GeckoUIPortal_default as GeckoUIPortal,
5367
5349
  Input_default as Input,
5368
5350
  InputError_default as InputError,
5369
5351
  Label_default as Label,
5370
5352
  LoadingButton_default as LoadingButton,
5371
- Menu,
5372
- MenuButton,
5373
- MenuHeading,
5374
- MenuItem,
5375
- MenuItems,
5376
- MenuSection,
5377
- MenuSeparator,
5353
+ Menu_default as Menu,
5354
+ MenuItem_default as MenuItem,
5355
+ MenuTrigger_default as MenuTrigger,
5378
5356
  OTPInput_default as OTPInput,
5379
5357
  Pagination_default as Pagination,
5380
5358
  RHFCheckbox_default as RHFCheckbox,
@@ -5415,6 +5393,7 @@ export {
5415
5393
  useClickOutside_default as useClickOutside,
5416
5394
  useEscListener_default as useEscListener,
5417
5395
  useFilePicker_default as useFilePicker,
5396
+ useMenu,
5418
5397
  usePreventDefault_default as usePreventDefault,
5419
5398
  useSelect
5420
5399
  };