@firecms/ui 3.1.0 → 3.2.0-canary.9c3d298
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.es.js +141 -22
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +141 -22
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/components/DateTimeField.tsx +7 -2
- package/src/components/Tabs.tsx +121 -33
package/dist/index.umd.js
CHANGED
|
@@ -32943,7 +32943,7 @@
|
|
|
32943
32943
|
const [focused, setFocused] = React.useState(false);
|
|
32944
32944
|
const [internalValue, setInternalValue] = React.useState("");
|
|
32945
32945
|
const [isTyping, setIsTyping] = React.useState(false);
|
|
32946
|
-
const invalidValue = value !== void 0 && value !== null && !(value instanceof Date);
|
|
32946
|
+
const invalidValue = value !== void 0 && value !== null && (!(value instanceof Date) || isNaN(value.getTime()));
|
|
32947
32947
|
useInjectStyles("DateTimeField", inputStyles);
|
|
32948
32948
|
const handleClear = (e) => {
|
|
32949
32949
|
e.preventDefault();
|
|
@@ -32966,7 +32966,12 @@
|
|
|
32966
32966
|
// undefined = local timezone
|
|
32967
32967
|
};
|
|
32968
32968
|
const formatter = new Intl.DateTimeFormat("en-CA", options);
|
|
32969
|
-
|
|
32969
|
+
let parts;
|
|
32970
|
+
try {
|
|
32971
|
+
parts = formatter.formatToParts(dateValue);
|
|
32972
|
+
} catch {
|
|
32973
|
+
return "";
|
|
32974
|
+
}
|
|
32970
32975
|
const getPart = (type) => parts.find((p) => p.type === type)?.value ?? "";
|
|
32971
32976
|
const year = getPart("year");
|
|
32972
32977
|
const month = getPart("month");
|
|
@@ -37020,7 +37025,7 @@
|
|
|
37020
37025
|
});
|
|
37021
37026
|
TextField.displayName = "TextField";
|
|
37022
37027
|
function Tabs(t0) {
|
|
37023
|
-
const $ = reactCompilerRuntime.c(
|
|
37028
|
+
const $ = reactCompilerRuntime.c(26);
|
|
37024
37029
|
const {
|
|
37025
37030
|
value,
|
|
37026
37031
|
onValueChange,
|
|
@@ -37028,35 +37033,149 @@
|
|
|
37028
37033
|
innerClassName,
|
|
37029
37034
|
children
|
|
37030
37035
|
} = t0;
|
|
37036
|
+
const scrollContainerRef = React.useRef(null);
|
|
37037
|
+
const [showLeftScroll, setShowLeftScroll] = React.useState(false);
|
|
37038
|
+
const [showRightScroll, setShowRightScroll] = React.useState(false);
|
|
37039
|
+
const [isScrollable, setIsScrollable] = React.useState(false);
|
|
37031
37040
|
let t1;
|
|
37032
|
-
if ($[0]
|
|
37033
|
-
t1 =
|
|
37034
|
-
|
|
37035
|
-
|
|
37041
|
+
if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
37042
|
+
t1 = () => {
|
|
37043
|
+
if (scrollContainerRef.current) {
|
|
37044
|
+
const {
|
|
37045
|
+
scrollLeft,
|
|
37046
|
+
scrollWidth,
|
|
37047
|
+
clientWidth
|
|
37048
|
+
} = scrollContainerRef.current;
|
|
37049
|
+
setShowLeftScroll(scrollLeft > 0);
|
|
37050
|
+
setShowRightScroll(Math.ceil(scrollLeft + clientWidth) < scrollWidth);
|
|
37051
|
+
setIsScrollable(scrollWidth > clientWidth);
|
|
37052
|
+
}
|
|
37053
|
+
};
|
|
37054
|
+
$[0] = t1;
|
|
37036
37055
|
} else {
|
|
37037
|
-
t1 = $[
|
|
37056
|
+
t1 = $[0];
|
|
37038
37057
|
}
|
|
37058
|
+
const checkScroll = t1;
|
|
37039
37059
|
let t2;
|
|
37040
|
-
if ($[
|
|
37041
|
-
t2 =
|
|
37042
|
-
|
|
37043
|
-
|
|
37044
|
-
|
|
37060
|
+
if ($[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
37061
|
+
t2 = () => {
|
|
37062
|
+
checkScroll();
|
|
37063
|
+
window.addEventListener("resize", checkScroll);
|
|
37064
|
+
let observer;
|
|
37065
|
+
if (scrollContainerRef.current) {
|
|
37066
|
+
observer = new ResizeObserver(checkScroll);
|
|
37067
|
+
observer.observe(scrollContainerRef.current);
|
|
37068
|
+
if (scrollContainerRef.current.firstElementChild) {
|
|
37069
|
+
observer.observe(scrollContainerRef.current.firstElementChild);
|
|
37070
|
+
}
|
|
37071
|
+
}
|
|
37072
|
+
return () => {
|
|
37073
|
+
window.removeEventListener("resize", checkScroll);
|
|
37074
|
+
observer?.disconnect();
|
|
37075
|
+
};
|
|
37076
|
+
};
|
|
37077
|
+
$[1] = t2;
|
|
37045
37078
|
} else {
|
|
37046
|
-
t2 = $[
|
|
37079
|
+
t2 = $[1];
|
|
37047
37080
|
}
|
|
37048
37081
|
let t3;
|
|
37049
|
-
if ($[
|
|
37050
|
-
t3 =
|
|
37082
|
+
if ($[2] !== children) {
|
|
37083
|
+
t3 = [children];
|
|
37084
|
+
$[2] = children;
|
|
37085
|
+
$[3] = t3;
|
|
37086
|
+
} else {
|
|
37087
|
+
t3 = $[3];
|
|
37088
|
+
}
|
|
37089
|
+
React.useEffect(t2, t3);
|
|
37090
|
+
let t4;
|
|
37091
|
+
if ($[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
37092
|
+
t4 = (direction) => {
|
|
37093
|
+
if (scrollContainerRef.current) {
|
|
37094
|
+
const container = scrollContainerRef.current;
|
|
37095
|
+
const scrollAmount = Math.max(container.clientWidth / 2, 200);
|
|
37096
|
+
const targetScroll = container.scrollLeft + (direction === "left" ? -scrollAmount : scrollAmount);
|
|
37097
|
+
container.scrollTo({
|
|
37098
|
+
left: targetScroll,
|
|
37099
|
+
behavior: "smooth"
|
|
37100
|
+
});
|
|
37101
|
+
}
|
|
37102
|
+
};
|
|
37103
|
+
$[4] = t4;
|
|
37104
|
+
} else {
|
|
37105
|
+
t4 = $[4];
|
|
37106
|
+
}
|
|
37107
|
+
const scroll = t4;
|
|
37108
|
+
let t5;
|
|
37109
|
+
if ($[5] !== className) {
|
|
37110
|
+
t5 = cls("flex flex-row items-center min-w-0", className);
|
|
37051
37111
|
$[5] = className;
|
|
37052
|
-
$[6] =
|
|
37053
|
-
$[7] = t2;
|
|
37054
|
-
$[8] = value;
|
|
37055
|
-
$[9] = t3;
|
|
37112
|
+
$[6] = t5;
|
|
37056
37113
|
} else {
|
|
37057
|
-
|
|
37114
|
+
t5 = $[6];
|
|
37058
37115
|
}
|
|
37059
|
-
|
|
37116
|
+
let t6;
|
|
37117
|
+
if ($[7] !== isScrollable || $[8] !== showLeftScroll) {
|
|
37118
|
+
t6 = isScrollable && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", disabled: !showLeftScroll, onClick: () => scroll("left"), className: cls("flex-shrink-0 z-10 flex items-center justify-center rounded-md px-0.5 py-1.5 transition-all h-10 w-6", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-surface-400", "disabled:pointer-events-none disabled:opacity-0", "text-surface-600 dark:text-surface-400 hover:bg-surface-200 dark:hover:bg-surface-800", "mr-1 bg-surface-50 dark:bg-surface-900 border", defaultBorderMixin), children: /* @__PURE__ */ jsxRuntime.jsx(ChevronLeftIcon, { size: "small" }) });
|
|
37119
|
+
$[7] = isScrollable;
|
|
37120
|
+
$[8] = showLeftScroll;
|
|
37121
|
+
$[9] = t6;
|
|
37122
|
+
} else {
|
|
37123
|
+
t6 = $[9];
|
|
37124
|
+
}
|
|
37125
|
+
let t7;
|
|
37126
|
+
if ($[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
37127
|
+
t7 = {
|
|
37128
|
+
scrollbarWidth: "none",
|
|
37129
|
+
msOverflowStyle: "none"
|
|
37130
|
+
};
|
|
37131
|
+
$[10] = t7;
|
|
37132
|
+
} else {
|
|
37133
|
+
t7 = $[10];
|
|
37134
|
+
}
|
|
37135
|
+
let t8;
|
|
37136
|
+
if ($[11] !== innerClassName) {
|
|
37137
|
+
t8 = cls("border", defaultBorderMixin, "gap-2", "inline-flex h-10 items-center justify-center rounded-md bg-surface-50 p-1 text-surface-600 dark:bg-surface-900 dark:text-surface-400", innerClassName);
|
|
37138
|
+
$[11] = innerClassName;
|
|
37139
|
+
$[12] = t8;
|
|
37140
|
+
} else {
|
|
37141
|
+
t8 = $[12];
|
|
37142
|
+
}
|
|
37143
|
+
let t9;
|
|
37144
|
+
if ($[13] !== children || $[14] !== t8) {
|
|
37145
|
+
t9 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: scrollContainerRef, className: "flex-1 overflow-x-auto no-scrollbar min-w-0", onScroll: checkScroll, style: t7, children: /* @__PURE__ */ jsxRuntime.jsx(TabsPrimitive__namespace.List, { className: t8, children }) });
|
|
37146
|
+
$[13] = children;
|
|
37147
|
+
$[14] = t8;
|
|
37148
|
+
$[15] = t9;
|
|
37149
|
+
} else {
|
|
37150
|
+
t9 = $[15];
|
|
37151
|
+
}
|
|
37152
|
+
let t10;
|
|
37153
|
+
if ($[16] !== isScrollable || $[17] !== showRightScroll) {
|
|
37154
|
+
t10 = isScrollable && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", disabled: !showRightScroll, onClick: () => scroll("right"), className: cls("flex-shrink-0 z-10 flex items-center justify-center rounded-md px-0.5 py-1.5 transition-all h-10 w-6", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-surface-400", "disabled:pointer-events-none disabled:opacity-0", "text-surface-600 dark:text-surface-400 hover:bg-surface-200 dark:hover:bg-surface-800", "ml-1 bg-surface-50 dark:bg-surface-900 border", defaultBorderMixin), children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRightIcon, { size: "small" }) });
|
|
37155
|
+
$[16] = isScrollable;
|
|
37156
|
+
$[17] = showRightScroll;
|
|
37157
|
+
$[18] = t10;
|
|
37158
|
+
} else {
|
|
37159
|
+
t10 = $[18];
|
|
37160
|
+
}
|
|
37161
|
+
let t11;
|
|
37162
|
+
if ($[19] !== onValueChange || $[20] !== t10 || $[21] !== t5 || $[22] !== t6 || $[23] !== t9 || $[24] !== value) {
|
|
37163
|
+
t11 = /* @__PURE__ */ jsxRuntime.jsxs(TabsPrimitive__namespace.Root, { value, onValueChange, className: t5, children: [
|
|
37164
|
+
t6,
|
|
37165
|
+
t9,
|
|
37166
|
+
t10
|
|
37167
|
+
] });
|
|
37168
|
+
$[19] = onValueChange;
|
|
37169
|
+
$[20] = t10;
|
|
37170
|
+
$[21] = t5;
|
|
37171
|
+
$[22] = t6;
|
|
37172
|
+
$[23] = t9;
|
|
37173
|
+
$[24] = value;
|
|
37174
|
+
$[25] = t11;
|
|
37175
|
+
} else {
|
|
37176
|
+
t11 = $[25];
|
|
37177
|
+
}
|
|
37178
|
+
return t11;
|
|
37060
37179
|
}
|
|
37061
37180
|
function Tab(t0) {
|
|
37062
37181
|
const $ = reactCompilerRuntime.c(8);
|