@rebasepro/ui 0.3.0 → 0.5.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
@@ -873,9 +873,10 @@
873
873
  "min-h-[64px]": size === "large"
874
874
  }, size === "small" || size === "smallest" ? "pl-2" : "pl-4", size === "small" || size === "smallest" ? "pr-4" : "pr-6", position === "end" ? "flex-row-reverse" : "flex-row", fullWidth ? "w-full" : "", className), onClick: disabled ? void 0 : (e) => {
875
875
  if (props.allowIndeterminate) {
876
- if (value === null || value === void 0) onValueChange?.(true);
877
- else if (value) onValueChange?.(false);
878
- else onValueChange?.(null);
876
+ const onChange = onValueChange;
877
+ if (value === null || value === void 0) onChange?.(true);
878
+ else if (value) onChange?.(false);
879
+ else onChange?.(null);
879
880
  } else {
880
881
  onValueChange?.(!value);
881
882
  }
@@ -989,15 +990,15 @@
989
990
  "border border-transparent bg-surface-300 dark:bg-surface-500 opacity-40 bg-surface-300/40 dark:bg-surface-500/40": t25
990
991
  });
991
992
  const sizeClasses2 = cls({
992
- "py-0.5 px-1.5": size === "small",
993
- "py-1.5 px-3": size === "medium",
994
- "py-2 px-4": size === "large",
995
- "py-2.5 px-5": size === "xl",
996
- "py-3 px-6": size === "2xl"
993
+ "py-1 px-2": size === "small",
994
+ "py-2 px-4": size === "medium",
995
+ "py-2.5 px-5": size === "large",
996
+ "py-3 px-6": size === "xl",
997
+ "py-4 px-10": size === "2xl"
997
998
  });
998
999
  const iconColorClass = (color === "neutral" || color === "text") && !disabled ? "[&>svg]:text-surface-accent-500 dark:[&>svg]:text-surface-accent-300" : "";
999
1000
  if (Component) {
1000
- t30 = /* @__PURE__ */ jsxRuntime.jsxs(Component, { ref, onClick: props.onClick, className: cls(startIcon ? "pl-3" : "", "typography-button h-fit rounded-md whitespace-nowrap inline-flex items-center justify-center p-1.5 px-3 focus:outline-none transition-all ease-in-out duration-150 gap-1.5 active:scale-[0.98]", buttonClasses2, sizeClasses2, iconColorClass, className), ...props, children: [
1001
+ t30 = /* @__PURE__ */ jsxRuntime.jsxs(Component, { ref, onClick: props.onClick, className: cls(startIcon ? "pl-3" : "", "typography-button h-fit rounded-md whitespace-nowrap inline-flex items-center justify-center p-2 px-4 focus:outline-none transition-all ease-in-out duration-150 gap-2 active:scale-[0.98]", buttonClasses2, sizeClasses2, iconColorClass, className), ...props, children: [
1001
1002
  startIcon,
1002
1003
  children
1003
1004
  ] });
@@ -1006,7 +1007,7 @@
1006
1007
  t26 = ref;
1007
1008
  t27 = props.type ?? "button";
1008
1009
  t28 = props.onClick;
1009
- t29 = cls(startIcon ? "pl-3" : "", "typography-button h-fit rounded-md whitespace-nowrap inline-flex items-center justify-center p-1.5 px-3 focus:outline-none transition-all ease-in-out duration-150 gap-1.5 active:scale-[0.98]", buttonClasses2, sizeClasses2, iconColorClass, className);
1010
+ t29 = cls(startIcon ? "pl-3" : "", "typography-button h-fit rounded-md whitespace-nowrap inline-flex items-center justify-center p-2 px-4 focus:outline-none transition-all ease-in-out duration-150 gap-2 active:scale-[0.98]", buttonClasses2, sizeClasses2, iconColorClass, className);
1010
1011
  }
1011
1012
  $[11] = Component;
1012
1013
  $[12] = children;
@@ -2151,10 +2152,10 @@
2151
2152
  const baseClasses = "inline-flex items-center justify-center p-2 text-sm font-medium focus:outline-none transition-colors ease-in-out duration-150";
2152
2153
  const colorClasses$1 = "text-surface-accent-500 visited:text-surface-accent-500 dark:text-surface-accent-300 dark:visited:text-surface-300";
2153
2154
  const sizeClasses$1 = {
2154
- medium: "w-9 !h-9 min-w-9 min-h-9",
2155
- small: "w-7 !h-7 min-w-7 min-h-7",
2156
- smallest: "w-5 !h-5 min-w-5 min-h-5",
2157
- large: "w-10 !h-10 min-w-10 min-h-10"
2155
+ medium: "w-10 !h-10 min-w-10 min-h-10",
2156
+ small: "w-8 !h-8 min-w-8 min-h-8",
2157
+ smallest: "w-6 !h-6 min-w-6 min-h-6",
2158
+ large: "w-12 !h-12 min-w-12 min-h-12"
2158
2159
  };
2159
2160
  const shapeClasses = {
2160
2161
  circular: "rounded-full",
@@ -3182,49 +3183,80 @@
3182
3183
  small: "px-2 py-0.5 text-xs",
3183
3184
  medium: "px-2.5 py-1 text-xs"
3184
3185
  };
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;
3186
+ const FilterChip = React.forwardRef(function FilterChip2(t0, ref) {
3187
+ const $ = reactCompilerRuntime.c(22);
3188
+ let children;
3189
+ let className;
3190
+ let icon;
3191
+ let onClick;
3192
+ let rest;
3193
+ let t1;
3194
+ let t2;
3195
+ let t3;
3196
+ if ($[0] !== t0) {
3197
+ ({
3198
+ children,
3199
+ active: t1,
3200
+ onClick,
3201
+ icon,
3202
+ size: t2,
3203
+ className,
3204
+ disabled: t3,
3205
+ ...rest
3206
+ } = t0);
3207
+ $[0] = t0;
3208
+ $[1] = children;
3209
+ $[2] = className;
3210
+ $[3] = icon;
3211
+ $[4] = onClick;
3212
+ $[5] = rest;
3213
+ $[6] = t1;
3214
+ $[7] = t2;
3215
+ $[8] = t3;
3216
+ } else {
3217
+ children = $[1];
3218
+ className = $[2];
3219
+ icon = $[3];
3220
+ onClick = $[4];
3221
+ rest = $[5];
3222
+ t1 = $[6];
3223
+ t2 = $[7];
3224
+ t3 = $[8];
3225
+ }
3196
3226
  const active = t1 === void 0 ? false : t1;
3197
3227
  const size = t2 === void 0 ? "medium" : t2;
3198
3228
  const disabled = t3 === void 0 ? false : t3;
3199
3229
  const t4 = sizeClasses[size];
3200
3230
  let t5;
3201
- if ($[0] !== active || $[1] !== className || $[2] !== disabled || $[3] !== t4) {
3231
+ if ($[9] !== active || $[10] !== className || $[11] !== disabled || $[12] !== t4) {
3202
3232
  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;
3233
+ $[9] = active;
3234
+ $[10] = className;
3235
+ $[11] = disabled;
3236
+ $[12] = t4;
3237
+ $[13] = t5;
3208
3238
  } else {
3209
- t5 = $[4];
3239
+ t5 = $[13];
3210
3240
  }
3211
3241
  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: [
3242
+ if ($[14] !== children || $[15] !== disabled || $[16] !== icon || $[17] !== onClick || $[18] !== ref || $[19] !== rest || $[20] !== t5) {
3243
+ t6 = /* @__PURE__ */ jsxRuntime.jsxs("button", { ref, type: "button", onClick, disabled, className: t5, ...rest, children: [
3214
3244
  icon,
3215
3245
  children
3216
3246
  ] });
3217
- $[5] = children;
3218
- $[6] = disabled;
3219
- $[7] = icon;
3220
- $[8] = onClick;
3221
- $[9] = t5;
3222
- $[10] = t6;
3247
+ $[14] = children;
3248
+ $[15] = disabled;
3249
+ $[16] = icon;
3250
+ $[17] = onClick;
3251
+ $[18] = ref;
3252
+ $[19] = rest;
3253
+ $[20] = t5;
3254
+ $[21] = t6;
3223
3255
  } else {
3224
- t6 = $[10];
3256
+ t6 = $[21];
3225
3257
  }
3226
3258
  return t6;
3227
- }
3259
+ });
3228
3260
  const colorClasses = {
3229
3261
  info: "bg-sky-200 dark:bg-teal-900",
3230
3262
  warn: "bg-orange-200 dark:bg-yellow-950"
@@ -7005,7 +7037,7 @@
7005
7037
  } else {
7006
7038
  t10 = $[12];
7007
7039
  }
7008
- const t11 = variant === "standard" && "inline-flex h-10 items-center justify-start rounded-md bg-surface-50 p-1 text-surface-600 dark:bg-surface-900 dark:text-surface-400 gap-2 border";
7040
+ const t11 = variant === "standard" && "inline-flex h-9 items-center justify-start rounded-md bg-surface-50 p-1 text-surface-600 dark:bg-surface-900 dark:text-surface-400 gap-2 border";
7009
7041
  const t12 = variant === "standard" && defaultBorderMixin;
7010
7042
  const t13 = variant === "boxy" && "flex items-center h-full";
7011
7043
  const t14 = variant === "pill" && "flex items-center gap-0.5";
@@ -7079,7 +7111,7 @@
7079
7111
  const {
7080
7112
  variant
7081
7113
  } = React.useContext(TabsContext);
7082
- const t1 = variant === "standard" && "rounded-sm px-3 py-1.5 data-[state=active]:bg-white data-[state=active]:text-surface-900 data-[state=active]:shadow-sm dark:data-[state=active]:bg-surface-900 dark:data-[state=active]:text-surface-50";
7114
+ const t1 = variant === "standard" && "rounded-sm px-3 py-1 data-[state=active]:bg-white data-[state=active]:text-surface-900 data-[state=active]:shadow-sm dark:data-[state=active]:bg-surface-900 dark:data-[state=active]:text-surface-50";
7083
7115
  let t2;
7084
7116
  if ($[0] !== className || $[1] !== innerClassName || $[2] !== t1 || $[3] !== variant) {
7085
7117
  t2 = cls("inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-white transition-all", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-surface-400 focus-visible:ring-offset-2", "disabled:pointer-events-none disabled:opacity-50", t1, variant === "boxy" && cls("flex-shrink-0 flex items-center gap-1.5 px-3.5 h-9 border-r border-surface-200 dark:border-surface-800 cursor-pointer text-[12px] font-medium transition-colors group relative box-border overflow-hidden", "border-b-2 border-b-transparent", "data-[state=active]:bg-surface-50 dark:data-[state=active]:bg-surface-900", "data-[state=active]:text-text-primary dark:data-[state=active]:text-text-primary-dark", "data-[state=active]:border-b-primary", "text-text-secondary dark:text-text-secondary-dark hover:bg-surface-100 dark:hover:bg-surface-800"), variant === "pill" && cls("px-2 py-0.5 rounded text-[10px] font-medium transition-colors", "data-[state=active]:bg-primary/10 data-[state=active]:text-primary dark:data-[state=active]:bg-primary/20 dark:data-[state=active]:text-blue-400", "text-text-disabled dark:text-text-disabled-dark hover:text-text-secondary dark:hover:text-text-secondary-dark"), className, variant === "standard" && innerClassName);
@@ -7553,73 +7585,59 @@
7553
7585
  });
7554
7586
  Badge.displayName = "Badge";
7555
7587
  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);
7588
+ const [internalValue, setInternalValue] = React.useState(props.value ?? "");
7589
+ const lastSentValueRef = React.useRef(props.value ?? "");
7590
+ const timerRef = React.useRef(void 0);
7591
+ React.useEffect(() => {
7592
+ const externalValue = props.value ?? "";
7593
+ if (externalValue !== lastSentValueRef.current) {
7594
+ setInternalValue(externalValue);
7595
+ lastSentValueRef.current = externalValue;
7596
+ }
7597
+ }, [props.value]);
7598
+ React.useEffect(() => {
7599
+ return () => {
7600
+ if (timerRef.current) clearTimeout(timerRef.current);
7565
7601
  };
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);
7602
+ }, []);
7603
+ const flushChange = React.useCallback((value, event) => {
7604
+ if (timerRef.current) {
7605
+ clearTimeout(timerRef.current);
7606
+ timerRef.current = void 0;
7607
+ }
7608
+ if (value !== props.value && props.onChange) {
7609
+ lastSentValueRef.current = value;
7610
+ const e = {
7611
+ ...event,
7612
+ target: {
7613
+ ...event?.target,
7614
+ value,
7615
+ name: props.name
7616
+ }
7617
+ };
7618
+ props.onChange(e);
7619
+ }
7620
+ }, [props.value, props.onChange, props.name]);
7621
+ const internalOnChange = React.useCallback((event_0) => {
7622
+ const newValue = event_0.target.value;
7623
+ setInternalValue(newValue);
7624
+ if (timerRef.current) clearTimeout(timerRef.current);
7625
+ const eventCopy = {
7626
+ ...event_0,
7627
+ target: {
7628
+ ...event_0?.target,
7629
+ name: event_0?.target?.name
7584
7630
  }
7585
7631
  };
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;
7632
+ timerRef.current = setTimeout(() => {
7633
+ flushChange(newValue, eventCopy);
7634
+ }, 150);
7635
+ }, [flushChange]);
7636
+ const internalOnBlur = React.useCallback((event_1) => {
7637
+ flushChange(internalValue, event_1);
7638
+ props.onBlur?.(event_1);
7639
+ }, [internalValue, flushChange, props.onBlur]);
7640
+ return /* @__PURE__ */ jsxRuntime.jsx(TextField, { ...props, onChange: internalOnChange, onBlur: internalOnBlur, value: internalValue });
7623
7641
  }
7624
7642
  const styles = `
7625
7643
  @keyframes shimmer {
@@ -8339,7 +8357,8 @@
8339
8357
  height: headerHeight
8340
8358
  }, children: [
8341
8359
  columns.map((column_0, columnIndex) => {
8342
- const filterForThisProperty = column_0 && filter && filter[column_0.key] ? filter[column_0.key] : void 0;
8360
+ const columnFilter = column_0 && filter && filter[column_0.key] ? filter[column_0.key] : void 0;
8361
+ const filterForThisProperty = columnFilter ? Array.isArray(columnFilter[0]) ? columnFilter[0] : columnFilter : void 0;
8343
8362
  const isDraggable = !column_0.frozen && !!onColumnsOrderChange;
8344
8363
  const isDragging = draggingColumnId === column_0.key;
8345
8364
  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);