pixelplay 1.0.13 → 1.1.1

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.js CHANGED
@@ -1989,6 +1989,7 @@ function Select({
1989
1989
  }) {
1990
1990
  const [open, setOpen] = (0, import_react12.useState)(false);
1991
1991
  const [search, setSearch] = (0, import_react12.useState)("");
1992
+ const [openAbove, setOpenAbove] = (0, import_react12.useState)(false);
1992
1993
  const containerRef = (0, import_react12.useRef)(null);
1993
1994
  (0, import_react12.useEffect)(() => {
1994
1995
  function onOutsideClick(e) {
@@ -2000,6 +2001,21 @@ function Select({
2000
2001
  document.addEventListener("mousedown", onOutsideClick);
2001
2002
  return () => document.removeEventListener("mousedown", onOutsideClick);
2002
2003
  }, []);
2004
+ const computeOpenAbove = (0, import_react12.useCallback)(() => {
2005
+ if (!containerRef.current) return false;
2006
+ const rect = containerRef.current.getBoundingClientRect();
2007
+ const spaceBelow = window.innerHeight - rect.bottom;
2008
+ const panelHeight = 280;
2009
+ return spaceBelow < panelHeight && rect.top > spaceBelow;
2010
+ }, []);
2011
+ const toggleOpen = (0, import_react12.useCallback)(() => {
2012
+ setOpen((prev) => {
2013
+ if (!prev) {
2014
+ setOpenAbove(computeOpenAbove());
2015
+ }
2016
+ return !prev;
2017
+ });
2018
+ }, [computeOpenAbove]);
2003
2019
  const selectedOption = options.find((o) => o.value === value);
2004
2020
  const filtered = isSearchable ? options.filter(
2005
2021
  (o) => o.label.toLowerCase().includes(search.toLowerCase())
@@ -2019,7 +2035,7 @@ function Select({
2019
2035
  {
2020
2036
  type: "button",
2021
2037
  disabled: isDisabled,
2022
- onClick: () => !isDisabled && setOpen((v) => !v),
2038
+ onClick: () => !isDisabled && toggleOpen(),
2023
2039
  className: cn(
2024
2040
  "flex w-full items-center rounded-lg border transition-all",
2025
2041
  "bg-[var(--surface-container-lowest)] border-[var(--outline)]",
@@ -2055,7 +2071,8 @@ function Select({
2055
2071
  "div",
2056
2072
  {
2057
2073
  className: cn(
2058
- "absolute left-0 top-full z-50 mt-1 w-full overflow-hidden rounded-lg",
2074
+ "absolute left-0 z-50 w-full overflow-hidden rounded-lg",
2075
+ openAbove ? "bottom-full mb-1" : "top-full mt-1",
2059
2076
  "bg-[var(--surface-container-lowest)]",
2060
2077
  "shadow-[0px_4px_6px_-2px_rgba(10,13,18,0.05),0px_12px_16px_-4px_rgba(10,13,18,0.10)]",
2061
2078
  "outline outline-1 outline-offset-[-1px] outline-[var(--outline)]"
@@ -7332,63 +7349,63 @@ function getHourLabels() {
7332
7349
  var HOUR_LABELS = getHourLabels();
7333
7350
  var colorMap3 = {
7334
7351
  neutral: {
7335
- chip: "bg-[var(--utility-neutral-50,#f9fafb)] ring-[var(--utility-neutral-200,#e5e7eb)] hover:bg-[var(--utility-neutral-100,#f3f4f6)]",
7336
- dot: "bg-[var(--utility-neutral-500,#6b7280)]",
7337
- text: "text-[var(--utility-neutral-700,#374151)]",
7338
- time: "text-[var(--utility-neutral-600,#4b5563)]"
7352
+ chip: "bg-[var(--surface-container-low)] ring-[var(--outline-variant)] hover:bg-[var(--surface-container)]",
7353
+ dot: "bg-[var(--on-surface-variant)]",
7354
+ text: "text-[var(--on-surface)]",
7355
+ time: "text-[var(--on-surface-variant)]"
7339
7356
  },
7340
7357
  blue: {
7341
- chip: "bg-[var(--utility-blue-50,#eff6ff)] ring-[var(--utility-blue-200,#bfdbfe)] hover:bg-[var(--utility-blue-100,#dbeafe)]",
7342
- dot: "bg-[var(--utility-blue-500,#3b82f6)]",
7343
- text: "text-[var(--utility-blue-700,#1d4ed8)]",
7344
- time: "text-[var(--utility-blue-600,#2563eb)]"
7358
+ chip: "bg-[var(--graphic-1-container)] ring-[var(--graphic-1)] hover:bg-[var(--graphic-1-container)]",
7359
+ dot: "bg-[var(--graphic-1)]",
7360
+ text: "text-[var(--on-graphic-1-container)]",
7361
+ time: "text-[var(--on-graphic-1-container)]"
7345
7362
  },
7346
7363
  green: {
7347
- chip: "bg-[var(--utility-green-50,#f0fdf4)] ring-[var(--utility-green-200,#bbf7d0)] hover:bg-[var(--utility-green-100,#dcfce7)]",
7348
- dot: "bg-[var(--utility-green-500,#22c55e)]",
7349
- text: "text-[var(--utility-green-700,#15803d)]",
7350
- time: "text-[var(--utility-green-600,#16a34a)]"
7364
+ chip: "bg-[var(--graphic-2-container)] ring-[var(--graphic-2)] hover:bg-[var(--graphic-2-container)]",
7365
+ dot: "bg-[var(--graphic-2)]",
7366
+ text: "text-[var(--on-graphic-2-container)]",
7367
+ time: "text-[var(--on-graphic-2-container)]"
7351
7368
  },
7352
7369
  purple: {
7353
- chip: "bg-[var(--utility-purple-50,#faf5ff)] ring-[var(--utility-purple-200,#e9d5ff)] hover:bg-[var(--utility-purple-100,#f3e8ff)]",
7354
- dot: "bg-[var(--utility-purple-500,#a855f7)]",
7355
- text: "text-[var(--utility-purple-700,#7e22ce)]",
7356
- time: "text-[var(--utility-purple-600,#9333ea)]"
7370
+ chip: "bg-[var(--graphic-3-container)] ring-[var(--graphic-3)] hover:bg-[var(--graphic-3-container)]",
7371
+ dot: "bg-[var(--graphic-3)]",
7372
+ text: "text-[var(--on-graphic-3-container)]",
7373
+ time: "text-[var(--on-graphic-3-container)]"
7357
7374
  },
7358
7375
  orange: {
7359
- chip: "bg-[var(--utility-orange-50,#fff7ed)] ring-[var(--utility-orange-200,#fed7aa)] hover:bg-[var(--utility-orange-100,#ffedd5)]",
7360
- dot: "bg-[var(--utility-orange-500,#f97316)]",
7361
- text: "text-[var(--utility-orange-700,#c2410c)]",
7362
- time: "text-[var(--utility-orange-600,#ea580c)]"
7376
+ chip: "bg-[var(--graphic-4-container)] ring-[var(--graphic-4)] hover:bg-[var(--graphic-4-container)]",
7377
+ dot: "bg-[var(--graphic-4)]",
7378
+ text: "text-[var(--on-graphic-4-container)]",
7379
+ time: "text-[var(--on-graphic-4-container)]"
7363
7380
  },
7364
7381
  pink: {
7365
- chip: "bg-[var(--utility-pink-50,#fdf2f8)] ring-[var(--utility-pink-200,#fbcfe8)] hover:bg-[var(--utility-pink-100,#fce7f3)]",
7366
- dot: "bg-[var(--utility-pink-500,#ec4899)]",
7367
- text: "text-[var(--utility-pink-700,#be185d)]",
7368
- time: "text-[var(--utility-pink-600,#db2777)]"
7382
+ chip: "bg-[var(--graphic-5-container)] ring-[var(--graphic-5)] hover:bg-[var(--graphic-5-container)]",
7383
+ dot: "bg-[var(--graphic-5)]",
7384
+ text: "text-[var(--on-graphic-5-container)]",
7385
+ time: "text-[var(--on-graphic-5-container)]"
7369
7386
  },
7370
7387
  red: {
7371
- chip: "bg-[var(--utility-red-50,#fef2f2)] ring-[var(--utility-red-200,#fecaca)] hover:bg-[var(--utility-red-100,#fee2e2)]",
7372
- dot: "bg-[var(--utility-red-500,#ef4444)]",
7373
- text: "text-[var(--utility-red-700,#b91c1c)]",
7374
- time: "text-[var(--utility-red-600,#dc2626)]"
7388
+ chip: "bg-[var(--graphic-6-container)] ring-[var(--graphic-6)] hover:bg-[var(--graphic-6-container)]",
7389
+ dot: "bg-[var(--graphic-6)]",
7390
+ text: "text-[var(--on-graphic-6-container)]",
7391
+ time: "text-[var(--on-graphic-6-container)]"
7375
7392
  },
7376
7393
  yellow: {
7377
- chip: "bg-[var(--utility-yellow-50,#fefce8)] ring-[var(--utility-yellow-200,#fef08a)] hover:bg-[var(--utility-yellow-100,#fef9c3)]",
7378
- dot: "bg-[var(--utility-yellow-500,#eab308)]",
7379
- text: "text-[var(--utility-yellow-700,#a16207)]",
7380
- time: "text-[var(--utility-yellow-600,#ca8a04)]"
7394
+ chip: "bg-[var(--graphic-7-container)] ring-[var(--graphic-7)] hover:bg-[var(--graphic-7-container)]",
7395
+ dot: "bg-[var(--graphic-7)]",
7396
+ text: "text-[var(--on-graphic-7-container)]",
7397
+ time: "text-[var(--on-graphic-7-container)]"
7381
7398
  }
7382
7399
  };
7383
7400
  var cardColorMap = {
7384
- neutral: "bg-[var(--utility-neutral-50,#f9fafb)] ring-[var(--utility-neutral-200,#e5e7eb)] text-[var(--utility-neutral-700,#374151)]",
7385
- blue: "bg-[var(--utility-blue-50,#eff6ff)] ring-[var(--utility-blue-200,#bfdbfe)] text-[var(--utility-blue-700,#1d4ed8)]",
7386
- green: "bg-[var(--utility-green-50,#f0fdf4)] ring-[var(--utility-green-200,#bbf7d0)] text-[var(--utility-green-700,#15803d)]",
7387
- purple: "bg-[var(--utility-purple-50,#faf5ff)] ring-[var(--utility-purple-200,#e9d5ff)] text-[var(--utility-purple-700,#7e22ce)]",
7388
- orange: "bg-[var(--utility-orange-50,#fff7ed)] ring-[var(--utility-orange-200,#fed7aa)] text-[var(--utility-orange-700,#c2410c)]",
7389
- pink: "bg-[var(--utility-pink-50,#fdf2f8)] ring-[var(--utility-pink-200,#fbcfe8)] text-[var(--utility-pink-700,#be185d)]",
7390
- red: "bg-[var(--utility-red-50,#fef2f2)] ring-[var(--utility-red-200,#fecaca)] text-[var(--utility-red-700,#b91c1c)]",
7391
- yellow: "bg-[var(--utility-yellow-50,#fefce8)] ring-[var(--utility-yellow-200,#fef08a)] text-[var(--utility-yellow-700,#a16207)]"
7401
+ neutral: "bg-[var(--surface-container-low)] ring-[var(--outline-variant)] text-[var(--on-surface)]",
7402
+ blue: "bg-[var(--graphic-1-container)] ring-[var(--graphic-1)] text-[var(--on-graphic-1-container)]",
7403
+ green: "bg-[var(--graphic-2-container)] ring-[var(--graphic-2)] text-[var(--on-graphic-2-container)]",
7404
+ purple: "bg-[var(--graphic-3-container)] ring-[var(--graphic-3)] text-[var(--on-graphic-3-container)]",
7405
+ orange: "bg-[var(--graphic-4-container)] ring-[var(--graphic-4)] text-[var(--on-graphic-4-container)]",
7406
+ pink: "bg-[var(--graphic-5-container)] ring-[var(--graphic-5)] text-[var(--on-graphic-5-container)]",
7407
+ red: "bg-[var(--graphic-6-container)] ring-[var(--graphic-6)] text-[var(--on-graphic-6-container)]",
7408
+ yellow: "bg-[var(--graphic-7-container)] ring-[var(--graphic-7)] text-[var(--on-graphic-7-container)]"
7392
7409
  };
7393
7410
  function EventChip({
7394
7411
  event,
@@ -7716,11 +7733,13 @@ function WeekView({
7716
7733
  const top = startMins / 60 * CELL_HEIGHT;
7717
7734
  const height = durationMins / 60 * CELL_HEIGHT;
7718
7735
  const c = cardColorMap[(_a = ev.color) != null ? _a : "neutral"];
7719
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
7736
+ const isCompact = durationMins <= 30;
7737
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
7720
7738
  "div",
7721
7739
  {
7722
7740
  className: cn(
7723
- "absolute pointer-events-auto z-10 rounded-md px-2 py-1 ring-1 ring-inset cursor-pointer overflow-hidden",
7741
+ "absolute pointer-events-auto z-10 rounded-md ring-1 ring-inset cursor-pointer overflow-hidden",
7742
+ isCompact ? "px-2 py-0.5" : "px-2 py-1",
7724
7743
  c
7725
7744
  ),
7726
7745
  style: {
@@ -7733,13 +7752,19 @@ function WeekView({
7733
7752
  e.stopPropagation();
7734
7753
  onEventClick == null ? void 0 : onEventClick(ev);
7735
7754
  },
7736
- children: [
7755
+ children: isCompact ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("p", { className: "text-xs font-semibold truncate leading-tight", children: [
7756
+ ev.title,
7757
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("span", { className: "font-normal opacity-75", children: [
7758
+ " \xB7 ",
7759
+ formatTime12(ev.startTime)
7760
+ ] })
7761
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
7737
7762
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "text-xs font-semibold truncate", children: ev.title }),
7738
7763
  /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("p", { className: "text-xs opacity-75", children: [
7739
7764
  formatTime12(ev.startTime),
7740
7765
  ev.endTime && ` \u2013 ${formatTime12(ev.endTime)}`
7741
7766
  ] })
7742
- ]
7767
+ ] })
7743
7768
  },
7744
7769
  ev.id
7745
7770
  );
@@ -8087,41 +8112,60 @@ function ViewDropdown({
8087
8112
  onViewChange
8088
8113
  }) {
8089
8114
  const [open, setOpen] = (0, import_react31.useState)(false);
8115
+ const [dropdownStyle, setDropdownStyle] = (0, import_react31.useState)({});
8116
+ const wrapperRef = (0, import_react31.useRef)(null);
8090
8117
  const labels = {
8091
8118
  month: "Month view",
8092
8119
  week: "Week view",
8093
8120
  day: "Day view"
8094
8121
  };
8095
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "relative", children: [
8122
+ const handleToggle = () => {
8123
+ if (!open && wrapperRef.current) {
8124
+ const rect = wrapperRef.current.getBoundingClientRect();
8125
+ setDropdownStyle({
8126
+ top: rect.bottom + 4,
8127
+ right: window.innerWidth - rect.right
8128
+ });
8129
+ }
8130
+ setOpen((o) => !o);
8131
+ };
8132
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "relative", ref: wrapperRef, children: [
8096
8133
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
8097
8134
  Button,
8098
8135
  {
8099
8136
  variant: "bordered",
8100
8137
  size: "sm",
8101
8138
  endContent: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_feather14.ChevronDown, { size: 14 }),
8102
- onClick: () => setOpen((o) => !o),
8139
+ onClick: handleToggle,
8103
8140
  "aria-haspopup": "true",
8104
8141
  "aria-expanded": open,
8105
8142
  children: labels[view]
8106
8143
  }
8107
8144
  ),
8108
8145
  open && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
8109
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "fixed inset-0 z-20", onClick: () => setOpen(false) }),
8110
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "absolute right-0 top-full z-30 mt-1 w-40 overflow-hidden rounded-lg border border-[var(--outline-variant)] bg-[var(--surface)] shadow-lg", children: ["month", "week", "day"].map((v) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
8111
- "button",
8146
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "fixed inset-0 z-40", onClick: () => setOpen(false) }),
8147
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
8148
+ "div",
8112
8149
  {
8113
- className: cn(
8114
- "flex w-full items-center px-3 py-2 text-sm font-medium transition-colors",
8115
- v === view ? "bg-[var(--surface-container-low,var(--surface-dim))] text-[var(--on-surface)]" : "text-[var(--on-surface-variant)] hover:bg-[var(--surface-container-low,var(--surface-dim))] hover:text-[var(--on-surface)]"
8116
- ),
8117
- onClick: () => {
8118
- onViewChange(v);
8119
- setOpen(false);
8120
- },
8121
- children: labels[v]
8122
- },
8123
- v
8124
- )) })
8150
+ className: "fixed z-50 w-40 overflow-hidden rounded-lg border border-[var(--outline-variant)] bg-[var(--surface)] shadow-lg",
8151
+ style: dropdownStyle,
8152
+ children: ["month", "week", "day"].map((v) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
8153
+ "button",
8154
+ {
8155
+ className: cn(
8156
+ "flex w-full items-center px-3 py-2 text-sm font-medium transition-colors",
8157
+ v === view ? "bg-[var(--surface-container-low,var(--surface-dim))] text-[var(--on-surface)]" : "text-[var(--on-surface-variant)] hover:bg-[var(--surface-container-low,var(--surface-dim))] hover:text-[var(--on-surface)]"
8158
+ ),
8159
+ onClick: () => {
8160
+ onViewChange(v);
8161
+ setOpen(false);
8162
+ },
8163
+ children: labels[v]
8164
+ },
8165
+ v
8166
+ ))
8167
+ }
8168
+ )
8125
8169
  ] })
8126
8170
  ] });
8127
8171
  }