@underverse-ui/underverse 1.0.11 → 1.0.13

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.cjs CHANGED
@@ -10948,13 +10948,28 @@ function CalendarTimeline({
10948
10948
  const colMax = maxResourceColumnWidth ?? 520;
10949
10949
  const rowMin = minRowHeight ?? 36;
10950
10950
  const rowMax = maxRowHeight ?? 120;
10951
- const availableViews = React33.useMemo(
10952
- () => onlyView ? [onlyView] : ["month", "week", "day", "sprint"],
10953
- [onlyView]
10954
- );
10955
- const isControlledView = view !== void 0;
10956
- const [internalView, setInternalView] = React33.useState(() => onlyView ?? defaultView);
10951
+ const viewList = React33.useMemo(() => Array.isArray(view) ? view : void 0, [view]);
10952
+ const availableViews = React33.useMemo(() => {
10953
+ if (onlyView) return [onlyView];
10954
+ if (viewList?.length) return viewList;
10955
+ return ["month", "week", "day", "sprint"];
10956
+ }, [onlyView, viewList]);
10957
+ const isControlledView = view !== void 0 && !Array.isArray(view);
10958
+ const [internalView, setInternalView] = React33.useState(() => {
10959
+ if (onlyView) return onlyView;
10960
+ if (viewList?.length) {
10961
+ if (defaultView && viewList.includes(defaultView)) return defaultView;
10962
+ return viewList[0] ?? defaultView ?? "month";
10963
+ }
10964
+ return defaultView ?? "month";
10965
+ });
10957
10966
  const activeView = onlyView ? onlyView : isControlledView ? view : internalView;
10967
+ React33.useEffect(() => {
10968
+ if (onlyView || isControlledView) return;
10969
+ if (!availableViews.includes(internalView)) {
10970
+ setInternalView(availableViews[0] ?? "month");
10971
+ }
10972
+ }, [availableViews, internalView, isControlledView, onlyView]);
10958
10973
  const effectiveSlotMinWidth = React33.useMemo(() => {
10959
10974
  if (slotMinWidth == null) {
10960
10975
  if (activeView === "month" && monthEventStyle === "compact") {
@@ -10996,10 +11011,11 @@ function CalendarTimeline({
10996
11011
  const setView = React33.useCallback(
10997
11012
  (next) => {
10998
11013
  if (onlyView) return;
11014
+ if (!availableViews.includes(next)) return;
10999
11015
  if (!isControlledView) setInternalView(next);
11000
11016
  onViewChange?.(next);
11001
11017
  },
11002
- [isControlledView, onViewChange, onlyView]
11018
+ [availableViews, isControlledView, onViewChange, onlyView]
11003
11019
  );
11004
11020
  const setDate = React33.useCallback(
11005
11021
  (next) => {
@@ -13944,8 +13960,8 @@ function CategoryTreeSelect(props) {
13944
13960
  };
13945
13961
  const renderSearch = () => {
13946
13962
  if (!isSearchEnabled) return null;
13947
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "sticky top-0 z-10 border-b border-border/30 bg-popover/85 backdrop-blur-xl px-2.5 py-2.5", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "relative", children: [
13948
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground/60 transition-colors peer-focus:text-primary" }),
13963
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "sticky top-0 z-10 bg-popover/85 backdrop-blur-xl pb-2", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "relative", children: [
13964
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_lucide_react25.Search, { className: "absolute left-3.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground/60 transition-colors peer-focus:text-primary" }),
13949
13965
  /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
13950
13966
  "input",
13951
13967
  {
@@ -13954,8 +13970,8 @@ function CategoryTreeSelect(props) {
13954
13970
  onChange: (e) => setQuery(e.target.value),
13955
13971
  placeholder: mergedLabels.searchPlaceholder,
13956
13972
  className: cn(
13957
- "peer w-full rounded-full bg-muted/40 py-2.5 pl-9 pr-9 text-sm",
13958
- "border border-transparent",
13973
+ "peer w-full rounded-full bg-muted/40 py-2.5 pl-10 pr-10 text-sm",
13974
+ "border border-border/30",
13959
13975
  "focus:outline-none focus:bg-background focus:border-primary/30 focus:ring-2 focus:ring-primary/10",
13960
13976
  "transition-all duration-200",
13961
13977
  "placeholder:text-muted-foreground/50"