react-better-html 1.1.102 → 1.1.104

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1495,6 +1495,26 @@ var icons = {
1495
1495
  }
1496
1496
  ]
1497
1497
  },
1498
+ doubleChevronLeft: {
1499
+ width: 512,
1500
+ height: 512,
1501
+ paths: [
1502
+ {
1503
+ d: "M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160zm352-160l-160 160c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L301.3 256 438.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0z",
1504
+ type: "fill"
1505
+ }
1506
+ ]
1507
+ },
1508
+ doubleChevronRight: {
1509
+ width: 512,
1510
+ height: 512,
1511
+ paths: [
1512
+ {
1513
+ d: "M470.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L402.7 256 265.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160zm-352 160l160-160c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L210.7 256 73.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0z",
1514
+ type: "fill"
1515
+ }
1516
+ ]
1517
+ },
1498
1518
  eye: {
1499
1519
  width: 576,
1500
1520
  height: 512,
@@ -1534,6 +1554,16 @@ var icons = {
1534
1554
  type: "fill"
1535
1555
  }
1536
1556
  ]
1557
+ },
1558
+ filter: {
1559
+ width: 512,
1560
+ height: 512,
1561
+ paths: [
1562
+ {
1563
+ d: "M3.9 54.9C10.5 40.9 24.5 32 40 32l432 0c15.5 0 29.5 8.9 36.1 22.9s4.6 30.5-5.2 42.5L320 320.9 320 448c0 12.1-6.8 23.2-17.7 28.6s-23.8 4.3-33.5-3l-64-48c-8.1-6-12.8-15.5-12.8-25.6l0-79.1L9 97.3C-.7 85.4-2.8 68.8 3.9 54.9z",
1564
+ type: "fill"
1565
+ }
1566
+ ]
1537
1567
  }
1538
1568
  };
1539
1569
 
@@ -2315,14 +2345,19 @@ DivComponent.column = (0, import_react3.forwardRef)(function Column({ flexRevers
2315
2345
  DivComponent.grid = (0, import_react3.forwardRef)(function Grid(props, ref) {
2316
2346
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DivComponent, { display: "grid", ref, ...props });
2317
2347
  });
2318
- DivComponent.box = (0, import_react3.forwardRef)(function Box(props, ref) {
2348
+ DivComponent.box = (0, import_react3.forwardRef)(function Box({ isActive, ...props }, ref) {
2319
2349
  const theme2 = useTheme();
2350
+ const withClick = props.onClick || props.onClickWithValue;
2320
2351
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2321
2352
  DivComponent,
2322
2353
  {
2323
- backgroundColor: theme2.colors.backgroundContent,
2324
- border: `1px solid ${theme2.colors.border}`,
2354
+ color: isActive ? theme2.colors.base : void 0,
2355
+ backgroundColor: isActive ? theme2.colors.primary : theme2.colors.backgroundContent,
2356
+ border: `1px solid ${isActive ? theme2.colors.primary : theme2.colors.border}`,
2325
2357
  borderRadius: theme2.styles.borderRadius,
2358
+ borderColorHover: withClick && !isActive ? theme2.colors.primary : void 0,
2359
+ filterHover: withClick && isActive ? "brightness(0.9)" : void 0,
2360
+ cursor: withClick ? "pointer" : void 0,
2326
2361
  paddingBlock: theme2.styles.gap,
2327
2362
  paddingInline: theme2.styles.space,
2328
2363
  ref,
@@ -2833,33 +2868,32 @@ var Button_default = Button2;
2833
2868
  var import_react10 = require("react");
2834
2869
  var import_jsx_runtime8 = require("react/jsx-runtime");
2835
2870
  var Divider_default = {
2836
- vertical: (0, import_react10.memo)(function Divider({ width = 1, backgroundColor, height, ...props }) {
2837
- const theme2 = useTheme();
2838
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2839
- Div_default,
2840
- {
2841
- width,
2842
- height: height ?? "100%",
2843
- flexShrink: 0,
2844
- backgroundColor: backgroundColor ?? theme2.colors.border,
2845
- ...props
2846
- }
2847
- );
2848
- }),
2849
- horizontal: (0, import_react10.memo)(function Divider2({
2850
- width = 1,
2851
- backgroundColor,
2852
- text,
2853
- textColor,
2854
- ...props
2855
- }) {
2856
- const theme2 = useTheme();
2857
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Div_default.row, { width: "100%", alignItems: "center", gap: text ? theme2.styles.space : void 0, ...props, children: [
2858
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ?? theme2.colors.border }),
2859
- text && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text_default, { color: textColor ?? theme2.colors.textSecondary, children: text }),
2860
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ?? theme2.colors.border })
2861
- ] });
2862
- })
2871
+ vertical: (0, import_react10.memo)(
2872
+ (0, import_react10.forwardRef)(function Divider({ width = 1, backgroundColor, height, ...props }, ref) {
2873
+ const theme2 = useTheme();
2874
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2875
+ Div_default,
2876
+ {
2877
+ width,
2878
+ height: height ?? "100%",
2879
+ flexShrink: 0,
2880
+ backgroundColor: backgroundColor ?? theme2.colors.border,
2881
+ ...props,
2882
+ ref
2883
+ }
2884
+ );
2885
+ })
2886
+ ),
2887
+ horizontal: (0, import_react10.memo)(
2888
+ (0, import_react10.forwardRef)(function Divider2({ width = 1, backgroundColor, text, textColor, ...props }, ref) {
2889
+ const theme2 = useTheme();
2890
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Div_default.row, { width: "100%", alignItems: "center", gap: text ? theme2.styles.space : void 0, ...props, ref, children: [
2891
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ?? theme2.colors.border }),
2892
+ text && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text_default, { color: textColor ?? theme2.colors.textSecondary, children: text }),
2893
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Div_default, { flex: 1, height: width, flexShrink: 0, backgroundColor: backgroundColor ?? theme2.colors.border })
2894
+ ] });
2895
+ })
2896
+ )
2863
2897
  };
2864
2898
 
2865
2899
  // src/components/Modal.tsx
@@ -3131,7 +3165,7 @@ var Modal_default = Modal2;
3131
3165
  // src/components/PageHolder.tsx
3132
3166
  var import_react12 = require("react");
3133
3167
  var import_jsx_runtime10 = require("react/jsx-runtime");
3134
- function PageHolder({ noMaxContentWidth, children, ...props }) {
3168
+ var PageHolderComponent = (0, import_react12.forwardRef)(function PageHolder({ noMaxContentWidth, children, ...props }, ref) {
3135
3169
  const theme2 = useTheme();
3136
3170
  const { app } = useBetterHtmlContextInternal();
3137
3171
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
@@ -3143,16 +3177,69 @@ function PageHolder({ noMaxContentWidth, children, ...props }) {
3143
3177
  margin: "0px auto",
3144
3178
  padding: theme2.styles.space,
3145
3179
  ...props,
3180
+ ref,
3146
3181
  children
3147
3182
  }
3148
3183
  );
3149
- }
3150
- var PageHolder_default = (0, import_react12.memo)(PageHolder);
3184
+ });
3185
+ PageHolderComponent.center = (0, import_react12.forwardRef)(function Center({
3186
+ decorationImageSrc,
3187
+ decorationImageName,
3188
+ decorationImagePosition = "right",
3189
+ noMaxContentWidth,
3190
+ children,
3191
+ ...props
3192
+ }, ref) {
3193
+ const theme2 = useTheme();
3194
+ const mediaQuery = useMediaQuery();
3195
+ const { app } = useBetterHtmlContextInternal();
3196
+ const breakingPoint = mediaQuery.size1000;
3197
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Div_default.row, { width: "100%", minHeight: "100svh", alignItems: "center", justifyContent: "center", children: [
3198
+ decorationImagePosition === "left" && !breakingPoint && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Div_default, { width: "50%" }),
3199
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3200
+ Div_default.column,
3201
+ {
3202
+ width: `${!breakingPoint && (decorationImageSrc || decorationImageName) ? 50 : 100}%`,
3203
+ alignItems: "center",
3204
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3205
+ Div_default.box,
3206
+ {
3207
+ width: `calc(100% - ${theme2.styles.space}px * 2)`,
3208
+ maxWidth: !noMaxContentWidth ? app.contentMaxWidth / 2 : void 0,
3209
+ marginInline: theme2.styles.space,
3210
+ marginBlock: theme2.styles.space,
3211
+ ...props,
3212
+ ref,
3213
+ children
3214
+ }
3215
+ )
3216
+ }
3217
+ ),
3218
+ decorationImagePosition === "right" && !breakingPoint && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Div_default, { width: "50%" }),
3219
+ (decorationImageSrc || decorationImageName) && !breakingPoint && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
3220
+ Image_default,
3221
+ {
3222
+ position: "fixed",
3223
+ name: decorationImageName,
3224
+ src: decorationImageSrc,
3225
+ width: "50%",
3226
+ height: "100svh",
3227
+ top: 0,
3228
+ left: decorationImagePosition === "left" ? 0 : "auto",
3229
+ right: decorationImagePosition === "right" ? 0 : "auto",
3230
+ objectFit: "cover"
3231
+ }
3232
+ )
3233
+ ] });
3234
+ });
3235
+ var PageHolder2 = (0, import_react12.memo)(PageHolderComponent);
3236
+ PageHolder2.center = PageHolderComponent.center;
3237
+ var PageHolder_default = PageHolder2;
3151
3238
 
3152
3239
  // src/components/PageHeader.tsx
3153
3240
  var import_react13 = require("react");
3154
3241
  var import_jsx_runtime11 = require("react/jsx-runtime");
3155
- function PageHeader({
3242
+ var PageHeaderComponent = (0, import_react13.forwardRef)(function PageHeader({
3156
3243
  imageUrl,
3157
3244
  imageSize = 60,
3158
3245
  title,
@@ -3163,56 +3250,66 @@ function PageHeader({
3163
3250
  rightElement,
3164
3251
  lightMode,
3165
3252
  marginBottom
3166
- }) {
3253
+ }, ref) {
3167
3254
  const theme2 = useTheme();
3168
3255
  const { app } = useBetterHtmlContextInternal();
3169
3256
  const mediaQuery = useMediaQuery();
3170
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.space, marginBottom: marginBottom ?? theme2.styles.space * 2, children: [
3171
- imageUrl && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Image_default.profileImage, { src: imageUrl, size: imageSize ?? (mediaQuery.size600 ? 46 : 60) }),
3172
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3173
- Div_default.column,
3174
- {
3175
- alignItems: textAlign === "center" ? "center" : textAlign === "right" ? "flex-end" : void 0,
3176
- flex: 1,
3177
- gap: theme2.styles.gap / 2,
3178
- children: [
3179
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3180
- Div_default.row,
3181
- {
3182
- alignItems: "center",
3183
- justifyContent: textAlign === "center" ? "center" : textAlign === "right" ? "flex-end" : void 0,
3184
- gap: theme2.styles.space,
3185
- children: [
3186
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3187
- Text_default,
3188
- {
3189
- as: titleAs ?? "h1",
3190
- textAlign,
3191
- color: lightMode ? theme2.colors.base : theme2.colors.textPrimary,
3192
- children: title
3193
- }
3194
- ),
3195
- titleRightElement
3196
- ]
3197
- }
3198
- ),
3199
- description && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3200
- Text_default,
3201
- {
3202
- maxWidth: !mediaQuery.size600 ? app.contentMaxWidth * 0.6 : void 0,
3203
- textAlign,
3204
- color: lightMode ? theme2.colors.base : theme2.colors.textSecondary,
3205
- opacity: lightMode ? 0.7 : void 0,
3206
- children: description
3207
- }
3208
- )
3209
- ]
3210
- }
3211
- ),
3212
- rightElement
3213
- ] });
3214
- }
3215
- var PageHeader_default = (0, import_react13.memo)(PageHeader);
3257
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3258
+ Div_default.row,
3259
+ {
3260
+ alignItems: "center",
3261
+ gap: theme2.styles.space,
3262
+ marginBottom: marginBottom ?? theme2.styles.space * 2,
3263
+ ref,
3264
+ children: [
3265
+ imageUrl && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Image_default.profileImage, { src: imageUrl, size: imageSize ?? (mediaQuery.size600 ? 46 : 60) }),
3266
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3267
+ Div_default.column,
3268
+ {
3269
+ alignItems: textAlign === "center" ? "center" : textAlign === "right" ? "flex-end" : void 0,
3270
+ flex: 1,
3271
+ gap: theme2.styles.gap / 2,
3272
+ children: [
3273
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
3274
+ Div_default.row,
3275
+ {
3276
+ alignItems: "center",
3277
+ justifyContent: textAlign === "center" ? "center" : textAlign === "right" ? "flex-end" : void 0,
3278
+ gap: theme2.styles.space,
3279
+ children: [
3280
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3281
+ Text_default,
3282
+ {
3283
+ as: titleAs ?? "h1",
3284
+ textAlign,
3285
+ color: lightMode ? theme2.colors.base : theme2.colors.textPrimary,
3286
+ children: title
3287
+ }
3288
+ ),
3289
+ titleRightElement
3290
+ ]
3291
+ }
3292
+ ),
3293
+ description && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
3294
+ Text_default,
3295
+ {
3296
+ maxWidth: !mediaQuery.size600 ? app.contentMaxWidth * 0.6 : void 0,
3297
+ textAlign,
3298
+ color: lightMode ? theme2.colors.base : theme2.colors.textSecondary,
3299
+ opacity: lightMode ? 0.7 : void 0,
3300
+ children: description
3301
+ }
3302
+ )
3303
+ ]
3304
+ }
3305
+ ),
3306
+ rightElement
3307
+ ]
3308
+ }
3309
+ );
3310
+ });
3311
+ var PageHeader2 = (0, import_react13.memo)(PageHeaderComponent);
3312
+ var PageHeader_default = PageHeader2;
3216
3313
 
3217
3314
  // src/components/Chip.tsx
3218
3315
  var import_react14 = require("react");
@@ -5492,10 +5589,19 @@ var InputElement = import_styled_components9.default.input.withConfig({
5492
5589
  cursor: not-allowed;
5493
5590
  }
5494
5591
 
5592
+ &::-webkit-outer-spin-button,
5593
+ &::-webkit-inner-spin-button {
5594
+ -webkit-appearance: none;
5595
+ margin: 0;
5596
+ }
5597
+
5598
+ &[type="number"] {
5599
+ -moz-appearance: textfield;
5600
+ }
5601
+
5495
5602
  &[type="date"],
5496
5603
  &[type="datetime-local"],
5497
5604
  &[type="time"] {
5498
- // min-height: 46px;
5499
5605
  -webkit-appearance: none;
5500
5606
  -moz-appearance: textfield;
5501
5607
 
@@ -5649,7 +5755,7 @@ var InputFieldComponent = (0, import_react18.forwardRef)(function InputField({
5649
5755
  onChangeValue?.(debouncedValue);
5650
5756
  }, [withDebounce, onChangeValue, debouncedValue]);
5651
5757
  const readyId = id ?? internalId;
5652
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap, ...styledComponentStylesWithExcluded, children: [
5758
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, ...styledComponentStylesWithExcluded, children: [
5653
5759
  label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Label_default, { text: label, color: labelColor, required, isError: !!errorText, htmlFor: readyId }),
5654
5760
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default, { position: "relative", width: "100%", ref: holderRef, children: [
5655
5761
  leftIcon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
@@ -5744,7 +5850,7 @@ InputFieldComponent.multiline = (0, import_react18.forwardRef)(function Multilin
5744
5850
  [onChange, onChangeValue]
5745
5851
  );
5746
5852
  const readyId = id ?? internalId;
5747
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { gap: theme2.styles.gap, children: [
5853
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
5748
5854
  label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Label_default, { text: label, required, isError: !!errorText, htmlFor: readyId }),
5749
5855
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default, { position: "relative", width: "100%", children: [
5750
5856
  leftIcon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
@@ -5895,7 +6001,7 @@ InputFieldComponent.phoneNumber = (0, import_react18.forwardRef)(function PhoneN
5895
6001
  setInputFieldValue(newValue.slice(country?.phoneNumberExtension.length + 1));
5896
6002
  }, [value]);
5897
6003
  const readyId = id ?? internalId;
5898
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap, children: [
6004
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Div_default.column, { width: "100%", gap: theme2.styles.gap / 2, children: [
5899
6005
  label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5900
6006
  Label_default,
5901
6007
  {
@@ -5919,8 +6025,10 @@ InputFieldComponent.phoneNumber = (0, import_react18.forwardRef)(function PhoneN
5919
6025
  inputFieldClassName: "react-better-html-phone-number-holder",
5920
6026
  defaultValue,
5921
6027
  value: dropdownValue,
6028
+ disabled: props.disabled,
5922
6029
  onChange: setDropdownValue,
5923
- withoutClearButton: true
6030
+ withoutClearButton: true,
6031
+ withoutRenderingOptionsWhenClosed: true
5924
6032
  }
5925
6033
  ),
5926
6034
  /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
@@ -6570,22 +6678,24 @@ var ToggleInput_default = {
6570
6678
  // src/components/Form.tsx
6571
6679
  var import_react20 = require("react");
6572
6680
  var import_jsx_runtime18 = require("react/jsx-runtime");
6573
- function Form({
6681
+ var FormComponent = (0, import_react20.forwardRef)(function Form({
6574
6682
  form,
6575
6683
  submitButtonText,
6576
6684
  submitButtonLoaderName,
6577
6685
  submitButtonId,
6578
6686
  submitButtonIsDisabled,
6687
+ cancelButtonText,
6579
6688
  actionButtonsLocation = "right",
6580
6689
  gap,
6581
6690
  isSubmitting,
6582
6691
  isDestructive,
6583
6692
  withDividers,
6693
+ renderActionButtons,
6584
6694
  onClickCancel,
6585
6695
  onSubmit,
6586
6696
  children,
6587
6697
  ...props
6588
- }) {
6698
+ }, ref) {
6589
6699
  const theme2 = useTheme();
6590
6700
  const submitButtonIsDisabledInternal = (0, import_react20.useMemo)(() => {
6591
6701
  if (!form || !form.requiredFields) return false;
@@ -6595,7 +6705,7 @@ function Form({
6595
6705
  }, [form]);
6596
6706
  const SubmitButtonTag = isDestructive ? Button_default.destructive : Button_default;
6597
6707
  const submitButtonIsDisabledFinal = submitButtonIsDisabled || submitButtonIsDisabledInternal;
6598
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Div_default, { width: "100%", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("form", { onSubmit: onSubmit ?? form?.onSubmit, children: [
6708
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Div_default, { width: "100%", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("form", { onSubmit: onSubmit ?? form?.onSubmit, ref, children: [
6599
6709
  gap !== void 0 || withDividers ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Div_default.column, { gap: gap ?? (withDividers ? theme2.styles.space : theme2.styles.gap), children: withDividers ? import_react20.Children.toArray(children).map((child, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react20.Fragment, { children: [
6600
6710
  child,
6601
6711
  index < import_react20.Children.toArray(children).length - 1 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Divider_default.horizontal, {})
@@ -6608,7 +6718,8 @@ function Form({
6608
6718
  gap: theme2.styles.gap,
6609
6719
  marginTop: theme2.styles.space,
6610
6720
  children: [
6611
- onClickCancel && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button_default.secondary, { text: "Cancel", onClick: onClickCancel }),
6721
+ renderActionButtons,
6722
+ onClickCancel && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button_default.secondary, { text: cancelButtonText ?? "Cancel", onClick: onClickCancel }),
6612
6723
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6613
6724
  SubmitButtonTag,
6614
6725
  {
@@ -6624,8 +6735,9 @@ function Form({
6624
6735
  }
6625
6736
  )
6626
6737
  ] }) });
6627
- }
6628
- var Form_default = (0, import_react20.memo)(Form);
6738
+ });
6739
+ var Form2 = (0, import_react20.memo)(FormComponent);
6740
+ var Form_default = Form2;
6629
6741
 
6630
6742
  // src/components/FormRow.tsx
6631
6743
  var import_react21 = require("react");
@@ -6748,6 +6860,7 @@ var import_react23 = require("react");
6748
6860
  var import_styled_components11 = __toESM(require("styled-components"));
6749
6861
  var import_jsx_runtime21 = require("react/jsx-runtime");
6750
6862
  var defaultImageWidth = 120;
6863
+ var maximumVisiblePages = 11;
6751
6864
  var TableStyledComponent = import_styled_components11.default.table.withConfig({
6752
6865
  shouldForwardProp: (prop) => !["isStriped", "withHover", "withStickyHeader", "colorTheme", "theme"].includes(prop)
6753
6866
  })`
@@ -6763,6 +6876,10 @@ var TableStyledComponent = import_styled_components11.default.table.withConfig({
6763
6876
  font-weight: 700;
6764
6877
  }
6765
6878
 
6879
+ &.isFooter {
6880
+ background-color: ${(props) => props.theme.colors.backgroundSecondary};
6881
+ }
6882
+
6766
6883
  &.isClickable {
6767
6884
  cursor: pointer;
6768
6885
  }
@@ -6811,6 +6928,19 @@ var TdStyledComponent = import_styled_components11.default.td.withConfig({
6811
6928
  })`
6812
6929
  ${(props) => props.textAlign ? `text-align: ${props.textAlign} !important;` : ""}
6813
6930
  `;
6931
+ var filterPresetsText = {
6932
+ today: "Today",
6933
+ yesterday: "Yesterday",
6934
+ thisWeek: "This week",
6935
+ thisMonth: "This month",
6936
+ thisYear: "This year",
6937
+ lastWeek: "Last week",
6938
+ lastMonth: "Last month",
6939
+ lastYear: "Last year",
6940
+ nextWeek: "Next week",
6941
+ nextMonth: "Next month",
6942
+ nextYear: "Next year"
6943
+ };
6814
6944
  var TableComponent = (0, import_react23.forwardRef)(function Table({
6815
6945
  columns,
6816
6946
  data,
@@ -6818,13 +6948,50 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
6818
6948
  isLoading,
6819
6949
  withStickyHeader,
6820
6950
  noDataItemsMessage = "No data available",
6951
+ pageSize,
6821
6952
  onClickRow,
6822
6953
  onClickAllCheckboxes,
6954
+ onChangePage,
6955
+ onChangeFilter,
6823
6956
  ...props
6824
6957
  }, ref) {
6825
- const { colorTheme } = useBetterHtmlContextInternal();
6826
6958
  const theme2 = useTheme();
6959
+ const mediumScreen = useMediaQuery();
6960
+ const { colorTheme } = useBetterHtmlContextInternal();
6961
+ const filterModalRef = (0, import_react23.useRef)(null);
6827
6962
  const [checkedItems, setCheckedItems] = (0, import_react23.useState)([]);
6963
+ const [currentPage, setCurrentPage] = (0, import_react23.useState)(1);
6964
+ const [filterData, setFilterData] = (0, import_react23.useState)({});
6965
+ const [openedFilterColumnIndex, setOpenedFilterColumnIndex] = (0, import_react23.useState)();
6966
+ const [filterListSelectedItems, setFilterListSelectedItems] = (0, import_react23.useState)();
6967
+ const openedFilterData = openedFilterColumnIndex ? filterData[openedFilterColumnIndex] : void 0;
6968
+ const openedFilterColumn = openedFilterColumnIndex ? columns[openedFilterColumnIndex] : void 0;
6969
+ const filterForm = useForm({
6970
+ defaultValues: {
6971
+ min: void 0,
6972
+ max: void 0
6973
+ },
6974
+ onSubmit: (values) => {
6975
+ if (!openedFilterColumn?.filter) return;
6976
+ if (openedFilterColumnIndex === void 0) return;
6977
+ setFilterData((oldValue) => ({
6978
+ ...oldValue,
6979
+ [openedFilterColumnIndex]: openedFilterColumn.filter === "number" ? {
6980
+ type: openedFilterColumn.filter,
6981
+ min: values.min,
6982
+ max: values.max
6983
+ } : openedFilterColumn.filter === "date" || openedFilterColumn.filter === "date-time" ? {
6984
+ type: openedFilterColumn.filter,
6985
+ min: values.min,
6986
+ max: values.max
6987
+ } : openedFilterColumn.filter === "list" ? {
6988
+ type: openedFilterColumn.filter,
6989
+ list: filterListSelectedItems
6990
+ } : void 0
6991
+ }));
6992
+ filterModalRef.current?.close();
6993
+ }
6994
+ });
6828
6995
  const renderCellContent = (0, import_react23.useCallback)(
6829
6996
  (column, item, index) => {
6830
6997
  switch (column.type) {
@@ -6877,57 +7044,489 @@ var TableComponent = (0, import_react23.forwardRef)(function Table({
6877
7044
  },
6878
7045
  [onClickAllCheckboxes, data]
6879
7046
  );
7047
+ const onClickFilterButton = (0, import_react23.useCallback)(
7048
+ (columnIndex) => {
7049
+ const thisFilterData = filterData[columnIndex];
7050
+ if (thisFilterData?.type === "number" || thisFilterData?.type === "date" || thisFilterData?.type === "date-time") {
7051
+ filterForm.setFieldsValue({
7052
+ min: thisFilterData.min ?? void 0,
7053
+ max: thisFilterData.max ?? void 0
7054
+ });
7055
+ } else if (thisFilterData?.type === "list") {
7056
+ setFilterListSelectedItems(thisFilterData.list);
7057
+ }
7058
+ setOpenedFilterColumnIndex(columnIndex);
7059
+ filterModalRef.current?.open();
7060
+ },
7061
+ [filterData]
7062
+ );
7063
+ const onCloseFilterModal = (0, import_react23.useCallback)(() => {
7064
+ setTimeout(() => setOpenedFilterColumnIndex(void 0), 0.2 * 1e3);
7065
+ setFilterListSelectedItems(void 0);
7066
+ filterForm.reset();
7067
+ }, []);
7068
+ const onClickCancelFormFilter = (0, import_react23.useCallback)(() => {
7069
+ if (openedFilterColumnIndex === void 0) return;
7070
+ setFilterData((oldValue) => ({
7071
+ ...oldValue,
7072
+ [openedFilterColumnIndex]: void 0
7073
+ }));
7074
+ filterModalRef.current?.close();
7075
+ }, [openedFilterColumnIndex]);
7076
+ const onClickFilterListItem = (0, import_react23.useCallback)(
7077
+ (value) => setFilterListSelectedItems((oldValue) => {
7078
+ if (!oldValue) return [value];
7079
+ if (oldValue.includes(value)) return oldValue.filter((item) => item !== value);
7080
+ return [...oldValue, value];
7081
+ }),
7082
+ []
7083
+ );
7084
+ const onClickFilterPreset = (0, import_react23.useCallback)(
7085
+ (preset) => {
7086
+ const getValueForDate = (date) => {
7087
+ if (openedFilterColumn?.filter === "date") return date.toISOString().split("T")[0];
7088
+ return date.toISOString();
7089
+ };
7090
+ switch (preset) {
7091
+ case "today":
7092
+ filterForm.setFieldsValue({
7093
+ min: getValueForDate(/* @__PURE__ */ new Date()),
7094
+ max: getValueForDate(/* @__PURE__ */ new Date())
7095
+ });
7096
+ break;
7097
+ case "yesterday":
7098
+ filterForm.setFieldsValue({
7099
+ min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 1))),
7100
+ max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 1)))
7101
+ });
7102
+ break;
7103
+ case "thisWeek":
7104
+ filterForm.setFieldsValue({
7105
+ min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 7))),
7106
+ max: getValueForDate(/* @__PURE__ */ new Date())
7107
+ });
7108
+ break;
7109
+ case "thisMonth":
7110
+ filterForm.setFieldsValue({
7111
+ min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setMonth((/* @__PURE__ */ new Date()).getMonth() - 1))),
7112
+ max: getValueForDate(/* @__PURE__ */ new Date())
7113
+ });
7114
+ break;
7115
+ case "thisYear":
7116
+ filterForm.setFieldsValue({
7117
+ min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setFullYear((/* @__PURE__ */ new Date()).getFullYear() - 1))),
7118
+ max: getValueForDate(/* @__PURE__ */ new Date())
7119
+ });
7120
+ break;
7121
+ case "lastWeek":
7122
+ filterForm.setFieldsValue({
7123
+ min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 7))),
7124
+ max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 1)))
7125
+ });
7126
+ break;
7127
+ case "lastMonth":
7128
+ filterForm.setFieldsValue({
7129
+ min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setMonth((/* @__PURE__ */ new Date()).getMonth() - 1))),
7130
+ max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 1)))
7131
+ });
7132
+ break;
7133
+ case "lastYear":
7134
+ filterForm.setFieldsValue({
7135
+ min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setFullYear((/* @__PURE__ */ new Date()).getFullYear() - 1))),
7136
+ max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 1)))
7137
+ });
7138
+ break;
7139
+ case "nextWeek":
7140
+ filterForm.setFieldsValue({
7141
+ min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() + 7))),
7142
+ max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() + 7)))
7143
+ });
7144
+ break;
7145
+ case "nextMonth":
7146
+ filterForm.setFieldsValue({
7147
+ min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setMonth((/* @__PURE__ */ new Date()).getMonth() + 1))),
7148
+ max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setMonth((/* @__PURE__ */ new Date()).getMonth() + 1)))
7149
+ });
7150
+ break;
7151
+ case "nextYear":
7152
+ filterForm.setFieldsValue({
7153
+ min: getValueForDate(new Date((/* @__PURE__ */ new Date()).setFullYear((/* @__PURE__ */ new Date()).getFullYear() + 1))),
7154
+ max: getValueForDate(new Date((/* @__PURE__ */ new Date()).setFullYear((/* @__PURE__ */ new Date()).getFullYear() + 1)))
7155
+ });
7156
+ break;
7157
+ default:
7158
+ break;
7159
+ }
7160
+ },
7161
+ [openedFilterColumn]
7162
+ );
7163
+ const dataAfterFilter = (0, import_react23.useMemo)(
7164
+ () => data.filter(
7165
+ (item) => Object.entries(filterData).every(([columnIndex, filter]) => {
7166
+ if (!filter) return true;
7167
+ const column = columns[parseInt(columnIndex)];
7168
+ if (!column) return true;
7169
+ if (column.filter === "number" && filter.type === "number") {
7170
+ const itemValue = column.getValue?.(item) ?? (column.type === "text" && column.keyName ? Number(item[column.keyName]) : 0);
7171
+ if (filter.min !== void 0 && itemValue < filter.min) return false;
7172
+ if (filter.max !== void 0 && itemValue > filter.max) return false;
7173
+ } else if (column.filter === "date" && filter.type === "date" || column.filter === "date-time" && filter.type === "date-time") {
7174
+ const minDate = filter.min ? new Date(filter.min) : void 0;
7175
+ const maxDate = filter.max ? new Date(filter.max) : void 0;
7176
+ const itemValue = column.getValue?.(item) ?? new Date(column.type === "text" && column.keyName ? String(item[column.keyName]) : "");
7177
+ if (filter.min !== void 0 && minDate && itemValue < minDate) return false;
7178
+ if (filter.max !== void 0 && maxDate && itemValue > maxDate) return false;
7179
+ } else if (column.filter === "list" && filter.type === "list") {
7180
+ const itemValue = column.getValueForList?.(item) ?? (column.type === "text" && column.keyName ? String(item[column.keyName]) : "");
7181
+ if (!filter.list?.includes(itemValue)) return false;
7182
+ }
7183
+ return true;
7184
+ })
7185
+ ),
7186
+ [data, filterData, columns]
7187
+ );
7188
+ const dataAfterPagination = (0, import_react23.useMemo)(() => {
7189
+ if (pageSize === void 0) return dataAfterFilter;
7190
+ const pageStartItemIndex = (currentPage - 1) * (pageSize ?? 0);
7191
+ const pageEndItemIndex = pageStartItemIndex + (pageSize ?? 0);
7192
+ return dataAfterFilter.slice(pageStartItemIndex, pageEndItemIndex);
7193
+ }, [dataAfterFilter, pageSize, currentPage]);
6880
7194
  const everythingIsChecked = (0, import_react23.useMemo)(() => {
6881
7195
  return checkedItems.every((checked) => checked) && checkedItems.length === data.length;
6882
7196
  }, [data, checkedItems]);
6883
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
6884
- Div_default,
6885
- {
6886
- border: `1px solid ${theme2.colors.border}`,
6887
- borderRadius: theme2.styles.borderRadius * 2,
6888
- overflow: "auto",
6889
- ...props,
6890
- ref,
6891
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
6892
- TableStyledComponent,
6893
- {
6894
- isStriped,
6895
- withHover: onClickRow !== void 0,
6896
- withStickyHeader,
6897
- colorTheme,
6898
- theme: theme2,
6899
- children: [
6900
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "isHeader", children: columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
6901
- ThStyledComponent,
6902
- {
6903
- width: column.type === "image" ? defaultImageWidth : column.type === "checkbox" ? 26 : column.width,
6904
- minWidth: column.minWidth,
6905
- maxWidth: column.maxWidth,
6906
- textAlign: column.align,
6907
- children: column.label ?? (column.type === "checkbox" && onClickAllCheckboxes ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
6908
- ToggleInput_default.checkbox,
6909
- {
6910
- checked: everythingIsChecked,
6911
- onChange: onClickAllCheckboxesElement
6912
- }
6913
- ) : "")
6914
- },
6915
- column.type + column.label + index
6916
- )) }) }),
6917
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tbody", { children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Loader_default.box, {}) }) }) : data.length > 0 ? data.map((item, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
6918
- "tr",
6919
- {
6920
- className: onClickRow ? "isClickable" : void 0,
6921
- onClick: () => onClickRowElement(item, rowIndex),
6922
- children: columns.map((column, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TdStyledComponent, { textAlign: column.align, children: renderCellContent(column, item, rowIndex) }, column.type + column.label + colIndex))
6923
- },
6924
- JSON.stringify(item) + rowIndex
6925
- )) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default.unknown, { children: noDataItemsMessage }) }) }) })
6926
- ]
7197
+ const possibleFilterListValues = (0, import_react23.useMemo)(() => {
7198
+ if (!openedFilterColumn) return [];
7199
+ return data.reduce(
7200
+ (previousValue, currentValue) => {
7201
+ const value = openedFilterColumn.type === "text" && openedFilterColumn.keyName ? String(currentValue[openedFilterColumn.keyName]) : void 0;
7202
+ if (value !== void 0) {
7203
+ if (previousValue.some((item) => item.value === value)) {
7204
+ previousValue = previousValue.map(
7205
+ (item) => item.value === value ? {
7206
+ ...item,
7207
+ count: item.count + 1
7208
+ } : item
7209
+ );
7210
+ } else
7211
+ previousValue.push({
7212
+ value,
7213
+ count: 1
7214
+ });
6927
7215
  }
6928
- )
7216
+ return previousValue;
7217
+ },
7218
+ []
7219
+ );
7220
+ }, [data, openedFilterColumn]);
7221
+ const pagesCount = pageSize !== void 0 ? Math.ceil(dataAfterPagination.length / pageSize) : 1;
7222
+ const paginationItems = (0, import_react23.useMemo)(() => {
7223
+ const halfRange = Math.floor(maximumVisiblePages / 2);
7224
+ let startPage = Math.max(1, currentPage - halfRange);
7225
+ let endPage = Math.min(pagesCount, currentPage + halfRange);
7226
+ if (endPage - startPage + 1 < maximumVisiblePages) {
7227
+ startPage = Math.max(1, endPage - maximumVisiblePages + 1);
7228
+ endPage = Math.min(pagesCount, startPage + maximumVisiblePages - 1);
6929
7229
  }
7230
+ return Array.from(
7231
+ {
7232
+ length: endPage - startPage + 1
7233
+ },
7234
+ (_, index) => startPage + index
7235
+ );
7236
+ }, [pagesCount, currentPage]);
7237
+ const onClickNextPage = (0, import_react23.useCallback)(() => {
7238
+ setCurrentPage((oldValue) => oldValue >= pagesCount ? pagesCount : oldValue + 1);
7239
+ }, [pagesCount]);
7240
+ const onClickPreviousPage = (0, import_react23.useCallback)(() => {
7241
+ setCurrentPage((oldValue) => oldValue <= 1 ? 1 : oldValue - 1);
7242
+ }, []);
7243
+ const onClickSelectAllFilterListItems = (0, import_react23.useCallback)(
7244
+ () => setFilterListSelectedItems(possibleFilterListValues.map((item) => item.value)),
7245
+ [possibleFilterListValues]
6930
7246
  );
7247
+ const onClickDeselectAllFilterListItems = (0, import_react23.useCallback)(() => setFilterListSelectedItems([]), []);
7248
+ (0, import_react23.useEffect)(() => {
7249
+ onChangePage?.(currentPage);
7250
+ }, [onChangePage, currentPage]);
7251
+ (0, import_react23.useEffect)(() => {
7252
+ onChangeFilter?.(filterData);
7253
+ }, [onChangeFilter, filterData]);
7254
+ (0, import_react23.useImperativeHandle)(
7255
+ ref,
7256
+ () => {
7257
+ return {
7258
+ currentPage,
7259
+ setCurrentPage,
7260
+ pagesCount,
7261
+ setCheckedItems
7262
+ };
7263
+ },
7264
+ [currentPage, setCurrentPage, pagesCount, setCheckedItems]
7265
+ );
7266
+ const mobileFooterBreakingPoint = mediumScreen.size700 && pagesCount > maximumVisiblePages / 1.4;
7267
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
7268
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7269
+ Div_default,
7270
+ {
7271
+ border: `1px solid ${theme2.colors.border}`,
7272
+ borderRadius: theme2.styles.borderRadius * 2,
7273
+ overflow: "auto",
7274
+ ...props,
7275
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
7276
+ TableStyledComponent,
7277
+ {
7278
+ isStriped,
7279
+ withHover: onClickRow !== void 0,
7280
+ withStickyHeader,
7281
+ colorTheme,
7282
+ theme: theme2,
7283
+ children: [
7284
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "isHeader", children: columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7285
+ ThStyledComponent,
7286
+ {
7287
+ width: column.type === "image" ? defaultImageWidth : column.type === "checkbox" ? 26 : column.width,
7288
+ minWidth: column.minWidth,
7289
+ maxWidth: column.maxWidth,
7290
+ textAlign: column.align,
7291
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
7292
+ Div_default.row,
7293
+ {
7294
+ width: "100%",
7295
+ alignItems: "center",
7296
+ justifyContent: "space-between",
7297
+ gap: theme2.styles.gap,
7298
+ children: [
7299
+ column.type === "checkbox" && onClickAllCheckboxes ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7300
+ ToggleInput_default.checkbox,
7301
+ {
7302
+ checked: everythingIsChecked,
7303
+ onChange: onClickAllCheckboxesElement
7304
+ }
7305
+ ) : column.label ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { children: column.label }) : void 0,
7306
+ column.filter && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7307
+ Button_default.icon,
7308
+ {
7309
+ icon: "filter",
7310
+ color: filterData[index] ? theme2.colors.primary : theme2.colors.textSecondary,
7311
+ value: index,
7312
+ onClickWithValue: onClickFilterButton
7313
+ }
7314
+ )
7315
+ ]
7316
+ }
7317
+ )
7318
+ },
7319
+ column.type + column.label + index
7320
+ )) }) }),
7321
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tbody", { children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Loader_default.box, {}) }) }) : dataAfterPagination.length > 0 ? dataAfterPagination.map((item, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7322
+ "tr",
7323
+ {
7324
+ className: onClickRow ? "isClickable" : void 0,
7325
+ onClick: () => onClickRowElement(item, rowIndex),
7326
+ children: columns.map((column, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TdStyledComponent, { textAlign: column.align, children: renderCellContent(column, item, rowIndex) }, column.type + column.label + colIndex))
7327
+ },
7328
+ JSON.stringify(item) + rowIndex
7329
+ )) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { className: "noData", colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default.unknown, { children: noDataItemsMessage }) }) }) }),
7330
+ pageSize !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tfoot", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { className: "isFooter", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { colSpan: columns.length, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
7331
+ Div_default.column,
7332
+ {
7333
+ position: "relative",
7334
+ width: "100%",
7335
+ justifyContent: "center",
7336
+ flexReverse: true,
7337
+ gap: theme2.styles.gap / 2,
7338
+ children: [
7339
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
7340
+ Text_default,
7341
+ {
7342
+ position: mobileFooterBreakingPoint ? "relative" : "absolute",
7343
+ top: !mobileFooterBreakingPoint ? "50%" : void 0,
7344
+ color: theme2.colors.textSecondary,
7345
+ transform: !mobileFooterBreakingPoint ? "translateY(-50%)" : void 0,
7346
+ userSelect: "none",
7347
+ children: [
7348
+ currentPage,
7349
+ " / ",
7350
+ pagesCount
7351
+ ]
7352
+ }
7353
+ ),
7354
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.row, { alignItems: "center", justifyContent: "center", gap: theme2.styles.gap * 2, children: [
7355
+ pagesCount > maximumVisiblePages && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7356
+ Button_default.icon,
7357
+ {
7358
+ icon: "doubleChevronLeft",
7359
+ disabled: currentPage === 1,
7360
+ value: 1,
7361
+ onClickWithValue: setCurrentPage
7362
+ }
7363
+ ),
7364
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7365
+ Button_default.icon,
7366
+ {
7367
+ icon: "chevronLeft",
7368
+ disabled: currentPage === 1,
7369
+ onClick: onClickPreviousPage
7370
+ }
7371
+ ),
7372
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7373
+ Div_default.row,
7374
+ {
7375
+ alignItems: "center",
7376
+ justifyContent: "center",
7377
+ flexWrap: mobileFooterBreakingPoint ? "wrap" : void 0,
7378
+ gap: theme2.styles.gap,
7379
+ children: paginationItems.map((pageIndex) => {
7380
+ const isActive = currentPage === pageIndex;
7381
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7382
+ Div_default,
7383
+ {
7384
+ cursor: "pointer",
7385
+ userSelect: "none",
7386
+ value: pageIndex,
7387
+ onClickWithValue: setCurrentPage,
7388
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7389
+ Text_default,
7390
+ {
7391
+ fontWeight: isActive ? 700 : 400,
7392
+ color: isActive ? theme2.colors.primary : theme2.colors.textSecondary,
7393
+ transition: theme2.styles.transition,
7394
+ children: pageIndex
7395
+ }
7396
+ )
7397
+ },
7398
+ pageIndex
7399
+ );
7400
+ })
7401
+ }
7402
+ ),
7403
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7404
+ Button_default.icon,
7405
+ {
7406
+ icon: "chevronRight",
7407
+ disabled: currentPage === pagesCount,
7408
+ onClick: onClickNextPage
7409
+ }
7410
+ ),
7411
+ pagesCount > maximumVisiblePages && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7412
+ Button_default.icon,
7413
+ {
7414
+ icon: "doubleChevronRight",
7415
+ disabled: currentPage === pagesCount,
7416
+ onClickWithValue: setCurrentPage,
7417
+ value: pagesCount
7418
+ }
7419
+ )
7420
+ ] })
7421
+ ]
7422
+ }
7423
+ ) }) }) })
7424
+ ]
7425
+ }
7426
+ )
7427
+ }
7428
+ ),
7429
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7430
+ Modal_default,
7431
+ {
7432
+ title: `Filter ${openedFilterColumn?.label}`,
7433
+ description: openedFilterColumn?.filter === "number" ? "Enter minimum and maximum values to filter" : openedFilterColumn?.filter === "date" || openedFilterColumn?.filter === "date-time" ? "Enter minimum and maximum dates to filter" : openedFilterColumn?.filter === "list" ? "Select values to filter from the list bellow" : "",
7434
+ onClose: onCloseFilterModal,
7435
+ ref: filterModalRef,
7436
+ children: openedFilterColumn ? openedFilterColumn.filter === "number" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7437
+ Form_default,
7438
+ {
7439
+ form: filterForm,
7440
+ submitButtonText: "Filter",
7441
+ cancelButtonText: "Clear",
7442
+ onClickCancel: openedFilterData ? onClickCancelFormFilter : void 0,
7443
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(FormRow_default, { children: [
7444
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(InputField_default, { type: "number", label: "Min", ...filterForm.getInputFieldProps("min") }),
7445
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(InputField_default, { type: "number", label: "Max", ...filterForm.getInputFieldProps("max") })
7446
+ ] })
7447
+ }
7448
+ ) : openedFilterColumn.filter === "date" || openedFilterColumn.filter === "date-time" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
7449
+ Form_default,
7450
+ {
7451
+ form: filterForm,
7452
+ gap: theme2.styles.gap,
7453
+ submitButtonText: "Filter",
7454
+ cancelButtonText: "Clear",
7455
+ onClickCancel: openedFilterData ? onClickCancelFormFilter : void 0,
7456
+ children: [
7457
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(FormRow_default, { children: [
7458
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(InputField_default.date, { label: "Min", ...filterForm.getInputFieldProps("min") }),
7459
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(InputField_default.date, { label: "Max", ...filterForm.getInputFieldProps("max") })
7460
+ ] }),
7461
+ openedFilterColumn.presets && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, children: [
7462
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Label_default, { text: "Presets" }),
7463
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: openedFilterColumn.presets.map((preset) => {
7464
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7465
+ Button_default.secondary,
7466
+ {
7467
+ text: filterPresetsText[preset],
7468
+ value: preset,
7469
+ onClickWithValue: onClickFilterPreset
7470
+ },
7471
+ preset
7472
+ );
7473
+ }) })
7474
+ ] })
7475
+ ]
7476
+ }
7477
+ ) : openedFilterColumn.filter === "list" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7478
+ Form_default,
7479
+ {
7480
+ submitButtonText: "Filter",
7481
+ cancelButtonText: "Clear",
7482
+ renderActionButtons: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.row, { marginRight: "auto", alignItems: "center", gap: theme2.styles.gap, children: [
7483
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7484
+ Button_default.secondary,
7485
+ {
7486
+ text: "Select All",
7487
+ disabled: possibleFilterListValues.length === filterListSelectedItems?.length,
7488
+ onClick: onClickSelectAllFilterListItems
7489
+ }
7490
+ ),
7491
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7492
+ Button_default.secondary,
7493
+ {
7494
+ text: "Deselect All",
7495
+ disabled: !filterListSelectedItems?.length,
7496
+ onClick: onClickDeselectAllFilterListItems
7497
+ }
7498
+ )
7499
+ ] }),
7500
+ onClickCancel: openedFilterData ? onClickCancelFormFilter : void 0,
7501
+ onSubmit: filterForm.onSubmit,
7502
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.column, { gap: theme2.styles.gap / 2, marginBottom: theme2.styles.space, children: [
7503
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Label_default, { text: "Possible values" }),
7504
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Div_default.row, { flexWrap: "wrap", gap: theme2.styles.gap, children: possibleFilterListValues.map((value) => {
7505
+ const isActive = filterListSelectedItems?.includes(value.value);
7506
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
7507
+ Div_default.box,
7508
+ {
7509
+ isActive,
7510
+ value: value.value,
7511
+ onClickWithValue: onClickFilterListItem,
7512
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap / 2, children: [
7513
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default, { children: value.value }),
7514
+ openedFilterColumn.withTotalNumber && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text_default, { fontSize: 14, color: theme2.colors.textSecondary, children: [
7515
+ "(",
7516
+ value.count,
7517
+ ")"
7518
+ ] })
7519
+ ] })
7520
+ },
7521
+ value.value
7522
+ );
7523
+ }) })
7524
+ ] })
7525
+ }
7526
+ ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text_default.unknown, { children: "Unknown filter" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Loader_default.box, {})
7527
+ }
7528
+ )
7529
+ ] });
6931
7530
  });
6932
7531
  var Table2 = (0, import_react23.memo)(TableComponent);
6933
7532
  var Table_default = Table2;