@rebasepro/ui 0.2.5 → 0.4.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.umd.js CHANGED
@@ -3182,49 +3182,80 @@
3182
3182
  small: "px-2 py-0.5 text-xs",
3183
3183
  medium: "px-2.5 py-1 text-xs"
3184
3184
  };
3185
- function FilterChip(t0) {
3186
- const $ = reactCompilerRuntime.c(11);
3187
- const {
3188
- children,
3189
- active: t1,
3190
- onClick,
3191
- icon,
3192
- size: t2,
3193
- className,
3194
- disabled: t3
3195
- } = t0;
3185
+ const FilterChip = React.forwardRef(function FilterChip2(t0, ref) {
3186
+ const $ = reactCompilerRuntime.c(22);
3187
+ let children;
3188
+ let className;
3189
+ let icon;
3190
+ let onClick;
3191
+ let rest;
3192
+ let t1;
3193
+ let t2;
3194
+ let t3;
3195
+ if ($[0] !== t0) {
3196
+ ({
3197
+ children,
3198
+ active: t1,
3199
+ onClick,
3200
+ icon,
3201
+ size: t2,
3202
+ className,
3203
+ disabled: t3,
3204
+ ...rest
3205
+ } = t0);
3206
+ $[0] = t0;
3207
+ $[1] = children;
3208
+ $[2] = className;
3209
+ $[3] = icon;
3210
+ $[4] = onClick;
3211
+ $[5] = rest;
3212
+ $[6] = t1;
3213
+ $[7] = t2;
3214
+ $[8] = t3;
3215
+ } else {
3216
+ children = $[1];
3217
+ className = $[2];
3218
+ icon = $[3];
3219
+ onClick = $[4];
3220
+ rest = $[5];
3221
+ t1 = $[6];
3222
+ t2 = $[7];
3223
+ t3 = $[8];
3224
+ }
3196
3225
  const active = t1 === void 0 ? false : t1;
3197
3226
  const size = t2 === void 0 ? "medium" : t2;
3198
3227
  const disabled = t3 === void 0 ? false : t3;
3199
3228
  const t4 = sizeClasses[size];
3200
3229
  let t5;
3201
- if ($[0] !== active || $[1] !== className || $[2] !== disabled || $[3] !== t4) {
3230
+ if ($[9] !== active || $[10] !== className || $[11] !== disabled || $[12] !== t4) {
3202
3231
  t5 = cls("inline-flex items-center gap-1 rounded-full", "font-medium whitespace-nowrap select-none shrink-0", "transition-all duration-150", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50", t4, active ? "bg-primary/12 text-primary dark:bg-primary/20 dark:text-primary shadow-[inset_0_0_0_1.5px_var(--color-primary)]" : cls("bg-surface-accent-100 text-text-secondary dark:bg-surface-accent-800 dark:text-text-secondary-dark", !disabled && "cursor-pointer hover:bg-surface-accent-200 dark:hover:bg-surface-accent-700"), disabled && "opacity-50 cursor-not-allowed", className);
3203
- $[0] = active;
3204
- $[1] = className;
3205
- $[2] = disabled;
3206
- $[3] = t4;
3207
- $[4] = t5;
3232
+ $[9] = active;
3233
+ $[10] = className;
3234
+ $[11] = disabled;
3235
+ $[12] = t4;
3236
+ $[13] = t5;
3208
3237
  } else {
3209
- t5 = $[4];
3238
+ t5 = $[13];
3210
3239
  }
3211
3240
  let t6;
3212
- if ($[5] !== children || $[6] !== disabled || $[7] !== icon || $[8] !== onClick || $[9] !== t5) {
3213
- t6 = /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", onClick, disabled, className: t5, children: [
3241
+ if ($[14] !== children || $[15] !== disabled || $[16] !== icon || $[17] !== onClick || $[18] !== ref || $[19] !== rest || $[20] !== t5) {
3242
+ t6 = /* @__PURE__ */ jsxRuntime.jsxs("button", { ref, type: "button", onClick, disabled, className: t5, ...rest, children: [
3214
3243
  icon,
3215
3244
  children
3216
3245
  ] });
3217
- $[5] = children;
3218
- $[6] = disabled;
3219
- $[7] = icon;
3220
- $[8] = onClick;
3221
- $[9] = t5;
3222
- $[10] = t6;
3246
+ $[14] = children;
3247
+ $[15] = disabled;
3248
+ $[16] = icon;
3249
+ $[17] = onClick;
3250
+ $[18] = ref;
3251
+ $[19] = rest;
3252
+ $[20] = t5;
3253
+ $[21] = t6;
3223
3254
  } else {
3224
- t6 = $[10];
3255
+ t6 = $[21];
3225
3256
  }
3226
3257
  return t6;
3227
- }
3258
+ });
3228
3259
  const colorClasses = {
3229
3260
  info: "bg-sky-200 dark:bg-teal-900",
3230
3261
  warn: "bg-orange-200 dark:bg-yellow-950"
@@ -7553,73 +7584,59 @@
7553
7584
  });
7554
7585
  Badge.displayName = "Badge";
7555
7586
  function DebouncedTextField(props) {
7556
- const $ = reactCompilerRuntime.c(13);
7557
- const previousEventRef = React.useRef(void 0);
7558
- const [internalValue, setInternalValue] = React.useState(props.value);
7559
- const deferredValue = React.useDeferredValue(internalValue);
7560
- let t0;
7561
- let t1;
7562
- if ($[0] !== props.value) {
7563
- t0 = () => {
7564
- setInternalValue(props.value);
7587
+ const [internalValue, setInternalValue] = React.useState(props.value ?? "");
7588
+ const lastSentValueRef = React.useRef(props.value ?? "");
7589
+ const timerRef = React.useRef(void 0);
7590
+ React.useEffect(() => {
7591
+ const externalValue = props.value ?? "";
7592
+ if (externalValue !== lastSentValueRef.current) {
7593
+ setInternalValue(externalValue);
7594
+ lastSentValueRef.current = externalValue;
7595
+ }
7596
+ }, [props.value]);
7597
+ React.useEffect(() => {
7598
+ return () => {
7599
+ if (timerRef.current) clearTimeout(timerRef.current);
7565
7600
  };
7566
- t1 = [props.value];
7567
- $[0] = props.value;
7568
- $[1] = t0;
7569
- $[2] = t1;
7570
- } else {
7571
- t0 = $[1];
7572
- t1 = $[2];
7573
- }
7574
- React.useEffect(t0, t1);
7575
- let t2;
7576
- if ($[3] !== deferredValue || $[4] !== props) {
7577
- t2 = () => {
7578
- const emptyInitialValue = !props.value;
7579
- if (emptyInitialValue && !deferredValue) {
7580
- return;
7581
- }
7582
- if (deferredValue !== props.value && previousEventRef.current && props.onChange) {
7583
- props.onChange(previousEventRef.current);
7601
+ }, []);
7602
+ const flushChange = React.useCallback((value, event) => {
7603
+ if (timerRef.current) {
7604
+ clearTimeout(timerRef.current);
7605
+ timerRef.current = void 0;
7606
+ }
7607
+ if (value !== props.value && props.onChange) {
7608
+ lastSentValueRef.current = value;
7609
+ const e = {
7610
+ ...event,
7611
+ target: {
7612
+ ...event?.target,
7613
+ value,
7614
+ name: props.name
7615
+ }
7616
+ };
7617
+ props.onChange(e);
7618
+ }
7619
+ }, [props.value, props.onChange, props.name]);
7620
+ const internalOnChange = React.useCallback((event_0) => {
7621
+ const newValue = event_0.target.value;
7622
+ setInternalValue(newValue);
7623
+ if (timerRef.current) clearTimeout(timerRef.current);
7624
+ const eventCopy = {
7625
+ ...event_0,
7626
+ target: {
7627
+ ...event_0?.target,
7628
+ name: event_0?.target?.name
7584
7629
  }
7585
7630
  };
7586
- $[3] = deferredValue;
7587
- $[4] = props;
7588
- $[5] = t2;
7589
- } else {
7590
- t2 = $[5];
7591
- }
7592
- let t3;
7593
- if ($[6] !== deferredValue || $[7] !== props.value) {
7594
- t3 = [deferredValue, props.value];
7595
- $[6] = deferredValue;
7596
- $[7] = props.value;
7597
- $[8] = t3;
7598
- } else {
7599
- t3 = $[8];
7600
- }
7601
- React.useEffect(t2, t3);
7602
- let t4;
7603
- if ($[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
7604
- t4 = (event) => {
7605
- previousEventRef.current = event;
7606
- setInternalValue(event.target.value);
7607
- };
7608
- $[9] = t4;
7609
- } else {
7610
- t4 = $[9];
7611
- }
7612
- const internalOnChange = t4;
7613
- let t5;
7614
- if ($[10] !== internalValue || $[11] !== props) {
7615
- t5 = /* @__PURE__ */ jsxRuntime.jsx(TextField, { ...props, onChange: internalOnChange, value: internalValue });
7616
- $[10] = internalValue;
7617
- $[11] = props;
7618
- $[12] = t5;
7619
- } else {
7620
- t5 = $[12];
7621
- }
7622
- return t5;
7631
+ timerRef.current = setTimeout(() => {
7632
+ flushChange(newValue, eventCopy);
7633
+ }, 150);
7634
+ }, [flushChange]);
7635
+ const internalOnBlur = React.useCallback((event_1) => {
7636
+ flushChange(internalValue, event_1);
7637
+ props.onBlur?.(event_1);
7638
+ }, [internalValue, flushChange, props.onBlur]);
7639
+ return /* @__PURE__ */ jsxRuntime.jsx(TextField, { ...props, onChange: internalOnChange, onBlur: internalOnBlur, value: internalValue });
7623
7640
  }
7624
7641
  const styles = `
7625
7642
  @keyframes shimmer {
@@ -8339,7 +8356,8 @@
8339
8356
  height: headerHeight
8340
8357
  }, children: [
8341
8358
  columns.map((column_0, columnIndex) => {
8342
- const filterForThisProperty = column_0 && filter && filter[column_0.key] ? filter[column_0.key] : void 0;
8359
+ const columnFilter = column_0 && filter && filter[column_0.key] ? filter[column_0.key] : void 0;
8360
+ const filterForThisProperty = columnFilter ? Array.isArray(columnFilter[0]) ? columnFilter[0] : columnFilter : void 0;
8343
8361
  const isDraggable = !column_0.frozen && !!onColumnsOrderChange;
8344
8362
  const isDragging = draggingColumnId === column_0.key;
8345
8363
  return /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxRuntime.jsx(SortableColumnHeader, { column: column_0, columnIndex, columnRefs, isResizing, onFilterUpdate, filter: filterForThisProperty, sortByProperty, currentSort, onColumnSort, onClickResizeColumn, createFilterField, isDragging, isDraggable }) }, "header_" + column_0.key);