@firecms/ui 3.4.0-canary.f6a889a → 3.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
@@ -44,7 +44,7 @@
44
44
  const defaultBorderMixin = "border-surface-200 border-opacity-40 dark:border-surface-700 dark:border-opacity-40 border-surface-200/40 dark:border-surface-700/40 ";
45
45
  const paperMixin = "bg-white rounded-md dark:bg-surface-950 border border-surface-200 border-opacity-40 dark:border-surface-700 dark:border-opacity-40 border-surface-200/40 dark:border-surface-700/40";
46
46
  const cardMixin = "bg-white dark:bg-surface-950 rounded-md border border-surface-200/40 dark:border-surface-700/40 m-1 -p-1";
47
- const cardClickableMixin = "hover:bg-surface-accent-100 dark:hover:bg-surface-accent-800 hover:ring-2 hover:ring-primary cursor-pointer hover:bg-primary/20 dark:hover:bg-primary/10 ";
47
+ const cardClickableMixin = "hover:bg-surface-accent-100 dark:hover:bg-surface-accent-800 hover:ring-2 hover:ring-primary cursor-pointer hover:bg-primary/20 dark:hover:bg-primary/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary ";
48
48
  const cardSelectedMixin = "bg-primary-bg dark:bg-primary-bg bg-opacity-30 bg-primary-bg/30 dark:bg-opacity-10 dark:bg-primary-bg/10 ring-1 ring-primary ring-opacity-75 ring-primary/75 bg-primary/10 dark:bg-primary/10 ring-1 ring-primary/75";
49
49
  function cls(...classes) {
50
50
  return tailwindMerge.twMerge(clsx.clsx(classes));
@@ -1111,10 +1111,11 @@
1111
1111
  ButtonInner.displayName = "Button";
1112
1112
  const Button = ButtonInner;
1113
1113
  const Card = React.forwardRef((t0, ref) => {
1114
- const $ = reactCompilerRuntime.c(21);
1114
+ const $ = reactCompilerRuntime.c(23);
1115
1115
  let children;
1116
1116
  let className;
1117
1117
  let onClick;
1118
+ let onKeyDownProp;
1118
1119
  let props;
1119
1120
  let style;
1120
1121
  if ($[0] !== t0) {
@@ -1123,61 +1124,73 @@
1123
1124
  className,
1124
1125
  onClick,
1125
1126
  style,
1127
+ onKeyDown: onKeyDownProp,
1126
1128
  ...props
1127
1129
  } = t0);
1128
1130
  $[0] = t0;
1129
1131
  $[1] = children;
1130
1132
  $[2] = className;
1131
1133
  $[3] = onClick;
1132
- $[4] = props;
1133
- $[5] = style;
1134
+ $[4] = onKeyDownProp;
1135
+ $[5] = props;
1136
+ $[6] = style;
1134
1137
  } else {
1135
1138
  children = $[1];
1136
1139
  className = $[2];
1137
1140
  onClick = $[3];
1138
- props = $[4];
1139
- style = $[5];
1141
+ onKeyDownProp = $[4];
1142
+ props = $[5];
1143
+ style = $[6];
1140
1144
  }
1141
1145
  let t1;
1142
- if ($[6] !== onClick) {
1146
+ if ($[7] !== onClick || $[8] !== onKeyDownProp) {
1143
1147
  t1 = (e) => {
1148
+ onKeyDownProp?.(e);
1149
+ if (!onClick || e.defaultPrevented) {
1150
+ return;
1151
+ }
1152
+ if (e.target !== e.currentTarget) {
1153
+ return;
1154
+ }
1144
1155
  if (e.key === "Enter" || e.key === " ") {
1145
- onClick?.();
1156
+ e.preventDefault();
1157
+ onClick();
1146
1158
  }
1147
1159
  };
1148
- $[6] = onClick;
1149
- $[7] = t1;
1160
+ $[7] = onClick;
1161
+ $[8] = onKeyDownProp;
1162
+ $[9] = t1;
1150
1163
  } else {
1151
- t1 = $[7];
1164
+ t1 = $[9];
1152
1165
  }
1153
- const onKeyPress = t1;
1166
+ const onKeyDown = t1;
1154
1167
  const t2 = onClick ? "button" : void 0;
1155
1168
  const t3 = onClick ? 0 : void 0;
1156
1169
  const t4 = onClick && cardClickableMixin;
1157
1170
  let t5;
1158
- if ($[8] !== className || $[9] !== t4) {
1171
+ if ($[10] !== className || $[11] !== t4) {
1159
1172
  t5 = cls(cardMixin, t4, className);
1160
- $[8] = className;
1161
- $[9] = t4;
1162
- $[10] = t5;
1173
+ $[10] = className;
1174
+ $[11] = t4;
1175
+ $[12] = t5;
1163
1176
  } else {
1164
- t5 = $[10];
1177
+ t5 = $[12];
1165
1178
  }
1166
1179
  let t6;
1167
- if ($[11] !== children || $[12] !== onClick || $[13] !== onKeyPress || $[14] !== props || $[15] !== ref || $[16] !== style || $[17] !== t2 || $[18] !== t3 || $[19] !== t5) {
1168
- t6 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref, onKeyPress, role: t2, tabIndex: t3, onClick, className: t5, style, ...props, children });
1169
- $[11] = children;
1170
- $[12] = onClick;
1171
- $[13] = onKeyPress;
1172
- $[14] = props;
1173
- $[15] = ref;
1174
- $[16] = style;
1175
- $[17] = t2;
1176
- $[18] = t3;
1177
- $[19] = t5;
1178
- $[20] = t6;
1180
+ if ($[13] !== children || $[14] !== onClick || $[15] !== onKeyDown || $[16] !== props || $[17] !== ref || $[18] !== style || $[19] !== t2 || $[20] !== t3 || $[21] !== t5) {
1181
+ t6 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref, onKeyDown, role: t2, tabIndex: t3, onClick, className: t5, style, ...props, children });
1182
+ $[13] = children;
1183
+ $[14] = onClick;
1184
+ $[15] = onKeyDown;
1185
+ $[16] = props;
1186
+ $[17] = ref;
1187
+ $[18] = style;
1188
+ $[19] = t2;
1189
+ $[20] = t3;
1190
+ $[21] = t5;
1191
+ $[22] = t6;
1179
1192
  } else {
1180
- t6 = $[20];
1193
+ t6 = $[22];
1181
1194
  }
1182
1195
  return t6;
1183
1196
  });
@@ -36154,6 +36167,7 @@
36154
36167
  onClick,
36155
36168
  onTextSearch,
36156
36169
  placeholder: t1,
36170
+ initialValue,
36157
36171
  expandable: t2,
36158
36172
  size: t3,
36159
36173
  innerClassName,
@@ -36166,7 +36180,7 @@
36166
36180
  const placeholder = t1 === void 0 ? "Search" : t1;
36167
36181
  const expandable = t2 === void 0 ? false : t2;
36168
36182
  const size = t3 === void 0 ? "medium" : t3;
36169
- const [searchText, setSearchText] = React.useState("");
36183
+ const [searchText, setSearchText] = React.useState(initialValue ?? "");
36170
36184
  const [active, setActive] = React.useState(false);
36171
36185
  const deferredValues = useDebounceValue(searchText, 200);
36172
36186
  let t4;