pixelplay 1.0.15 → 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/CHANGELOG.md +146 -61
- package/README.md +91 -91
- package/dist/index.js +107 -63
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +129 -85
- package/dist/index.mjs.map +1 -1
- package/dist/server.js.map +1 -1
- package/dist/server.mjs.map +1 -1
- package/package.json +75 -80
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 &&
|
|
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
|
|
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(--
|
|
7336
|
-
dot: "bg-[var(--
|
|
7337
|
-
text: "text-[var(--
|
|
7338
|
-
time: "text-[var(--
|
|
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(--
|
|
7342
|
-
dot: "bg-[var(--
|
|
7343
|
-
text: "text-[var(--
|
|
7344
|
-
time: "text-[var(--
|
|
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(--
|
|
7348
|
-
dot: "bg-[var(--
|
|
7349
|
-
text: "text-[var(--
|
|
7350
|
-
time: "text-[var(--
|
|
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(--
|
|
7354
|
-
dot: "bg-[var(--
|
|
7355
|
-
text: "text-[var(--
|
|
7356
|
-
time: "text-[var(--
|
|
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(--
|
|
7360
|
-
dot: "bg-[var(--
|
|
7361
|
-
text: "text-[var(--
|
|
7362
|
-
time: "text-[var(--
|
|
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(--
|
|
7366
|
-
dot: "bg-[var(--
|
|
7367
|
-
text: "text-[var(--
|
|
7368
|
-
time: "text-[var(--
|
|
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(--
|
|
7372
|
-
dot: "bg-[var(--
|
|
7373
|
-
text: "text-[var(--
|
|
7374
|
-
time: "text-[var(--
|
|
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(--
|
|
7378
|
-
dot: "bg-[var(--
|
|
7379
|
-
text: "text-[var(--
|
|
7380
|
-
time: "text-[var(--
|
|
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(--
|
|
7385
|
-
blue: "bg-[var(--
|
|
7386
|
-
green: "bg-[var(--
|
|
7387
|
-
purple: "bg-[var(--
|
|
7388
|
-
orange: "bg-[var(--
|
|
7389
|
-
pink: "bg-[var(--
|
|
7390
|
-
red: "bg-[var(--
|
|
7391
|
-
yellow: "bg-[var(--
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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:
|
|
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-
|
|
8110
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
8111
|
-
"
|
|
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:
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
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
|
}
|