@firecms/ui 3.1.0-canary.1df3b2c → 3.1.0-canary.75005e4
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/components/MultiSelect.d.ts +1 -1
- package/dist/components/Select.d.ts +1 -1
- package/dist/hooks/useOutsideAlerter.d.ts +1 -1
- package/dist/index.es.js +143 -24
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +143 -24
- package/dist/index.umd.js.map +1 -1
- package/package.json +6 -6
- package/src/components/DateTimeField.tsx +7 -2
- package/src/components/DebouncedTextField.tsx +3 -3
- package/src/components/MultiSelect.tsx +4 -6
- package/src/components/Select.tsx +62 -62
- package/src/components/Tabs.tsx +121 -33
- package/src/hooks/useOutsideAlerter.tsx +1 -1
|
@@ -31,7 +31,7 @@ interface MultiSelectProps<T extends MultiSelectValue = string> {
|
|
|
31
31
|
multiple?: boolean;
|
|
32
32
|
includeSelectAll?: boolean;
|
|
33
33
|
includeClear?: boolean;
|
|
34
|
-
inputRef?: React.RefObject<HTMLButtonElement>;
|
|
34
|
+
inputRef?: React.RefObject<HTMLButtonElement | null>;
|
|
35
35
|
padding?: boolean;
|
|
36
36
|
invisible?: boolean;
|
|
37
37
|
children: React.ReactNode;
|
|
@@ -20,7 +20,7 @@ export type SelectProps<T extends SelectValue = string> = {
|
|
|
20
20
|
error?: boolean;
|
|
21
21
|
position?: "item-aligned" | "popper";
|
|
22
22
|
endAdornment?: React.ReactNode;
|
|
23
|
-
inputRef?: React.RefObject<HTMLButtonElement>;
|
|
23
|
+
inputRef?: React.RefObject<HTMLButtonElement | null>;
|
|
24
24
|
padding?: boolean;
|
|
25
25
|
invisible?: boolean;
|
|
26
26
|
children?: React.ReactNode;
|
|
@@ -2,4 +2,4 @@ import { RefObject } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* Hook that alerts clicks outside the passed ref
|
|
4
4
|
*/
|
|
5
|
-
export declare function useOutsideAlerter(ref: RefObject<HTMLElement>, onOutsideClick: () => void, active?: boolean): void;
|
|
5
|
+
export declare function useOutsideAlerter(ref: RefObject<HTMLElement | null>, onOutsideClick: () => void, active?: boolean): void;
|
package/dist/index.es.js
CHANGED
|
@@ -32933,7 +32933,7 @@ const DateTimeField = ({
|
|
|
32933
32933
|
const [focused, setFocused] = useState(false);
|
|
32934
32934
|
const [internalValue, setInternalValue] = useState("");
|
|
32935
32935
|
const [isTyping, setIsTyping] = useState(false);
|
|
32936
|
-
const invalidValue = value !== void 0 && value !== null && !(value instanceof Date);
|
|
32936
|
+
const invalidValue = value !== void 0 && value !== null && (!(value instanceof Date) || isNaN(value.getTime()));
|
|
32937
32937
|
useInjectStyles("DateTimeField", inputStyles);
|
|
32938
32938
|
const handleClear = (e) => {
|
|
32939
32939
|
e.preventDefault();
|
|
@@ -32956,7 +32956,12 @@ const DateTimeField = ({
|
|
|
32956
32956
|
// undefined = local timezone
|
|
32957
32957
|
};
|
|
32958
32958
|
const formatter = new Intl.DateTimeFormat("en-CA", options);
|
|
32959
|
-
|
|
32959
|
+
let parts;
|
|
32960
|
+
try {
|
|
32961
|
+
parts = formatter.formatToParts(dateValue);
|
|
32962
|
+
} catch {
|
|
32963
|
+
return "";
|
|
32964
|
+
}
|
|
32960
32965
|
const getPart = (type) => parts.find((p) => p.type === type)?.value ?? "";
|
|
32961
32966
|
const year = getPart("year");
|
|
32962
32967
|
const month = getPart("month");
|
|
@@ -34910,7 +34915,7 @@ const MultiSelect = React.forwardRef((t0, ref) => {
|
|
|
34910
34915
|
let t12;
|
|
34911
34916
|
let t13;
|
|
34912
34917
|
if ($[9] !== children) {
|
|
34913
|
-
t13 = children ? Children.map(children, _temp$2)
|
|
34918
|
+
t13 = children ? Children.map(children, _temp$2)?.filter(Boolean) ?? [] : [];
|
|
34914
34919
|
$[9] = children;
|
|
34915
34920
|
$[10] = t13;
|
|
34916
34921
|
} else {
|
|
@@ -37010,7 +37015,7 @@ const TextField = forwardRef(({
|
|
|
37010
37015
|
});
|
|
37011
37016
|
TextField.displayName = "TextField";
|
|
37012
37017
|
function Tabs(t0) {
|
|
37013
|
-
const $ = c(
|
|
37018
|
+
const $ = c(26);
|
|
37014
37019
|
const {
|
|
37015
37020
|
value,
|
|
37016
37021
|
onValueChange,
|
|
@@ -37018,35 +37023,149 @@ function Tabs(t0) {
|
|
|
37018
37023
|
innerClassName,
|
|
37019
37024
|
children
|
|
37020
37025
|
} = t0;
|
|
37026
|
+
const scrollContainerRef = useRef(null);
|
|
37027
|
+
const [showLeftScroll, setShowLeftScroll] = useState(false);
|
|
37028
|
+
const [showRightScroll, setShowRightScroll] = useState(false);
|
|
37029
|
+
const [isScrollable, setIsScrollable] = useState(false);
|
|
37021
37030
|
let t1;
|
|
37022
|
-
if ($[0]
|
|
37023
|
-
t1 =
|
|
37024
|
-
|
|
37025
|
-
|
|
37031
|
+
if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
37032
|
+
t1 = () => {
|
|
37033
|
+
if (scrollContainerRef.current) {
|
|
37034
|
+
const {
|
|
37035
|
+
scrollLeft,
|
|
37036
|
+
scrollWidth,
|
|
37037
|
+
clientWidth
|
|
37038
|
+
} = scrollContainerRef.current;
|
|
37039
|
+
setShowLeftScroll(scrollLeft > 0);
|
|
37040
|
+
setShowRightScroll(Math.ceil(scrollLeft + clientWidth) < scrollWidth);
|
|
37041
|
+
setIsScrollable(scrollWidth > clientWidth);
|
|
37042
|
+
}
|
|
37043
|
+
};
|
|
37044
|
+
$[0] = t1;
|
|
37026
37045
|
} else {
|
|
37027
|
-
t1 = $[
|
|
37046
|
+
t1 = $[0];
|
|
37028
37047
|
}
|
|
37048
|
+
const checkScroll = t1;
|
|
37029
37049
|
let t2;
|
|
37030
|
-
if ($[
|
|
37031
|
-
t2 =
|
|
37032
|
-
|
|
37033
|
-
|
|
37034
|
-
|
|
37050
|
+
if ($[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
37051
|
+
t2 = () => {
|
|
37052
|
+
checkScroll();
|
|
37053
|
+
window.addEventListener("resize", checkScroll);
|
|
37054
|
+
let observer;
|
|
37055
|
+
if (scrollContainerRef.current) {
|
|
37056
|
+
observer = new ResizeObserver(checkScroll);
|
|
37057
|
+
observer.observe(scrollContainerRef.current);
|
|
37058
|
+
if (scrollContainerRef.current.firstElementChild) {
|
|
37059
|
+
observer.observe(scrollContainerRef.current.firstElementChild);
|
|
37060
|
+
}
|
|
37061
|
+
}
|
|
37062
|
+
return () => {
|
|
37063
|
+
window.removeEventListener("resize", checkScroll);
|
|
37064
|
+
observer?.disconnect();
|
|
37065
|
+
};
|
|
37066
|
+
};
|
|
37067
|
+
$[1] = t2;
|
|
37035
37068
|
} else {
|
|
37036
|
-
t2 = $[
|
|
37069
|
+
t2 = $[1];
|
|
37037
37070
|
}
|
|
37038
37071
|
let t3;
|
|
37039
|
-
if ($[
|
|
37040
|
-
t3 =
|
|
37072
|
+
if ($[2] !== children) {
|
|
37073
|
+
t3 = [children];
|
|
37074
|
+
$[2] = children;
|
|
37075
|
+
$[3] = t3;
|
|
37076
|
+
} else {
|
|
37077
|
+
t3 = $[3];
|
|
37078
|
+
}
|
|
37079
|
+
useEffect(t2, t3);
|
|
37080
|
+
let t4;
|
|
37081
|
+
if ($[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
37082
|
+
t4 = (direction) => {
|
|
37083
|
+
if (scrollContainerRef.current) {
|
|
37084
|
+
const container = scrollContainerRef.current;
|
|
37085
|
+
const scrollAmount = Math.max(container.clientWidth / 2, 200);
|
|
37086
|
+
const targetScroll = container.scrollLeft + (direction === "left" ? -scrollAmount : scrollAmount);
|
|
37087
|
+
container.scrollTo({
|
|
37088
|
+
left: targetScroll,
|
|
37089
|
+
behavior: "smooth"
|
|
37090
|
+
});
|
|
37091
|
+
}
|
|
37092
|
+
};
|
|
37093
|
+
$[4] = t4;
|
|
37094
|
+
} else {
|
|
37095
|
+
t4 = $[4];
|
|
37096
|
+
}
|
|
37097
|
+
const scroll = t4;
|
|
37098
|
+
let t5;
|
|
37099
|
+
if ($[5] !== className) {
|
|
37100
|
+
t5 = cls("flex flex-row items-center min-w-0", className);
|
|
37041
37101
|
$[5] = className;
|
|
37042
|
-
$[6] =
|
|
37043
|
-
$[7] = t2;
|
|
37044
|
-
$[8] = value;
|
|
37045
|
-
$[9] = t3;
|
|
37102
|
+
$[6] = t5;
|
|
37046
37103
|
} else {
|
|
37047
|
-
|
|
37104
|
+
t5 = $[6];
|
|
37048
37105
|
}
|
|
37049
|
-
|
|
37106
|
+
let t6;
|
|
37107
|
+
if ($[7] !== isScrollable || $[8] !== showLeftScroll) {
|
|
37108
|
+
t6 = isScrollable && /* @__PURE__ */ 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__ */ jsx(ChevronLeftIcon, { size: "small" }) });
|
|
37109
|
+
$[7] = isScrollable;
|
|
37110
|
+
$[8] = showLeftScroll;
|
|
37111
|
+
$[9] = t6;
|
|
37112
|
+
} else {
|
|
37113
|
+
t6 = $[9];
|
|
37114
|
+
}
|
|
37115
|
+
let t7;
|
|
37116
|
+
if ($[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
37117
|
+
t7 = {
|
|
37118
|
+
scrollbarWidth: "none",
|
|
37119
|
+
msOverflowStyle: "none"
|
|
37120
|
+
};
|
|
37121
|
+
$[10] = t7;
|
|
37122
|
+
} else {
|
|
37123
|
+
t7 = $[10];
|
|
37124
|
+
}
|
|
37125
|
+
let t8;
|
|
37126
|
+
if ($[11] !== innerClassName) {
|
|
37127
|
+
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);
|
|
37128
|
+
$[11] = innerClassName;
|
|
37129
|
+
$[12] = t8;
|
|
37130
|
+
} else {
|
|
37131
|
+
t8 = $[12];
|
|
37132
|
+
}
|
|
37133
|
+
let t9;
|
|
37134
|
+
if ($[13] !== children || $[14] !== t8) {
|
|
37135
|
+
t9 = /* @__PURE__ */ jsx("div", { ref: scrollContainerRef, className: "flex-1 overflow-x-auto no-scrollbar min-w-0", onScroll: checkScroll, style: t7, children: /* @__PURE__ */ jsx(TabsPrimitive.List, { className: t8, children }) });
|
|
37136
|
+
$[13] = children;
|
|
37137
|
+
$[14] = t8;
|
|
37138
|
+
$[15] = t9;
|
|
37139
|
+
} else {
|
|
37140
|
+
t9 = $[15];
|
|
37141
|
+
}
|
|
37142
|
+
let t10;
|
|
37143
|
+
if ($[16] !== isScrollable || $[17] !== showRightScroll) {
|
|
37144
|
+
t10 = isScrollable && /* @__PURE__ */ 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__ */ jsx(ChevronRightIcon, { size: "small" }) });
|
|
37145
|
+
$[16] = isScrollable;
|
|
37146
|
+
$[17] = showRightScroll;
|
|
37147
|
+
$[18] = t10;
|
|
37148
|
+
} else {
|
|
37149
|
+
t10 = $[18];
|
|
37150
|
+
}
|
|
37151
|
+
let t11;
|
|
37152
|
+
if ($[19] !== onValueChange || $[20] !== t10 || $[21] !== t5 || $[22] !== t6 || $[23] !== t9 || $[24] !== value) {
|
|
37153
|
+
t11 = /* @__PURE__ */ jsxs(TabsPrimitive.Root, { value, onValueChange, className: t5, children: [
|
|
37154
|
+
t6,
|
|
37155
|
+
t9,
|
|
37156
|
+
t10
|
|
37157
|
+
] });
|
|
37158
|
+
$[19] = onValueChange;
|
|
37159
|
+
$[20] = t10;
|
|
37160
|
+
$[21] = t5;
|
|
37161
|
+
$[22] = t6;
|
|
37162
|
+
$[23] = t9;
|
|
37163
|
+
$[24] = value;
|
|
37164
|
+
$[25] = t11;
|
|
37165
|
+
} else {
|
|
37166
|
+
t11 = $[25];
|
|
37167
|
+
}
|
|
37168
|
+
return t11;
|
|
37050
37169
|
}
|
|
37051
37170
|
function Tab(t0) {
|
|
37052
37171
|
const $ = c(8);
|
|
@@ -37520,7 +37639,7 @@ const Badge = React__default.forwardRef((t0, ref) => {
|
|
|
37520
37639
|
Badge.displayName = "Badge";
|
|
37521
37640
|
function DebouncedTextField(props) {
|
|
37522
37641
|
const $ = c(13);
|
|
37523
|
-
const previousEventRef = React__default.useRef();
|
|
37642
|
+
const previousEventRef = React__default.useRef(void 0);
|
|
37524
37643
|
const [internalValue, setInternalValue] = React__default.useState(props.value);
|
|
37525
37644
|
const deferredValue = useDeferredValue(internalValue);
|
|
37526
37645
|
let t0;
|