@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.d.cts CHANGED
@@ -1192,7 +1192,13 @@ interface CalendarTimelineProps<TResourceMeta = unknown, TEventMeta = unknown> e
1192
1192
  * When set, `view`/`defaultView` are ignored.
1193
1193
  */
1194
1194
  onlyView?: CalendarTimelineView;
1195
- view?: CalendarTimelineView;
1195
+ /**
1196
+ * Active view (controlled) or allowed views list.
1197
+ * - string: controls the current view
1198
+ * - array: restricts which views are shown; the active view falls back to
1199
+ * `defaultView` (if included) or the first entry.
1200
+ */
1201
+ view?: CalendarTimelineView | CalendarTimelineView[];
1196
1202
  defaultView?: CalendarTimelineView;
1197
1203
  onViewChange?: (view: CalendarTimelineView) => void;
1198
1204
  /**
package/dist/index.d.ts CHANGED
@@ -1192,7 +1192,13 @@ interface CalendarTimelineProps<TResourceMeta = unknown, TEventMeta = unknown> e
1192
1192
  * When set, `view`/`defaultView` are ignored.
1193
1193
  */
1194
1194
  onlyView?: CalendarTimelineView;
1195
- view?: CalendarTimelineView;
1195
+ /**
1196
+ * Active view (controlled) or allowed views list.
1197
+ * - string: controls the current view
1198
+ * - array: restricts which views are shown; the active view falls back to
1199
+ * `defaultView` (if included) or the first entry.
1200
+ */
1201
+ view?: CalendarTimelineView | CalendarTimelineView[];
1196
1202
  defaultView?: CalendarTimelineView;
1197
1203
  onViewChange?: (view: CalendarTimelineView) => void;
1198
1204
  /**
package/dist/index.js CHANGED
@@ -10770,13 +10770,28 @@ function CalendarTimeline({
10770
10770
  const colMax = maxResourceColumnWidth ?? 520;
10771
10771
  const rowMin = minRowHeight ?? 36;
10772
10772
  const rowMax = maxRowHeight ?? 120;
10773
- const availableViews = React33.useMemo(
10774
- () => onlyView ? [onlyView] : ["month", "week", "day", "sprint"],
10775
- [onlyView]
10776
- );
10777
- const isControlledView = view !== void 0;
10778
- const [internalView, setInternalView] = React33.useState(() => onlyView ?? defaultView);
10773
+ const viewList = React33.useMemo(() => Array.isArray(view) ? view : void 0, [view]);
10774
+ const availableViews = React33.useMemo(() => {
10775
+ if (onlyView) return [onlyView];
10776
+ if (viewList?.length) return viewList;
10777
+ return ["month", "week", "day", "sprint"];
10778
+ }, [onlyView, viewList]);
10779
+ const isControlledView = view !== void 0 && !Array.isArray(view);
10780
+ const [internalView, setInternalView] = React33.useState(() => {
10781
+ if (onlyView) return onlyView;
10782
+ if (viewList?.length) {
10783
+ if (defaultView && viewList.includes(defaultView)) return defaultView;
10784
+ return viewList[0] ?? defaultView ?? "month";
10785
+ }
10786
+ return defaultView ?? "month";
10787
+ });
10779
10788
  const activeView = onlyView ? onlyView : isControlledView ? view : internalView;
10789
+ React33.useEffect(() => {
10790
+ if (onlyView || isControlledView) return;
10791
+ if (!availableViews.includes(internalView)) {
10792
+ setInternalView(availableViews[0] ?? "month");
10793
+ }
10794
+ }, [availableViews, internalView, isControlledView, onlyView]);
10780
10795
  const effectiveSlotMinWidth = React33.useMemo(() => {
10781
10796
  if (slotMinWidth == null) {
10782
10797
  if (activeView === "month" && monthEventStyle === "compact") {
@@ -10818,10 +10833,11 @@ function CalendarTimeline({
10818
10833
  const setView = React33.useCallback(
10819
10834
  (next) => {
10820
10835
  if (onlyView) return;
10836
+ if (!availableViews.includes(next)) return;
10821
10837
  if (!isControlledView) setInternalView(next);
10822
10838
  onViewChange?.(next);
10823
10839
  },
10824
- [isControlledView, onViewChange, onlyView]
10840
+ [availableViews, isControlledView, onViewChange, onlyView]
10825
10841
  );
10826
10842
  const setDate = React33.useCallback(
10827
10843
  (next) => {
@@ -13766,8 +13782,8 @@ function CategoryTreeSelect(props) {
13766
13782
  };
13767
13783
  const renderSearch = () => {
13768
13784
  if (!isSearchEnabled) return null;
13769
- return /* @__PURE__ */ jsx44("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__ */ jsxs39("div", { className: "relative", children: [
13770
- /* @__PURE__ */ jsx44(Search5, { 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" }),
13785
+ return /* @__PURE__ */ jsx44("div", { className: "sticky top-0 z-10 bg-popover/85 backdrop-blur-xl pb-2", children: /* @__PURE__ */ jsxs39("div", { className: "relative", children: [
13786
+ /* @__PURE__ */ jsx44(Search5, { 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" }),
13771
13787
  /* @__PURE__ */ jsx44(
13772
13788
  "input",
13773
13789
  {
@@ -13776,8 +13792,8 @@ function CategoryTreeSelect(props) {
13776
13792
  onChange: (e) => setQuery(e.target.value),
13777
13793
  placeholder: mergedLabels.searchPlaceholder,
13778
13794
  className: cn(
13779
- "peer w-full rounded-full bg-muted/40 py-2.5 pl-9 pr-9 text-sm",
13780
- "border border-transparent",
13795
+ "peer w-full rounded-full bg-muted/40 py-2.5 pl-10 pr-10 text-sm",
13796
+ "border border-border/30",
13781
13797
  "focus:outline-none focus:bg-background focus:border-primary/30 focus:ring-2 focus:ring-primary/10",
13782
13798
  "transition-all duration-200",
13783
13799
  "placeholder:text-muted-foreground/50"