@pimolu/react 0.1.0-beta.4 → 0.1.0-beta.5
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/README.fr.md +1 -1
- package/README.md +1 -1
- package/dist/accordion/accordion.d.ts.map +1 -1
- package/dist/accordion/accordion.types.d.ts +2 -0
- package/dist/accordion/accordion.types.d.ts.map +1 -1
- package/dist/customization/customization.types.d.ts +1 -1
- package/dist/customization/customization.types.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1142 -1052
- package/dist/index.js.map +4 -4
- package/dist/navbar/navbar.d.ts +2 -1
- package/dist/navbar/navbar.d.ts.map +1 -1
- package/dist/navbar/navbar.types.d.ts +24 -1
- package/dist/navbar/navbar.types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -7140,13 +7140,55 @@ function Fieldset({
|
|
|
7140
7140
|
));
|
|
7141
7141
|
}
|
|
7142
7142
|
|
|
7143
|
+
// internal/use-presence.ts
|
|
7144
|
+
import { useEffect as useEffect18, useRef as useRef17, useState as useState20 } from "react";
|
|
7145
|
+
function prefersReducedMotion5() {
|
|
7146
|
+
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
7147
|
+
}
|
|
7148
|
+
function usePresence(open, exitDuration = 150) {
|
|
7149
|
+
const [rendered, setRendered] = useState20(open);
|
|
7150
|
+
const [state, setState] = useState20(
|
|
7151
|
+
"open"
|
|
7152
|
+
);
|
|
7153
|
+
const timer = useRef17(
|
|
7154
|
+
null
|
|
7155
|
+
);
|
|
7156
|
+
function cancel() {
|
|
7157
|
+
if (timer.current !== null) {
|
|
7158
|
+
clearTimeout(timer.current);
|
|
7159
|
+
timer.current = null;
|
|
7160
|
+
}
|
|
7161
|
+
}
|
|
7162
|
+
useEffect18(() => {
|
|
7163
|
+
if (open) {
|
|
7164
|
+
cancel();
|
|
7165
|
+
setRendered(true);
|
|
7166
|
+
setState("open");
|
|
7167
|
+
return;
|
|
7168
|
+
}
|
|
7169
|
+
if (!rendered) return;
|
|
7170
|
+
if (prefersReducedMotion5()) {
|
|
7171
|
+
setRendered(false);
|
|
7172
|
+
return;
|
|
7173
|
+
}
|
|
7174
|
+
setState("closing");
|
|
7175
|
+
timer.current = setTimeout(() => {
|
|
7176
|
+
setRendered(false);
|
|
7177
|
+
timer.current = null;
|
|
7178
|
+
}, exitDuration);
|
|
7179
|
+
return cancel;
|
|
7180
|
+
}, [open, rendered, exitDuration]);
|
|
7181
|
+
useEffect18(() => cancel, []);
|
|
7182
|
+
return { rendered, state };
|
|
7183
|
+
}
|
|
7184
|
+
|
|
7143
7185
|
// accordion/accordion.tsx
|
|
7144
7186
|
import {
|
|
7145
7187
|
createContext as createContext8,
|
|
7146
7188
|
useContext as useContext8,
|
|
7147
7189
|
useId as useId17,
|
|
7148
|
-
useRef as
|
|
7149
|
-
useState as
|
|
7190
|
+
useRef as useRef18,
|
|
7191
|
+
useState as useState21
|
|
7150
7192
|
} from "react";
|
|
7151
7193
|
|
|
7152
7194
|
// accordion/accordion.variants.ts
|
|
@@ -7217,20 +7259,21 @@ function Accordion(props) {
|
|
|
7217
7259
|
classNames,
|
|
7218
7260
|
children,
|
|
7219
7261
|
variant = "default",
|
|
7262
|
+
animated = true,
|
|
7220
7263
|
collapsible = false,
|
|
7221
7264
|
className
|
|
7222
7265
|
} = props;
|
|
7223
7266
|
const multiple = props.type === "multiple";
|
|
7224
7267
|
const controlledValue = props.value;
|
|
7225
|
-
const [singleValue, setSingleValue] =
|
|
7268
|
+
const [singleValue, setSingleValue] = useState21(
|
|
7226
7269
|
multiple ? void 0 : props.defaultValue
|
|
7227
7270
|
);
|
|
7228
|
-
const [multipleValue, setMultipleValue] =
|
|
7271
|
+
const [multipleValue, setMultipleValue] = useState21(
|
|
7229
7272
|
multiple ? props.defaultValue ?? [] : []
|
|
7230
7273
|
);
|
|
7231
7274
|
const value = controlledValue !== void 0 ? controlledValue : multiple ? multipleValue : singleValue;
|
|
7232
7275
|
const baseId = `pimolu-accordion-${useId17()}`;
|
|
7233
|
-
const rootRef =
|
|
7276
|
+
const rootRef = useRef18(null);
|
|
7234
7277
|
function isOpen(item) {
|
|
7235
7278
|
return multiple ? value.includes(item) : value === item;
|
|
7236
7279
|
}
|
|
@@ -7255,6 +7298,7 @@ function Accordion(props) {
|
|
|
7255
7298
|
AccordionContext.Provider,
|
|
7256
7299
|
{
|
|
7257
7300
|
value: {
|
|
7301
|
+
animated,
|
|
7258
7302
|
baseId,
|
|
7259
7303
|
variant,
|
|
7260
7304
|
isOpen,
|
|
@@ -7265,6 +7309,7 @@ function Accordion(props) {
|
|
|
7265
7309
|
"div",
|
|
7266
7310
|
{
|
|
7267
7311
|
ref: rootRef,
|
|
7312
|
+
"data-animated": animated,
|
|
7268
7313
|
className: mergeClasses(accordionVariants(
|
|
7269
7314
|
{ variant },
|
|
7270
7315
|
className
|
|
@@ -7375,6 +7420,9 @@ function AccordionContent({
|
|
|
7375
7420
|
}) {
|
|
7376
7421
|
const [partClasses, scopeParts] = usePartClasses("accordion", classNames, false);
|
|
7377
7422
|
const item = useAccordionItem("AccordionContent");
|
|
7423
|
+
const root = useAccordion("AccordionContent");
|
|
7424
|
+
const { rendered } = usePresence(item.open, root.animated ? 220 : 0);
|
|
7425
|
+
const closing = root.animated && rendered && !item.open;
|
|
7378
7426
|
return scopeParts(/* @__PURE__ */ jsx35(
|
|
7379
7427
|
"div",
|
|
7380
7428
|
{
|
|
@@ -7382,12 +7430,14 @@ function AccordionContent({
|
|
|
7382
7430
|
role: "region",
|
|
7383
7431
|
"aria-labelledby": item.triggerId,
|
|
7384
7432
|
hidden: !item.open,
|
|
7385
|
-
"
|
|
7433
|
+
"aria-hidden": !item.open || void 0,
|
|
7434
|
+
inert: !item.open || void 0,
|
|
7435
|
+
"data-state": item.open ? "open" : closing ? "closing" : "closed",
|
|
7386
7436
|
className: mergeClasses([
|
|
7387
7437
|
"pimolu-accordion__content",
|
|
7388
7438
|
className
|
|
7389
7439
|
].filter(Boolean).join(" "), partClasses.content, classNames?.root),
|
|
7390
|
-
children: /* @__PURE__ */ jsx35("div", { className: mergeClasses("pimolu-accordion__content-inner", partClasses.contentInner), children })
|
|
7440
|
+
children: /* @__PURE__ */ jsx35("div", { className: "pimolu-accordion__content-clip", children: /* @__PURE__ */ jsx35("div", { className: mergeClasses("pimolu-accordion__content-inner", partClasses.contentInner), children }) })
|
|
7391
7441
|
}
|
|
7392
7442
|
));
|
|
7393
7443
|
}
|
|
@@ -7496,7 +7546,7 @@ function BreadcrumbPage({
|
|
|
7496
7546
|
}
|
|
7497
7547
|
|
|
7498
7548
|
// pagination/pagination.tsx
|
|
7499
|
-
import { useState as
|
|
7549
|
+
import { useState as useState22 } from "react";
|
|
7500
7550
|
|
|
7501
7551
|
// pagination/pagination.variants.ts
|
|
7502
7552
|
import { createVariants as createVariants31 } from "@pimolu/core";
|
|
@@ -7559,7 +7609,7 @@ function Pagination({
|
|
|
7559
7609
|
...props
|
|
7560
7610
|
}) {
|
|
7561
7611
|
const [partClasses, scopeParts] = usePartClasses("pagination", classNames, true);
|
|
7562
|
-
const [uncontrolledPage, setUncontrolledPage] =
|
|
7612
|
+
const [uncontrolledPage, setUncontrolledPage] = useState22(defaultPage);
|
|
7563
7613
|
const isControlled = controlledPage !== void 0;
|
|
7564
7614
|
const current = clamp4(
|
|
7565
7615
|
isControlled ? controlledPage : uncontrolledPage,
|
|
@@ -7642,7 +7692,7 @@ function Pagination({
|
|
|
7642
7692
|
import {
|
|
7643
7693
|
createContext as createContext9,
|
|
7644
7694
|
useContext as useContext9,
|
|
7645
|
-
useState as
|
|
7695
|
+
useState as useState23
|
|
7646
7696
|
} from "react";
|
|
7647
7697
|
import { Fragment as Fragment6, jsx as jsx38, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
7648
7698
|
var StepperContext = createContext9(null);
|
|
@@ -7670,7 +7720,7 @@ function Stepper({
|
|
|
7670
7720
|
className
|
|
7671
7721
|
}) {
|
|
7672
7722
|
const [partClasses, scopeParts] = usePartClasses("stepper", classNames, true);
|
|
7673
|
-
const [uncontrolledStep, setUncontrolledStep] =
|
|
7723
|
+
const [uncontrolledStep, setUncontrolledStep] = useState23(defaultActiveStep);
|
|
7674
7724
|
const isControlled = controlledActiveStep !== void 0;
|
|
7675
7725
|
const activeStep = isControlled ? controlledActiveStep : uncontrolledStep;
|
|
7676
7726
|
function change(step) {
|
|
@@ -7764,630 +7814,1181 @@ var navbarVariants = createVariants32({ base: "pimolu-navbar", variants: navbarV
|
|
|
7764
7814
|
|
|
7765
7815
|
// navbar/navbar.tsx
|
|
7766
7816
|
import {
|
|
7817
|
+
createContext as createContext11,
|
|
7818
|
+
useCallback as useCallback10,
|
|
7819
|
+
useContext as useContext11,
|
|
7820
|
+
useEffect as useEffect21,
|
|
7821
|
+
useId as useId19,
|
|
7822
|
+
useRef as useRef20,
|
|
7823
|
+
useState as useState25
|
|
7824
|
+
} from "react";
|
|
7825
|
+
|
|
7826
|
+
// drawer/drawer.tsx
|
|
7827
|
+
import {
|
|
7828
|
+
cloneElement as cloneElement6,
|
|
7767
7829
|
createContext as createContext10,
|
|
7830
|
+
isValidElement as isValidElement7,
|
|
7768
7831
|
useCallback as useCallback9,
|
|
7769
7832
|
useContext as useContext10,
|
|
7770
|
-
useEffect as
|
|
7833
|
+
useEffect as useEffect20,
|
|
7771
7834
|
useId as useId18,
|
|
7772
|
-
|
|
7773
|
-
|
|
7835
|
+
useMemo as useMemo7,
|
|
7836
|
+
useRef as useRef19,
|
|
7837
|
+
useState as useState24
|
|
7838
|
+
} from "react";
|
|
7839
|
+
|
|
7840
|
+
// internal/use-focus-trap.ts
|
|
7841
|
+
import {
|
|
7842
|
+
useEffect as useEffect19
|
|
7774
7843
|
} from "react";
|
|
7844
|
+
function useFocusTrap({
|
|
7845
|
+
active,
|
|
7846
|
+
containerRef,
|
|
7847
|
+
returnFocusRef,
|
|
7848
|
+
initialFocus = "first"
|
|
7849
|
+
}) {
|
|
7850
|
+
useEffect19(() => {
|
|
7851
|
+
if (!active) return;
|
|
7852
|
+
const container = containerRef.current;
|
|
7853
|
+
if (!container) return;
|
|
7854
|
+
const previous = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
7855
|
+
const target = initialFocus === "container" ? container : getFocusable(container)[0] ?? container;
|
|
7856
|
+
target.focus();
|
|
7857
|
+
function handleKeyDown(event) {
|
|
7858
|
+
if (event.key !== "Tab") return;
|
|
7859
|
+
const focusable = getFocusable(container);
|
|
7860
|
+
if (focusable.length === 0) {
|
|
7861
|
+
event.preventDefault();
|
|
7862
|
+
container.focus();
|
|
7863
|
+
return;
|
|
7864
|
+
}
|
|
7865
|
+
const first = focusable[0];
|
|
7866
|
+
const last = focusable[focusable.length - 1];
|
|
7867
|
+
const current = document.activeElement;
|
|
7868
|
+
if (current === container) {
|
|
7869
|
+
event.preventDefault();
|
|
7870
|
+
(event.shiftKey ? last : first).focus();
|
|
7871
|
+
return;
|
|
7872
|
+
}
|
|
7873
|
+
if (event.shiftKey) {
|
|
7874
|
+
if (current === first || !container.contains(current)) {
|
|
7875
|
+
event.preventDefault();
|
|
7876
|
+
last.focus();
|
|
7877
|
+
}
|
|
7878
|
+
return;
|
|
7879
|
+
}
|
|
7880
|
+
if (current === last || !container.contains(current)) {
|
|
7881
|
+
event.preventDefault();
|
|
7882
|
+
first.focus();
|
|
7883
|
+
}
|
|
7884
|
+
}
|
|
7885
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
7886
|
+
return () => {
|
|
7887
|
+
document.removeEventListener(
|
|
7888
|
+
"keydown",
|
|
7889
|
+
handleKeyDown
|
|
7890
|
+
);
|
|
7891
|
+
const trigger = returnFocusRef?.current;
|
|
7892
|
+
const restore = trigger?.isConnected ? trigger : previous;
|
|
7893
|
+
if (restore?.isConnected) {
|
|
7894
|
+
restore.focus();
|
|
7895
|
+
}
|
|
7896
|
+
};
|
|
7897
|
+
}, [active, containerRef, returnFocusRef, initialFocus]);
|
|
7898
|
+
}
|
|
7899
|
+
|
|
7900
|
+
// drawer/drawer.tsx
|
|
7775
7901
|
import { jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
7902
|
+
var EXIT_DURATION4 = 180;
|
|
7903
|
+
var SIDE_CLASSES = {
|
|
7904
|
+
right: "pimolu-drawer__content--right",
|
|
7905
|
+
left: "pimolu-drawer__content--left",
|
|
7906
|
+
top: "pimolu-drawer__content--top",
|
|
7907
|
+
bottom: "pimolu-drawer__content--bottom"
|
|
7908
|
+
};
|
|
7909
|
+
var SIZE_CLASSES = {
|
|
7910
|
+
sm: "pimolu-drawer__content--sm",
|
|
7911
|
+
md: "pimolu-drawer__content--md",
|
|
7912
|
+
lg: "pimolu-drawer__content--lg"
|
|
7913
|
+
};
|
|
7776
7914
|
function classes7(base, className) {
|
|
7777
7915
|
return [base, className].filter(Boolean).join(" ");
|
|
7778
7916
|
}
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7917
|
+
function contentClasses(side, size, className) {
|
|
7918
|
+
return [
|
|
7919
|
+
"pimolu-drawer__content",
|
|
7920
|
+
SIDE_CLASSES[side],
|
|
7921
|
+
SIZE_CLASSES[size],
|
|
7922
|
+
className
|
|
7923
|
+
].filter(Boolean).join(" ");
|
|
7924
|
+
}
|
|
7925
|
+
function CloseIcon2() {
|
|
7926
|
+
return /* @__PURE__ */ jsxs29(
|
|
7782
7927
|
"svg",
|
|
7783
7928
|
{
|
|
7784
7929
|
viewBox: "0 0 24 24",
|
|
7785
|
-
width: "
|
|
7786
|
-
height: "
|
|
7930
|
+
width: "16",
|
|
7931
|
+
height: "16",
|
|
7787
7932
|
fill: "none",
|
|
7788
7933
|
stroke: "currentColor",
|
|
7789
|
-
strokeWidth: "
|
|
7934
|
+
strokeWidth: "2",
|
|
7790
7935
|
strokeLinecap: "round",
|
|
7791
7936
|
"aria-hidden": "true",
|
|
7792
7937
|
focusable: "false",
|
|
7793
|
-
children:
|
|
7938
|
+
children: [
|
|
7939
|
+
/* @__PURE__ */ jsx39("path", { d: "M18 6 6 18" }),
|
|
7940
|
+
/* @__PURE__ */ jsx39("path", { d: "m6 6 12 12" })
|
|
7941
|
+
]
|
|
7794
7942
|
}
|
|
7795
7943
|
);
|
|
7796
7944
|
}
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7945
|
+
var DrawerContext = createContext10(null);
|
|
7946
|
+
function useDrawer(component) {
|
|
7947
|
+
const context = useContext10(DrawerContext);
|
|
7948
|
+
if (!context) {
|
|
7949
|
+
throw new Error(
|
|
7950
|
+
`${component} must be used inside <Drawer>.`
|
|
7951
|
+
);
|
|
7952
|
+
}
|
|
7953
|
+
return context;
|
|
7954
|
+
}
|
|
7955
|
+
function Drawer({
|
|
7956
|
+
children,
|
|
7804
7957
|
open: controlledOpen,
|
|
7805
7958
|
defaultOpen = false,
|
|
7806
|
-
onOpenChange
|
|
7807
|
-
children,
|
|
7808
|
-
className,
|
|
7809
|
-
...props
|
|
7959
|
+
onOpenChange
|
|
7810
7960
|
}) {
|
|
7811
|
-
const
|
|
7812
|
-
const [
|
|
7813
|
-
const open = controlledOpen
|
|
7814
|
-
const
|
|
7815
|
-
const
|
|
7816
|
-
|
|
7817
|
-
|
|
7961
|
+
const isControlled = controlledOpen !== void 0;
|
|
7962
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState24(defaultOpen);
|
|
7963
|
+
const open = isControlled ? controlledOpen : uncontrolledOpen;
|
|
7964
|
+
const contentId = `pimolu-drawer-${useId18()}`;
|
|
7965
|
+
const scopeRef = useRef19(
|
|
7966
|
+
null
|
|
7967
|
+
);
|
|
7968
|
+
const triggerRef = useRef19(null);
|
|
7969
|
+
const [titleId, setTitleId] = useState24(null);
|
|
7970
|
+
const [descriptionId, setDescriptionId] = useState24(null);
|
|
7818
7971
|
const setOpen = useCallback9(
|
|
7819
7972
|
(next) => {
|
|
7820
|
-
if (
|
|
7821
|
-
|
|
7973
|
+
if (!isControlled) {
|
|
7974
|
+
setUncontrolledOpen(next);
|
|
7975
|
+
}
|
|
7822
7976
|
onOpenChange?.(next);
|
|
7823
7977
|
},
|
|
7824
|
-
[
|
|
7978
|
+
[isControlled, onOpenChange]
|
|
7825
7979
|
);
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
children: /* @__PURE__ */ jsx39(
|
|
7851
|
-
"header",
|
|
7852
|
-
{
|
|
7853
|
-
...props,
|
|
7854
|
-
ref: rootRef,
|
|
7855
|
-
"data-sticky": sticky || void 0,
|
|
7856
|
-
"data-bordered": bordered || void 0,
|
|
7857
|
-
"data-items-position": itemsPosition,
|
|
7858
|
-
"data-collapsible": collapsible || void 0,
|
|
7859
|
-
"data-open": collapsible ? open : void 0,
|
|
7860
|
-
className: mergeClasses(navbarVariants({ appearance }, className), partClasses.root),
|
|
7861
|
-
children: /* @__PURE__ */ jsx39("div", { className: mergeClasses("pimolu-navbar__inner", partClasses.inner), children })
|
|
7862
|
-
}
|
|
7863
|
-
)
|
|
7864
|
-
}
|
|
7865
|
-
));
|
|
7980
|
+
const value = useMemo7(
|
|
7981
|
+
() => ({
|
|
7982
|
+
open,
|
|
7983
|
+
setOpen,
|
|
7984
|
+
contentId,
|
|
7985
|
+
titleId,
|
|
7986
|
+
descriptionId,
|
|
7987
|
+
setTitleId,
|
|
7988
|
+
setDescriptionId,
|
|
7989
|
+
scopeRef,
|
|
7990
|
+
triggerRef
|
|
7991
|
+
}),
|
|
7992
|
+
[
|
|
7993
|
+
open,
|
|
7994
|
+
setOpen,
|
|
7995
|
+
contentId,
|
|
7996
|
+
titleId,
|
|
7997
|
+
descriptionId
|
|
7998
|
+
]
|
|
7999
|
+
);
|
|
8000
|
+
return /* @__PURE__ */ jsxs29(DrawerContext.Provider, { value, children: [
|
|
8001
|
+
/* @__PURE__ */ jsx39("span", { ref: scopeRef, hidden: true }),
|
|
8002
|
+
children
|
|
8003
|
+
] });
|
|
7866
8004
|
}
|
|
7867
|
-
function
|
|
7868
|
-
|
|
7869
|
-
children,
|
|
7870
|
-
className,
|
|
7871
|
-
...props
|
|
8005
|
+
function DrawerTrigger({
|
|
8006
|
+
children
|
|
7872
8007
|
}) {
|
|
7873
|
-
const
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
8008
|
+
const { open, setOpen, contentId, triggerRef } = useDrawer("DrawerTrigger");
|
|
8009
|
+
if (!isValidElement7(children)) return children;
|
|
8010
|
+
const trigger = children;
|
|
8011
|
+
const props = trigger.props;
|
|
8012
|
+
function assignRef(node) {
|
|
8013
|
+
triggerRef.current = node;
|
|
8014
|
+
const childRef = props.ref;
|
|
8015
|
+
if (typeof childRef === "function") {
|
|
8016
|
+
childRef(
|
|
8017
|
+
node
|
|
8018
|
+
);
|
|
8019
|
+
} else if (childRef && typeof childRef === "object" && "current" in childRef) {
|
|
8020
|
+
childRef.current = node;
|
|
7883
8021
|
}
|
|
7884
|
-
|
|
8022
|
+
}
|
|
8023
|
+
return cloneElement6(trigger, {
|
|
8024
|
+
ref: assignRef,
|
|
8025
|
+
"aria-haspopup": "dialog",
|
|
8026
|
+
"aria-expanded": open,
|
|
8027
|
+
"aria-controls": open ? contentId : void 0,
|
|
8028
|
+
"data-state": open ? "open" : "closed",
|
|
8029
|
+
onClick: (event) => {
|
|
8030
|
+
props.onClick?.(event);
|
|
8031
|
+
if (event.defaultPrevented) return;
|
|
8032
|
+
setOpen(!open);
|
|
8033
|
+
}
|
|
8034
|
+
});
|
|
7885
8035
|
}
|
|
7886
|
-
function
|
|
7887
|
-
|
|
7888
|
-
children,
|
|
7889
|
-
className,
|
|
8036
|
+
function DrawerSurface({
|
|
8037
|
+
contentRef,
|
|
7890
8038
|
id,
|
|
7891
|
-
|
|
8039
|
+
open,
|
|
8040
|
+
state,
|
|
8041
|
+
side,
|
|
8042
|
+
size,
|
|
8043
|
+
className,
|
|
8044
|
+
classNames,
|
|
8045
|
+
style,
|
|
8046
|
+
showCloseButton,
|
|
8047
|
+
closeLabel,
|
|
8048
|
+
labelledBy,
|
|
8049
|
+
describedBy,
|
|
8050
|
+
ariaLabel,
|
|
8051
|
+
triggerRef,
|
|
8052
|
+
onClose,
|
|
8053
|
+
children
|
|
7892
8054
|
}) {
|
|
7893
|
-
const [partClasses, scopeParts] = usePartClasses("
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
8055
|
+
const [partClasses, scopeParts] = usePartClasses("drawer", classNames, false);
|
|
8056
|
+
useFocusTrap({
|
|
8057
|
+
active: open,
|
|
8058
|
+
containerRef: contentRef,
|
|
8059
|
+
returnFocusRef: triggerRef,
|
|
8060
|
+
initialFocus: "container"
|
|
8061
|
+
});
|
|
8062
|
+
useEffect20(() => {
|
|
8063
|
+
if (!open) return;
|
|
8064
|
+
const content = contentRef.current;
|
|
8065
|
+
if (!content) return;
|
|
8066
|
+
const preferred = getFocusable(content).find(
|
|
8067
|
+
(element) => !element.closest(".pimolu-drawer__footer") && !element.classList.contains(
|
|
8068
|
+
"pimolu-drawer__close"
|
|
8069
|
+
)
|
|
8070
|
+
);
|
|
8071
|
+
(preferred ?? content).focus();
|
|
8072
|
+
}, [open, contentRef]);
|
|
8073
|
+
return scopeParts(/* @__PURE__ */ jsxs29(
|
|
8074
|
+
"div",
|
|
7901
8075
|
{
|
|
7902
|
-
|
|
7903
|
-
id
|
|
7904
|
-
|
|
7905
|
-
"
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
7910
|
-
|
|
8076
|
+
ref: contentRef,
|
|
8077
|
+
id,
|
|
8078
|
+
role: "dialog",
|
|
8079
|
+
"aria-modal": "true",
|
|
8080
|
+
"aria-label": labelledBy ? void 0 : ariaLabel,
|
|
8081
|
+
"aria-labelledby": labelledBy,
|
|
8082
|
+
"aria-describedby": describedBy,
|
|
8083
|
+
tabIndex: -1,
|
|
8084
|
+
className: mergeClasses(contentClasses(side, size, className), partClasses.root),
|
|
8085
|
+
style,
|
|
8086
|
+
"data-state": state,
|
|
8087
|
+
"data-side": side,
|
|
8088
|
+
"data-close-button": showCloseButton ? "true" : void 0,
|
|
8089
|
+
children: [
|
|
8090
|
+
children,
|
|
8091
|
+
showCloseButton && /* @__PURE__ */ jsx39(
|
|
8092
|
+
"button",
|
|
8093
|
+
{
|
|
8094
|
+
type: "button",
|
|
8095
|
+
className: mergeClasses("pimolu-drawer__close", partClasses.closeButton),
|
|
8096
|
+
"aria-label": closeLabel,
|
|
8097
|
+
onClick: onClose,
|
|
8098
|
+
children: /* @__PURE__ */ jsx39(CloseIcon2, {})
|
|
8099
|
+
}
|
|
8100
|
+
)
|
|
8101
|
+
]
|
|
7911
8102
|
}
|
|
7912
8103
|
));
|
|
7913
8104
|
}
|
|
7914
|
-
function
|
|
7915
|
-
|
|
7916
|
-
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
8105
|
+
function DrawerContent({
|
|
8106
|
+
children,
|
|
8107
|
+
side = "right",
|
|
8108
|
+
size = "md",
|
|
8109
|
+
closeOnOverlayClick = true,
|
|
8110
|
+
closeOnEscape = true,
|
|
8111
|
+
showCloseButton = true,
|
|
8112
|
+
closeLabel = "Close",
|
|
7920
8113
|
className,
|
|
7921
|
-
|
|
7922
|
-
|
|
8114
|
+
classNames,
|
|
8115
|
+
style,
|
|
7923
8116
|
"aria-label": ariaLabel,
|
|
7924
|
-
|
|
8117
|
+
"aria-labelledby": ariaLabelledBy,
|
|
8118
|
+
"aria-describedby": ariaDescribedBy
|
|
7925
8119
|
}) {
|
|
7926
|
-
const [partClasses, scopeParts] = usePartClasses("
|
|
7927
|
-
const
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
8120
|
+
const [partClasses, scopeParts] = usePartClasses("drawer", classNames, true);
|
|
8121
|
+
const {
|
|
8122
|
+
open,
|
|
8123
|
+
setOpen,
|
|
8124
|
+
contentId,
|
|
8125
|
+
titleId,
|
|
8126
|
+
descriptionId,
|
|
8127
|
+
scopeRef,
|
|
8128
|
+
triggerRef
|
|
8129
|
+
} = useDrawer("DrawerContent");
|
|
8130
|
+
const contentRef = useRef19(
|
|
8131
|
+
null
|
|
8132
|
+
);
|
|
8133
|
+
const { rendered, state } = usePresence(
|
|
8134
|
+
open,
|
|
8135
|
+
EXIT_DURATION4
|
|
8136
|
+
);
|
|
8137
|
+
useBodyScrollLock(rendered);
|
|
8138
|
+
useDismissableLayer({
|
|
8139
|
+
open,
|
|
8140
|
+
target: contentRef,
|
|
8141
|
+
onDismiss: () => setOpen(false),
|
|
8142
|
+
closeOnOutside: closeOnOverlayClick,
|
|
8143
|
+
closeOnEscape
|
|
8144
|
+
});
|
|
8145
|
+
if (!rendered) return scopeParts(null);
|
|
8146
|
+
const labelledBy = ariaLabelledBy ?? titleId ?? void 0;
|
|
8147
|
+
const describedBy = ariaDescribedBy ?? descriptionId ?? void 0;
|
|
8148
|
+
return scopeParts(/* @__PURE__ */ jsx39(Portal, { anchorRef: scopeRef, children: /* @__PURE__ */ jsxs29(
|
|
8149
|
+
"div",
|
|
7933
8150
|
{
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
8151
|
+
className: mergeClasses("pimolu-drawer", partClasses.root),
|
|
8152
|
+
"data-state": state,
|
|
8153
|
+
"data-side": side,
|
|
8154
|
+
children: [
|
|
8155
|
+
/* @__PURE__ */ jsx39(
|
|
8156
|
+
"div",
|
|
8157
|
+
{
|
|
8158
|
+
className: mergeClasses("pimolu-drawer__overlay", partClasses.overlay),
|
|
8159
|
+
"data-state": state
|
|
8160
|
+
}
|
|
8161
|
+
),
|
|
8162
|
+
/* @__PURE__ */ jsx39(
|
|
8163
|
+
DrawerSurface,
|
|
8164
|
+
{
|
|
8165
|
+
contentRef,
|
|
8166
|
+
id: contentId,
|
|
8167
|
+
open,
|
|
8168
|
+
state,
|
|
8169
|
+
side,
|
|
8170
|
+
size,
|
|
8171
|
+
className: mergeClasses(className, partClasses.content),
|
|
8172
|
+
classNames,
|
|
8173
|
+
style,
|
|
8174
|
+
showCloseButton,
|
|
8175
|
+
closeLabel,
|
|
8176
|
+
labelledBy,
|
|
8177
|
+
describedBy,
|
|
8178
|
+
ariaLabel,
|
|
8179
|
+
triggerRef,
|
|
8180
|
+
onClose: () => setOpen(false),
|
|
8181
|
+
children
|
|
8182
|
+
}
|
|
8183
|
+
)
|
|
8184
|
+
]
|
|
7947
8185
|
}
|
|
7948
|
-
));
|
|
8186
|
+
) }));
|
|
7949
8187
|
}
|
|
7950
|
-
function
|
|
8188
|
+
function DrawerHeader({
|
|
7951
8189
|
classNames,
|
|
7952
|
-
active = false,
|
|
7953
|
-
disabled = false,
|
|
7954
|
-
icon,
|
|
7955
8190
|
children,
|
|
7956
|
-
className
|
|
7957
|
-
onClick,
|
|
7958
|
-
...props
|
|
8191
|
+
className
|
|
7959
8192
|
}) {
|
|
7960
|
-
const [partClasses, scopeParts
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
Link,
|
|
8193
|
+
const [partClasses, scopeParts] = usePartClasses("drawer", classNames, false);
|
|
8194
|
+
return scopeParts(/* @__PURE__ */ jsx39(
|
|
8195
|
+
"div",
|
|
7964
8196
|
{
|
|
7965
|
-
...props,
|
|
7966
|
-
variant: "muted",
|
|
7967
|
-
underline: "none",
|
|
7968
|
-
disabled,
|
|
7969
|
-
"aria-current": active ? "page" : void 0,
|
|
7970
8197
|
className: mergeClasses(classes7(
|
|
7971
|
-
"pimolu-
|
|
8198
|
+
"pimolu-drawer__header",
|
|
7972
8199
|
className
|
|
7973
|
-
), partClasses.
|
|
7974
|
-
|
|
7975
|
-
onClick?.(event);
|
|
7976
|
-
if (!event.defaultPrevented && context?.collapsible) {
|
|
7977
|
-
context.setOpen(false);
|
|
7978
|
-
}
|
|
7979
|
-
},
|
|
7980
|
-
classNames: forwardedParts,
|
|
7981
|
-
children: [
|
|
7982
|
-
icon != null && /* @__PURE__ */ jsx39("span", { className: mergeClasses("pimolu-navbar__item-icon", partClasses.itemIcon), "aria-hidden": "true", children: icon }),
|
|
7983
|
-
children
|
|
7984
|
-
]
|
|
8200
|
+
), partClasses.header, classNames?.root),
|
|
8201
|
+
children
|
|
7985
8202
|
}
|
|
7986
8203
|
));
|
|
7987
8204
|
}
|
|
7988
|
-
function
|
|
8205
|
+
function DrawerFooter({
|
|
7989
8206
|
classNames,
|
|
7990
8207
|
children,
|
|
7991
|
-
className
|
|
7992
|
-
...props
|
|
8208
|
+
className
|
|
7993
8209
|
}) {
|
|
7994
|
-
const [partClasses, scopeParts] = usePartClasses("
|
|
8210
|
+
const [partClasses, scopeParts] = usePartClasses("drawer", classNames, false);
|
|
7995
8211
|
return scopeParts(/* @__PURE__ */ jsx39(
|
|
7996
8212
|
"div",
|
|
7997
8213
|
{
|
|
7998
|
-
...props,
|
|
7999
8214
|
className: mergeClasses(classes7(
|
|
8000
|
-
"pimolu-
|
|
8215
|
+
"pimolu-drawer__footer",
|
|
8001
8216
|
className
|
|
8002
|
-
), partClasses.
|
|
8217
|
+
), partClasses.footer, classNames?.root),
|
|
8003
8218
|
children
|
|
8004
8219
|
}
|
|
8005
8220
|
));
|
|
8006
8221
|
}
|
|
8007
|
-
|
|
8008
|
-
// sidebar/sidebar.tsx
|
|
8009
|
-
import {
|
|
8010
|
-
createContext as createContext11,
|
|
8011
|
-
useContext as useContext11,
|
|
8012
|
-
useEffect as useEffect19,
|
|
8013
|
-
useRef as useRef19,
|
|
8014
|
-
useState as useState24,
|
|
8015
|
-
useSyncExternalStore as useSyncExternalStore2
|
|
8016
|
-
} from "react";
|
|
8017
|
-
import { Fragment as Fragment7, jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
8018
|
-
var SidebarCollapsedContext = createContext11(false);
|
|
8019
|
-
function classes8(base, className) {
|
|
8020
|
-
return [base, className].filter(Boolean).join(" ");
|
|
8021
|
-
}
|
|
8022
|
-
var mobileQuery = "(max-width: 720px)";
|
|
8023
|
-
function subscribeMobile(onChange) {
|
|
8024
|
-
if (typeof window === "undefined" || !window.matchMedia) return () => {
|
|
8025
|
-
};
|
|
8026
|
-
const media = window.matchMedia(mobileQuery);
|
|
8027
|
-
media.addEventListener("change", onChange);
|
|
8028
|
-
return () => media.removeEventListener("change", onChange);
|
|
8029
|
-
}
|
|
8030
|
-
function mobileSnapshot() {
|
|
8031
|
-
return typeof window !== "undefined" && Boolean(window.matchMedia?.(mobileQuery).matches);
|
|
8032
|
-
}
|
|
8033
|
-
function Sidebar({
|
|
8222
|
+
function DrawerTitle({
|
|
8034
8223
|
classNames,
|
|
8035
|
-
sticky = false,
|
|
8036
|
-
collapsible = false,
|
|
8037
|
-
collapsed,
|
|
8038
|
-
defaultCollapsed,
|
|
8039
|
-
collapseOnMobile = true,
|
|
8040
|
-
onCollapsedChange,
|
|
8041
|
-
collapseLabel = "Collapse sidebar",
|
|
8042
|
-
expandLabel = "Expand sidebar",
|
|
8043
8224
|
children,
|
|
8044
|
-
|
|
8045
|
-
|
|
8225
|
+
id,
|
|
8226
|
+
className
|
|
8046
8227
|
}) {
|
|
8047
|
-
const [partClasses, scopeParts] = usePartClasses("
|
|
8048
|
-
const
|
|
8049
|
-
const
|
|
8050
|
-
const
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8059
|
-
function toggleCollapsed() {
|
|
8060
|
-
const next = !isCollapsed;
|
|
8061
|
-
if (collapsed === void 0) setInternalCollapsed(next);
|
|
8062
|
-
onCollapsedChange?.(next);
|
|
8063
|
-
}
|
|
8064
|
-
return scopeParts(/* @__PURE__ */ jsx40(SidebarCollapsedContext.Provider, { value: isCollapsed, children: /* @__PURE__ */ jsxs30(
|
|
8065
|
-
"aside",
|
|
8228
|
+
const [partClasses, scopeParts] = usePartClasses("drawer", classNames, false);
|
|
8229
|
+
const { setTitleId } = useDrawer("DrawerTitle");
|
|
8230
|
+
const generatedId = useId18();
|
|
8231
|
+
const titleId = id ?? `pimolu-drawer-title-${generatedId}`;
|
|
8232
|
+
useEffect20(() => {
|
|
8233
|
+
setTitleId(titleId);
|
|
8234
|
+
return () => setTitleId(
|
|
8235
|
+
(current) => current === titleId ? null : current
|
|
8236
|
+
);
|
|
8237
|
+
}, [setTitleId, titleId]);
|
|
8238
|
+
return scopeParts(/* @__PURE__ */ jsx39(
|
|
8239
|
+
"h2",
|
|
8066
8240
|
{
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
children
|
|
8073
|
-
collapsible && /* @__PURE__ */ jsx40(
|
|
8074
|
-
"button",
|
|
8075
|
-
{
|
|
8076
|
-
type: "button",
|
|
8077
|
-
ref: toggleRef,
|
|
8078
|
-
className: mergeClasses("pimolu-sidebar__toggle", partClasses.toggle),
|
|
8079
|
-
"aria-label": isCollapsed ? expandLabel : collapseLabel,
|
|
8080
|
-
"aria-expanded": !isCollapsed,
|
|
8081
|
-
onClick: toggleCollapsed,
|
|
8082
|
-
children: /* @__PURE__ */ jsxs30("svg", { viewBox: "0 0 20 20", width: "18", height: "18", fill: "none", stroke: "currentColor", strokeWidth: "1.7", "aria-hidden": "true", children: [
|
|
8083
|
-
/* @__PURE__ */ jsx40("rect", { x: "2.5", y: "3", width: "15", height: "14", rx: "2" }),
|
|
8084
|
-
/* @__PURE__ */ jsx40("path", { d: "M7 3v14" })
|
|
8085
|
-
] })
|
|
8086
|
-
}
|
|
8087
|
-
),
|
|
8088
|
-
children
|
|
8089
|
-
]
|
|
8241
|
+
id: titleId,
|
|
8242
|
+
className: mergeClasses(classes7(
|
|
8243
|
+
"pimolu-drawer__title",
|
|
8244
|
+
className
|
|
8245
|
+
), partClasses.title, classNames?.root),
|
|
8246
|
+
children
|
|
8090
8247
|
}
|
|
8091
|
-
)
|
|
8248
|
+
));
|
|
8092
8249
|
}
|
|
8093
|
-
function
|
|
8250
|
+
function DrawerDescription({
|
|
8094
8251
|
classNames,
|
|
8095
8252
|
children,
|
|
8096
|
-
|
|
8097
|
-
className
|
|
8098
|
-
...props
|
|
8253
|
+
id,
|
|
8254
|
+
className
|
|
8099
8255
|
}) {
|
|
8100
|
-
const [partClasses, scopeParts] = usePartClasses("
|
|
8101
|
-
|
|
8102
|
-
|
|
8256
|
+
const [partClasses, scopeParts] = usePartClasses("drawer", classNames, false);
|
|
8257
|
+
const { setDescriptionId } = useDrawer("DrawerDescription");
|
|
8258
|
+
const generatedId = useId18();
|
|
8259
|
+
const descriptionId = id ?? `pimolu-drawer-description-${generatedId}`;
|
|
8260
|
+
useEffect20(() => {
|
|
8261
|
+
setDescriptionId(descriptionId);
|
|
8262
|
+
return () => setDescriptionId(
|
|
8263
|
+
(current) => current === descriptionId ? null : current
|
|
8264
|
+
);
|
|
8265
|
+
}, [setDescriptionId, descriptionId]);
|
|
8266
|
+
return scopeParts(/* @__PURE__ */ jsx39(
|
|
8267
|
+
"p",
|
|
8103
8268
|
{
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
"pimolu-sidebar__header",
|
|
8269
|
+
id: descriptionId,
|
|
8270
|
+
className: mergeClasses(classes7(
|
|
8271
|
+
"pimolu-drawer__description",
|
|
8108
8272
|
className
|
|
8109
|
-
), partClasses.
|
|
8110
|
-
children
|
|
8111
|
-
/* @__PURE__ */ jsx40("div", { className: mergeClasses("pimolu-sidebar__expanded", partClasses.expanded), children }),
|
|
8112
|
-
/* @__PURE__ */ jsx40("div", { className: mergeClasses("pimolu-sidebar__compact", partClasses.compact), children: collapsedContent })
|
|
8113
|
-
] }) : children
|
|
8273
|
+
), partClasses.description, classNames?.root),
|
|
8274
|
+
children
|
|
8114
8275
|
}
|
|
8115
8276
|
));
|
|
8116
8277
|
}
|
|
8117
|
-
function
|
|
8278
|
+
function DrawerClose({
|
|
8279
|
+
children
|
|
8280
|
+
}) {
|
|
8281
|
+
const { setOpen } = useDrawer("DrawerClose");
|
|
8282
|
+
if (!isValidElement7(children)) return children;
|
|
8283
|
+
const trigger = children;
|
|
8284
|
+
const props = trigger.props;
|
|
8285
|
+
return cloneElement6(trigger, {
|
|
8286
|
+
onClick: (event) => {
|
|
8287
|
+
props.onClick?.(event);
|
|
8288
|
+
if (event.defaultPrevented) return;
|
|
8289
|
+
setOpen(false);
|
|
8290
|
+
}
|
|
8291
|
+
});
|
|
8292
|
+
}
|
|
8293
|
+
|
|
8294
|
+
// navbar/navbar.tsx
|
|
8295
|
+
import { jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
8296
|
+
function classes8(base, className) {
|
|
8297
|
+
return [base, className].filter(Boolean).join(" ");
|
|
8298
|
+
}
|
|
8299
|
+
var NavbarContext = createContext11(null);
|
|
8300
|
+
function MenuIcon({ open }) {
|
|
8301
|
+
return /* @__PURE__ */ jsx40(
|
|
8302
|
+
"svg",
|
|
8303
|
+
{
|
|
8304
|
+
viewBox: "0 0 24 24",
|
|
8305
|
+
width: "20",
|
|
8306
|
+
height: "20",
|
|
8307
|
+
fill: "none",
|
|
8308
|
+
stroke: "currentColor",
|
|
8309
|
+
strokeWidth: "1.8",
|
|
8310
|
+
strokeLinecap: "round",
|
|
8311
|
+
"aria-hidden": "true",
|
|
8312
|
+
focusable: "false",
|
|
8313
|
+
children: open ? /* @__PURE__ */ jsx40("path", { d: "M5 5l14 14M19 5 5 19" }) : /* @__PURE__ */ jsx40("path", { d: "M4 6h16M4 12h16M4 18h16" })
|
|
8314
|
+
}
|
|
8315
|
+
);
|
|
8316
|
+
}
|
|
8317
|
+
function Navbar({
|
|
8118
8318
|
classNames,
|
|
8319
|
+
appearance = "surface",
|
|
8320
|
+
sticky = false,
|
|
8321
|
+
bordered = true,
|
|
8322
|
+
itemsPosition = "left",
|
|
8323
|
+
collapsible = false,
|
|
8324
|
+
open: controlledOpen,
|
|
8325
|
+
defaultOpen = false,
|
|
8326
|
+
onOpenChange,
|
|
8119
8327
|
children,
|
|
8120
8328
|
className,
|
|
8121
8329
|
...props
|
|
8122
8330
|
}) {
|
|
8123
|
-
const [partClasses, scopeParts] = usePartClasses("
|
|
8331
|
+
const [partClasses, scopeParts] = usePartClasses("navbar", classNames, true);
|
|
8332
|
+
const [internalOpen, setInternalOpen] = useState25(defaultOpen);
|
|
8333
|
+
const open = controlledOpen ?? internalOpen;
|
|
8334
|
+
const defaultContentId = `pimolu-navbar-${useId19()}-content`;
|
|
8335
|
+
const [contentId, setContentId] = useState25(defaultContentId);
|
|
8336
|
+
const rootRef = useRef20(null);
|
|
8337
|
+
const toggleRef = useRef20(null);
|
|
8338
|
+
const [hasMenu, setHasMenu] = useState25(false);
|
|
8339
|
+
const [narrow, setNarrow] = useState25(false);
|
|
8340
|
+
const overlay = collapsible && hasMenu && narrow;
|
|
8341
|
+
useEffect21(() => {
|
|
8342
|
+
const node = rootRef.current;
|
|
8343
|
+
if (!hasMenu || !node) return;
|
|
8344
|
+
const measure = () => {
|
|
8345
|
+
const style = getComputedStyle(node);
|
|
8346
|
+
const width = node.getBoundingClientRect().width - (parseFloat(style.paddingLeft) || 0) - (parseFloat(style.paddingRight) || 0) - (parseFloat(style.borderLeftWidth) || 0) - (parseFloat(style.borderRightWidth) || 0);
|
|
8347
|
+
setNarrow(width <= 700);
|
|
8348
|
+
};
|
|
8349
|
+
measure();
|
|
8350
|
+
if (typeof ResizeObserver === "undefined") {
|
|
8351
|
+
window.addEventListener("resize", measure);
|
|
8352
|
+
return () => window.removeEventListener("resize", measure);
|
|
8353
|
+
}
|
|
8354
|
+
const observer = new ResizeObserver(measure);
|
|
8355
|
+
observer.observe(node);
|
|
8356
|
+
return () => observer.disconnect();
|
|
8357
|
+
}, [hasMenu]);
|
|
8358
|
+
const setOpen = useCallback10(
|
|
8359
|
+
(next) => {
|
|
8360
|
+
if (next === open) return;
|
|
8361
|
+
if (controlledOpen === void 0) setInternalOpen(next);
|
|
8362
|
+
onOpenChange?.(next);
|
|
8363
|
+
},
|
|
8364
|
+
[controlledOpen, onOpenChange, open]
|
|
8365
|
+
);
|
|
8366
|
+
useOutsidePointer(rootRef, collapsible && open && !overlay, () => setOpen(false));
|
|
8367
|
+
const wasOverlay = useRef20(overlay);
|
|
8368
|
+
useEffect21(() => {
|
|
8369
|
+
if (wasOverlay.current && !overlay && open) {
|
|
8370
|
+
setOpen(false);
|
|
8371
|
+
rootRef.current?.querySelector(
|
|
8372
|
+
'.pimolu-navbar__content a[href]:not([aria-disabled="true"])'
|
|
8373
|
+
)?.focus();
|
|
8374
|
+
}
|
|
8375
|
+
wasOverlay.current = overlay;
|
|
8376
|
+
}, [overlay, open, setOpen]);
|
|
8377
|
+
useEffect21(() => {
|
|
8378
|
+
if (!collapsible || !open || overlay) return;
|
|
8379
|
+
function handleEscape(event) {
|
|
8380
|
+
if (event.key !== "Escape" || !rootRef.current?.contains(document.activeElement)) return;
|
|
8381
|
+
event.preventDefault();
|
|
8382
|
+
setOpen(false);
|
|
8383
|
+
toggleRef.current?.focus();
|
|
8384
|
+
}
|
|
8385
|
+
document.addEventListener("keydown", handleEscape);
|
|
8386
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
8387
|
+
}, [collapsible, open, setOpen, overlay]);
|
|
8124
8388
|
return scopeParts(/* @__PURE__ */ jsx40(
|
|
8125
|
-
|
|
8389
|
+
NavbarContext.Provider,
|
|
8126
8390
|
{
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
8391
|
+
value: {
|
|
8392
|
+
collapsible,
|
|
8393
|
+
open,
|
|
8394
|
+
setOpen,
|
|
8395
|
+
contentId,
|
|
8396
|
+
defaultContentId,
|
|
8397
|
+
setContentId,
|
|
8398
|
+
toggleRef,
|
|
8399
|
+
overlay,
|
|
8400
|
+
setHasMenu
|
|
8401
|
+
},
|
|
8402
|
+
children: /* @__PURE__ */ jsx40(
|
|
8403
|
+
"header",
|
|
8404
|
+
{
|
|
8405
|
+
...props,
|
|
8406
|
+
ref: rootRef,
|
|
8407
|
+
"data-sticky": sticky || void 0,
|
|
8408
|
+
"data-bordered": bordered || void 0,
|
|
8409
|
+
"data-items-position": itemsPosition,
|
|
8410
|
+
"data-collapsible": collapsible || void 0,
|
|
8411
|
+
"data-open": collapsible ? open : void 0,
|
|
8412
|
+
className: mergeClasses(navbarVariants({ appearance }, className), partClasses.root),
|
|
8413
|
+
children: /* @__PURE__ */ jsx40(Drawer, { open: overlay && open, onOpenChange: setOpen, children: /* @__PURE__ */ jsx40("div", { className: mergeClasses("pimolu-navbar__inner", partClasses.inner), children }) })
|
|
8414
|
+
}
|
|
8415
|
+
)
|
|
8134
8416
|
}
|
|
8135
8417
|
));
|
|
8136
8418
|
}
|
|
8137
|
-
function
|
|
8419
|
+
function NavbarBrand({
|
|
8138
8420
|
classNames,
|
|
8139
8421
|
children,
|
|
8140
8422
|
className,
|
|
8141
8423
|
...props
|
|
8142
8424
|
}) {
|
|
8143
|
-
const [partClasses, scopeParts] = usePartClasses("
|
|
8425
|
+
const [partClasses, scopeParts] = usePartClasses("navbar", classNames, false);
|
|
8144
8426
|
return scopeParts(/* @__PURE__ */ jsx40(
|
|
8145
|
-
"
|
|
8427
|
+
"a",
|
|
8146
8428
|
{
|
|
8147
8429
|
...props,
|
|
8148
8430
|
className: mergeClasses(classes8(
|
|
8149
|
-
"pimolu-
|
|
8431
|
+
"pimolu-navbar__brand",
|
|
8150
8432
|
className
|
|
8151
|
-
), partClasses.
|
|
8433
|
+
), partClasses.brand, classNames?.root),
|
|
8152
8434
|
children
|
|
8153
8435
|
}
|
|
8154
8436
|
));
|
|
8155
8437
|
}
|
|
8156
|
-
function
|
|
8438
|
+
function NavbarContent({
|
|
8157
8439
|
classNames,
|
|
8158
8440
|
children,
|
|
8159
8441
|
className,
|
|
8442
|
+
id,
|
|
8160
8443
|
...props
|
|
8161
8444
|
}) {
|
|
8162
|
-
const [partClasses, scopeParts] = usePartClasses("
|
|
8445
|
+
const [partClasses, scopeParts] = usePartClasses("navbar", classNames, false);
|
|
8446
|
+
const context = useContext11(NavbarContext);
|
|
8447
|
+
const resolvedId = id ?? context?.defaultContentId;
|
|
8448
|
+
useEffect21(() => {
|
|
8449
|
+
if (context && resolvedId) context.setContentId(resolvedId);
|
|
8450
|
+
}, [context?.setContentId, resolvedId]);
|
|
8163
8451
|
return scopeParts(/* @__PURE__ */ jsx40(
|
|
8164
|
-
"
|
|
8452
|
+
"nav",
|
|
8165
8453
|
{
|
|
8166
8454
|
...props,
|
|
8455
|
+
id: resolvedId,
|
|
8456
|
+
"aria-label": props["aria-label"] ?? "Main",
|
|
8457
|
+
"data-open": context?.collapsible ? context.open : void 0,
|
|
8167
8458
|
className: mergeClasses(classes8(
|
|
8168
|
-
"pimolu-
|
|
8459
|
+
"pimolu-navbar__content",
|
|
8169
8460
|
className
|
|
8170
|
-
), partClasses.
|
|
8461
|
+
), partClasses.content, classNames?.root),
|
|
8171
8462
|
children
|
|
8172
8463
|
}
|
|
8173
8464
|
));
|
|
8174
8465
|
}
|
|
8175
|
-
function
|
|
8466
|
+
function NavbarToggle({
|
|
8467
|
+
classNames,
|
|
8468
|
+
icon,
|
|
8469
|
+
closeIcon,
|
|
8470
|
+
openLabel = "Open menu",
|
|
8471
|
+
closeLabel = "Close menu",
|
|
8472
|
+
className,
|
|
8473
|
+
type = "button",
|
|
8474
|
+
onClick,
|
|
8475
|
+
"aria-label": ariaLabel,
|
|
8476
|
+
...props
|
|
8477
|
+
}) {
|
|
8478
|
+
const [partClasses, scopeParts] = usePartClasses("navbar", classNames, false);
|
|
8479
|
+
const context = useContext11(NavbarContext);
|
|
8480
|
+
if (!context) {
|
|
8481
|
+
throw new Error("NavbarToggle must be used inside <Navbar>.");
|
|
8482
|
+
}
|
|
8483
|
+
const button = /* @__PURE__ */ jsx40(
|
|
8484
|
+
"button",
|
|
8485
|
+
{
|
|
8486
|
+
...props,
|
|
8487
|
+
ref: context.toggleRef,
|
|
8488
|
+
type,
|
|
8489
|
+
"aria-label": ariaLabel ?? (context.open ? closeLabel : openLabel),
|
|
8490
|
+
"aria-expanded": context.open,
|
|
8491
|
+
"aria-controls": context.contentId,
|
|
8492
|
+
"data-open": context.open,
|
|
8493
|
+
className: mergeClasses(classes8("pimolu-navbar__toggle", className), partClasses.toggle, classNames?.root),
|
|
8494
|
+
onClick: (event) => {
|
|
8495
|
+
onClick?.(event);
|
|
8496
|
+
if (!event.defaultPrevented && !context.overlay) context.setOpen(!context.open);
|
|
8497
|
+
},
|
|
8498
|
+
children: /* @__PURE__ */ jsx40("span", { className: mergeClasses("pimolu-navbar__toggle-icon", partClasses.toggleIcon), "aria-hidden": "true", children: context.open ? closeIcon ?? /* @__PURE__ */ jsx40(MenuIcon, { open: true }) : icon ?? /* @__PURE__ */ jsx40(MenuIcon, { open: false }) })
|
|
8499
|
+
}
|
|
8500
|
+
);
|
|
8501
|
+
return scopeParts(context.overlay ? /* @__PURE__ */ jsx40(DrawerTrigger, { children: button }) : button);
|
|
8502
|
+
}
|
|
8503
|
+
function NavbarMenu({
|
|
8504
|
+
children,
|
|
8505
|
+
side = "right",
|
|
8506
|
+
size = "sm",
|
|
8507
|
+
fullScreen = false,
|
|
8508
|
+
animated = true,
|
|
8509
|
+
label = "Navigation",
|
|
8510
|
+
closeLabel = "Close menu",
|
|
8511
|
+
className,
|
|
8512
|
+
style,
|
|
8513
|
+
classNames
|
|
8514
|
+
}) {
|
|
8515
|
+
const [partClasses, scopeParts] = usePartClasses("navbar", classNames, false);
|
|
8516
|
+
const context = useContext11(NavbarContext);
|
|
8517
|
+
const register = context?.setHasMenu;
|
|
8518
|
+
useEffect21(() => {
|
|
8519
|
+
register?.(true);
|
|
8520
|
+
return () => register?.(false);
|
|
8521
|
+
}, [register]);
|
|
8522
|
+
if (!context) throw new Error("NavbarMenu must be used inside <Navbar>.");
|
|
8523
|
+
if (!context.overlay) {
|
|
8524
|
+
return scopeParts(/* @__PURE__ */ jsx40("div", { className: mergeClasses("pimolu-navbar__menu", className, classNames?.root), children }));
|
|
8525
|
+
}
|
|
8526
|
+
if (!animated && !context.open) return scopeParts(null);
|
|
8527
|
+
return scopeParts(
|
|
8528
|
+
/* @__PURE__ */ jsxs30(
|
|
8529
|
+
DrawerContent,
|
|
8530
|
+
{
|
|
8531
|
+
side,
|
|
8532
|
+
size,
|
|
8533
|
+
closeLabel,
|
|
8534
|
+
style,
|
|
8535
|
+
className: mergeClasses("pimolu-navbar__menu-panel", fullScreen && "pimolu-navbar__menu-panel--full", className, partClasses.menuPanel, classNames?.root),
|
|
8536
|
+
classNames: {
|
|
8537
|
+
root: mergeClasses("pimolu-navbar__menu-layer", !animated && "pimolu-navbar__menu-layer--instant", partClasses.menuLayer),
|
|
8538
|
+
overlay: partClasses.menuOverlay,
|
|
8539
|
+
header: partClasses.menuHeader,
|
|
8540
|
+
title: partClasses.menuTitle,
|
|
8541
|
+
closeButton: partClasses.menuCloseButton
|
|
8542
|
+
},
|
|
8543
|
+
children: [
|
|
8544
|
+
/* @__PURE__ */ jsx40(DrawerHeader, { children: /* @__PURE__ */ jsx40(DrawerTitle, { children: label }) }),
|
|
8545
|
+
children
|
|
8546
|
+
]
|
|
8547
|
+
}
|
|
8548
|
+
)
|
|
8549
|
+
);
|
|
8550
|
+
}
|
|
8551
|
+
function NavbarItem({
|
|
8176
8552
|
classNames,
|
|
8177
8553
|
active = false,
|
|
8178
8554
|
disabled = false,
|
|
8179
8555
|
icon,
|
|
8180
8556
|
children,
|
|
8181
8557
|
className,
|
|
8558
|
+
onClick,
|
|
8182
8559
|
...props
|
|
8183
8560
|
}) {
|
|
8184
|
-
const [partClasses, scopeParts, forwardedParts] = usePartClasses("
|
|
8185
|
-
const
|
|
8186
|
-
|
|
8187
|
-
const fallbackIcon = typeof children === "string" && children.trim() ? Array.from(children.trim())[0].toLocaleUpperCase() : "\u2022";
|
|
8188
|
-
return scopeParts(/* @__PURE__ */ jsx40(Tooltip, { content: label ?? "", placement: "right", delay: 150, disabled: !collapsed || !label, children: /* @__PURE__ */ jsxs30(
|
|
8561
|
+
const [partClasses, scopeParts, forwardedParts] = usePartClasses("navbar", classNames, false);
|
|
8562
|
+
const context = useContext11(NavbarContext);
|
|
8563
|
+
return scopeParts(/* @__PURE__ */ jsxs30(
|
|
8189
8564
|
Link,
|
|
8190
8565
|
{
|
|
8191
8566
|
...props,
|
|
8192
|
-
title: props.title ?? (!collapsed ? label : void 0),
|
|
8193
8567
|
variant: "muted",
|
|
8194
8568
|
underline: "none",
|
|
8195
8569
|
disabled,
|
|
8196
8570
|
"aria-current": active ? "page" : void 0,
|
|
8197
8571
|
className: mergeClasses(classes8(
|
|
8198
|
-
"pimolu-
|
|
8572
|
+
"pimolu-navbar__item",
|
|
8199
8573
|
className
|
|
8200
8574
|
), partClasses.item, classNames?.root),
|
|
8575
|
+
onClick: (event) => {
|
|
8576
|
+
onClick?.(event);
|
|
8577
|
+
if (!event.defaultPrevented && context?.collapsible) {
|
|
8578
|
+
context.setOpen(false);
|
|
8579
|
+
}
|
|
8580
|
+
},
|
|
8201
8581
|
classNames: forwardedParts,
|
|
8202
8582
|
children: [
|
|
8203
|
-
/* @__PURE__ */ jsx40(
|
|
8204
|
-
|
|
8205
|
-
{
|
|
8206
|
-
className: mergeClasses(classes8("pimolu-sidebar__icon", icon ? void 0 : "pimolu-sidebar__icon--fallback"), partClasses.icon),
|
|
8207
|
-
"aria-hidden": "true",
|
|
8208
|
-
children: icon ?? fallbackIcon
|
|
8209
|
-
}
|
|
8210
|
-
),
|
|
8211
|
-
/* @__PURE__ */ jsx40("span", { className: mergeClasses("pimolu-sidebar__label", partClasses.label), children })
|
|
8583
|
+
icon != null && /* @__PURE__ */ jsx40("span", { className: mergeClasses("pimolu-navbar__item-icon", partClasses.itemIcon), "aria-hidden": "true", children: icon }),
|
|
8584
|
+
children
|
|
8212
8585
|
]
|
|
8213
8586
|
}
|
|
8214
|
-
)
|
|
8587
|
+
));
|
|
8215
8588
|
}
|
|
8216
|
-
function
|
|
8589
|
+
function NavbarActions({
|
|
8217
8590
|
classNames,
|
|
8218
8591
|
children,
|
|
8219
|
-
collapsedContent,
|
|
8220
8592
|
className,
|
|
8221
8593
|
...props
|
|
8222
8594
|
}) {
|
|
8223
|
-
const [partClasses, scopeParts] = usePartClasses("
|
|
8595
|
+
const [partClasses, scopeParts] = usePartClasses("navbar", classNames, false);
|
|
8224
8596
|
return scopeParts(/* @__PURE__ */ jsx40(
|
|
8225
8597
|
"div",
|
|
8226
8598
|
{
|
|
8227
8599
|
...props,
|
|
8228
|
-
"data-has-collapsed-content": collapsedContent != null || void 0,
|
|
8229
8600
|
className: mergeClasses(classes8(
|
|
8230
|
-
"pimolu-
|
|
8601
|
+
"pimolu-navbar__actions",
|
|
8231
8602
|
className
|
|
8232
|
-
), partClasses.
|
|
8233
|
-
children
|
|
8234
|
-
/* @__PURE__ */ jsx40("div", { className: mergeClasses("pimolu-sidebar__expanded", partClasses.expanded), children }),
|
|
8235
|
-
/* @__PURE__ */ jsx40("div", { className: mergeClasses("pimolu-sidebar__compact", partClasses.compact), children: collapsedContent })
|
|
8236
|
-
] }) : children
|
|
8603
|
+
), partClasses.actions, classNames?.root),
|
|
8604
|
+
children
|
|
8237
8605
|
}
|
|
8238
8606
|
));
|
|
8239
8607
|
}
|
|
8240
8608
|
|
|
8241
|
-
//
|
|
8609
|
+
// sidebar/sidebar.tsx
|
|
8242
8610
|
import {
|
|
8243
8611
|
createContext as createContext12,
|
|
8244
8612
|
useContext as useContext12,
|
|
8245
|
-
useEffect as
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8613
|
+
useEffect as useEffect22,
|
|
8614
|
+
useRef as useRef21,
|
|
8615
|
+
useState as useState26,
|
|
8616
|
+
useSyncExternalStore as useSyncExternalStore2
|
|
8249
8617
|
} from "react";
|
|
8250
|
-
import { jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
8251
|
-
|
|
8252
|
-
return value.replace(/[^a-zA-Z0-9_-]/g, "-") || "item";
|
|
8253
|
-
}
|
|
8618
|
+
import { Fragment as Fragment7, jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
8619
|
+
var SidebarCollapsedContext = createContext12(false);
|
|
8254
8620
|
function classes9(base, className) {
|
|
8255
8621
|
return [base, className].filter(Boolean).join(" ");
|
|
8256
8622
|
}
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
width: "14",
|
|
8265
|
-
height: "14",
|
|
8266
|
-
fill: "none",
|
|
8267
|
-
stroke: "currentColor",
|
|
8268
|
-
strokeWidth: "2",
|
|
8269
|
-
strokeLinecap: "round",
|
|
8270
|
-
strokeLinejoin: "round",
|
|
8271
|
-
"aria-hidden": "true",
|
|
8272
|
-
focusable: "false",
|
|
8273
|
-
children: /* @__PURE__ */ jsx41("path", { d: "m6 9 6 6 6-6" })
|
|
8274
|
-
}
|
|
8275
|
-
));
|
|
8623
|
+
var mobileQuery = "(max-width: 720px)";
|
|
8624
|
+
function subscribeMobile(onChange) {
|
|
8625
|
+
if (typeof window === "undefined" || !window.matchMedia) return () => {
|
|
8626
|
+
};
|
|
8627
|
+
const media = window.matchMedia(mobileQuery);
|
|
8628
|
+
media.addEventListener("change", onChange);
|
|
8629
|
+
return () => media.removeEventListener("change", onChange);
|
|
8276
8630
|
}
|
|
8277
|
-
|
|
8278
|
-
|
|
8279
|
-
function useNavigationMenu(component) {
|
|
8280
|
-
const context = useContext12(NavigationMenuContext);
|
|
8281
|
-
if (!context) {
|
|
8282
|
-
throw new Error(
|
|
8283
|
-
`${component} must be used inside <NavigationMenu>.`
|
|
8284
|
-
);
|
|
8285
|
-
}
|
|
8286
|
-
return context;
|
|
8631
|
+
function mobileSnapshot() {
|
|
8632
|
+
return typeof window !== "undefined" && Boolean(window.matchMedia?.(mobileQuery).matches);
|
|
8287
8633
|
}
|
|
8288
|
-
function
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
|
|
8292
|
-
|
|
8293
|
-
|
|
8634
|
+
function Sidebar({
|
|
8635
|
+
classNames,
|
|
8636
|
+
sticky = false,
|
|
8637
|
+
collapsible = false,
|
|
8638
|
+
collapsed,
|
|
8639
|
+
defaultCollapsed,
|
|
8640
|
+
collapseOnMobile = true,
|
|
8641
|
+
onCollapsedChange,
|
|
8642
|
+
collapseLabel = "Collapse sidebar",
|
|
8643
|
+
expandLabel = "Expand sidebar",
|
|
8644
|
+
children,
|
|
8645
|
+
className,
|
|
8646
|
+
...props
|
|
8647
|
+
}) {
|
|
8648
|
+
const [partClasses, scopeParts] = usePartClasses("sidebar", classNames, true);
|
|
8649
|
+
const mobile = useSyncExternalStore2(subscribeMobile, mobileSnapshot, () => false);
|
|
8650
|
+
const [internalCollapsed, setInternalCollapsed] = useState26(defaultCollapsed);
|
|
8651
|
+
const isCollapsed = collapsible && (collapsed ?? internalCollapsed ?? (collapseOnMobile && mobile));
|
|
8652
|
+
const sidebarRef = useRef21(null);
|
|
8653
|
+
const toggleRef = useRef21(null);
|
|
8654
|
+
useEffect22(() => {
|
|
8655
|
+
const active = sidebarRef.current?.ownerDocument.activeElement;
|
|
8656
|
+
if (isCollapsed && active && active !== toggleRef.current && sidebarRef.current?.contains(active)) {
|
|
8657
|
+
toggleRef.current?.focus();
|
|
8658
|
+
}
|
|
8659
|
+
}, [isCollapsed]);
|
|
8660
|
+
function toggleCollapsed() {
|
|
8661
|
+
const next = !isCollapsed;
|
|
8662
|
+
if (collapsed === void 0) setInternalCollapsed(next);
|
|
8663
|
+
onCollapsedChange?.(next);
|
|
8294
8664
|
}
|
|
8295
|
-
return
|
|
8665
|
+
return scopeParts(/* @__PURE__ */ jsx41(SidebarCollapsedContext.Provider, { value: isCollapsed, children: /* @__PURE__ */ jsxs31(
|
|
8666
|
+
"aside",
|
|
8667
|
+
{
|
|
8668
|
+
...props,
|
|
8669
|
+
ref: sidebarRef,
|
|
8670
|
+
"data-sticky": sticky || void 0,
|
|
8671
|
+
"data-collapsed": isCollapsed || void 0,
|
|
8672
|
+
className: mergeClasses(classes9("pimolu-sidebar", className), partClasses.root),
|
|
8673
|
+
children: [
|
|
8674
|
+
collapsible && /* @__PURE__ */ jsx41(
|
|
8675
|
+
"button",
|
|
8676
|
+
{
|
|
8677
|
+
type: "button",
|
|
8678
|
+
ref: toggleRef,
|
|
8679
|
+
className: mergeClasses("pimolu-sidebar__toggle", partClasses.toggle),
|
|
8680
|
+
"aria-label": isCollapsed ? expandLabel : collapseLabel,
|
|
8681
|
+
"aria-expanded": !isCollapsed,
|
|
8682
|
+
onClick: toggleCollapsed,
|
|
8683
|
+
children: /* @__PURE__ */ jsxs31("svg", { viewBox: "0 0 20 20", width: "18", height: "18", fill: "none", stroke: "currentColor", strokeWidth: "1.7", "aria-hidden": "true", children: [
|
|
8684
|
+
/* @__PURE__ */ jsx41("rect", { x: "2.5", y: "3", width: "15", height: "14", rx: "2" }),
|
|
8685
|
+
/* @__PURE__ */ jsx41("path", { d: "M7 3v14" })
|
|
8686
|
+
] })
|
|
8687
|
+
}
|
|
8688
|
+
),
|
|
8689
|
+
children
|
|
8690
|
+
]
|
|
8691
|
+
}
|
|
8692
|
+
) }));
|
|
8296
8693
|
}
|
|
8297
|
-
function
|
|
8694
|
+
function SidebarHeader({
|
|
8298
8695
|
classNames,
|
|
8299
8696
|
children,
|
|
8300
|
-
|
|
8301
|
-
"aria-label": ariaLabel,
|
|
8697
|
+
collapsedContent,
|
|
8302
8698
|
className,
|
|
8303
8699
|
...props
|
|
8304
8700
|
}) {
|
|
8305
|
-
const [partClasses, scopeParts] = usePartClasses("
|
|
8306
|
-
const [openValue, setOpenValue] = useState25(
|
|
8307
|
-
null
|
|
8308
|
-
);
|
|
8309
|
-
const rootRef = useRef20(null);
|
|
8310
|
-
const baseId = `pimolu-navigation-menu-${useId19()}`;
|
|
8311
|
-
useOutsidePointer(
|
|
8312
|
-
rootRef,
|
|
8313
|
-
openValue !== null,
|
|
8314
|
-
() => setOpenValue(null)
|
|
8315
|
-
);
|
|
8316
|
-
useEffect20(() => {
|
|
8317
|
-
if (openValue === null) return;
|
|
8318
|
-
function handleKeyDown(event) {
|
|
8319
|
-
if (event.key !== "Escape" || openValue === null) return;
|
|
8320
|
-
event.preventDefault();
|
|
8321
|
-
document.getElementById(`${baseId}-trigger-${slug2(openValue)}`)?.focus();
|
|
8322
|
-
setOpenValue(null);
|
|
8323
|
-
}
|
|
8324
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
8325
|
-
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
8326
|
-
}, [baseId, openValue]);
|
|
8701
|
+
const [partClasses, scopeParts] = usePartClasses("sidebar", classNames, false);
|
|
8327
8702
|
return scopeParts(/* @__PURE__ */ jsx41(
|
|
8328
|
-
|
|
8703
|
+
"div",
|
|
8329
8704
|
{
|
|
8330
|
-
|
|
8331
|
-
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
children: /* @__PURE__ */
|
|
8337
|
-
"
|
|
8338
|
-
{
|
|
8339
|
-
|
|
8340
|
-
ref: rootRef,
|
|
8341
|
-
"aria-label": ariaLabel ?? label ?? "Main",
|
|
8342
|
-
className: mergeClasses(classes9(
|
|
8343
|
-
"pimolu-navigation-menu",
|
|
8344
|
-
className
|
|
8345
|
-
), partClasses.root),
|
|
8346
|
-
children
|
|
8347
|
-
}
|
|
8348
|
-
)
|
|
8705
|
+
...props,
|
|
8706
|
+
"data-has-collapsed-content": collapsedContent != null || void 0,
|
|
8707
|
+
className: mergeClasses(classes9(
|
|
8708
|
+
"pimolu-sidebar__header",
|
|
8709
|
+
className
|
|
8710
|
+
), partClasses.header, classNames?.root),
|
|
8711
|
+
children: collapsedContent != null ? /* @__PURE__ */ jsxs31(Fragment7, { children: [
|
|
8712
|
+
/* @__PURE__ */ jsx41("div", { className: mergeClasses("pimolu-sidebar__expanded", partClasses.expanded), children }),
|
|
8713
|
+
/* @__PURE__ */ jsx41("div", { className: mergeClasses("pimolu-sidebar__compact", partClasses.compact), children: collapsedContent })
|
|
8714
|
+
] }) : children
|
|
8349
8715
|
}
|
|
8350
8716
|
));
|
|
8351
8717
|
}
|
|
8352
|
-
function
|
|
8718
|
+
function SidebarContent({
|
|
8353
8719
|
classNames,
|
|
8354
8720
|
children,
|
|
8355
8721
|
className,
|
|
8356
8722
|
...props
|
|
8357
8723
|
}) {
|
|
8358
|
-
const [partClasses, scopeParts] = usePartClasses("
|
|
8724
|
+
const [partClasses, scopeParts] = usePartClasses("sidebar", classNames, false);
|
|
8359
8725
|
return scopeParts(/* @__PURE__ */ jsx41(
|
|
8360
|
-
"
|
|
8726
|
+
"nav",
|
|
8361
8727
|
{
|
|
8362
8728
|
...props,
|
|
8729
|
+
"aria-label": props["aria-label"] ?? "Sidebar",
|
|
8363
8730
|
className: mergeClasses(classes9(
|
|
8364
|
-
"pimolu-
|
|
8731
|
+
"pimolu-sidebar__content",
|
|
8365
8732
|
className
|
|
8366
|
-
), partClasses.
|
|
8733
|
+
), partClasses.content, classNames?.root),
|
|
8367
8734
|
children
|
|
8368
8735
|
}
|
|
8369
8736
|
));
|
|
8370
8737
|
}
|
|
8371
|
-
function
|
|
8738
|
+
function SidebarGroup({
|
|
8372
8739
|
classNames,
|
|
8373
|
-
value,
|
|
8374
8740
|
children,
|
|
8375
8741
|
className,
|
|
8376
8742
|
...props
|
|
8377
8743
|
}) {
|
|
8378
|
-
const [partClasses, scopeParts] = usePartClasses("
|
|
8744
|
+
const [partClasses, scopeParts] = usePartClasses("sidebar", classNames, false);
|
|
8745
|
+
return scopeParts(/* @__PURE__ */ jsx41(
|
|
8746
|
+
"div",
|
|
8747
|
+
{
|
|
8748
|
+
...props,
|
|
8749
|
+
className: mergeClasses(classes9(
|
|
8750
|
+
"pimolu-sidebar__group",
|
|
8751
|
+
className
|
|
8752
|
+
), partClasses.group, classNames?.root),
|
|
8753
|
+
children
|
|
8754
|
+
}
|
|
8755
|
+
));
|
|
8756
|
+
}
|
|
8757
|
+
function SidebarGroupLabel({
|
|
8758
|
+
classNames,
|
|
8759
|
+
children,
|
|
8760
|
+
className,
|
|
8761
|
+
...props
|
|
8762
|
+
}) {
|
|
8763
|
+
const [partClasses, scopeParts] = usePartClasses("sidebar", classNames, false);
|
|
8764
|
+
return scopeParts(/* @__PURE__ */ jsx41(
|
|
8765
|
+
"span",
|
|
8766
|
+
{
|
|
8767
|
+
...props,
|
|
8768
|
+
className: mergeClasses(classes9(
|
|
8769
|
+
"pimolu-sidebar__group-label",
|
|
8770
|
+
className
|
|
8771
|
+
), partClasses.groupLabel, classNames?.root),
|
|
8772
|
+
children
|
|
8773
|
+
}
|
|
8774
|
+
));
|
|
8775
|
+
}
|
|
8776
|
+
function SidebarItem({
|
|
8777
|
+
classNames,
|
|
8778
|
+
active = false,
|
|
8779
|
+
disabled = false,
|
|
8780
|
+
icon,
|
|
8781
|
+
children,
|
|
8782
|
+
className,
|
|
8783
|
+
...props
|
|
8784
|
+
}) {
|
|
8785
|
+
const [partClasses, scopeParts, forwardedParts] = usePartClasses("sidebar", classNames, false);
|
|
8786
|
+
const collapsed = useContext12(SidebarCollapsedContext);
|
|
8787
|
+
const label = props["aria-label"] ?? props.title ?? (typeof children === "string" ? children : void 0);
|
|
8788
|
+
const fallbackIcon = typeof children === "string" && children.trim() ? Array.from(children.trim())[0].toLocaleUpperCase() : "\u2022";
|
|
8789
|
+
return scopeParts(/* @__PURE__ */ jsx41(Tooltip, { content: label ?? "", placement: "right", delay: 150, disabled: !collapsed || !label, children: /* @__PURE__ */ jsxs31(
|
|
8790
|
+
Link,
|
|
8791
|
+
{
|
|
8792
|
+
...props,
|
|
8793
|
+
title: props.title ?? (!collapsed ? label : void 0),
|
|
8794
|
+
variant: "muted",
|
|
8795
|
+
underline: "none",
|
|
8796
|
+
disabled,
|
|
8797
|
+
"aria-current": active ? "page" : void 0,
|
|
8798
|
+
className: mergeClasses(classes9(
|
|
8799
|
+
"pimolu-sidebar__item",
|
|
8800
|
+
className
|
|
8801
|
+
), partClasses.item, classNames?.root),
|
|
8802
|
+
classNames: forwardedParts,
|
|
8803
|
+
children: [
|
|
8804
|
+
/* @__PURE__ */ jsx41(
|
|
8805
|
+
"span",
|
|
8806
|
+
{
|
|
8807
|
+
className: mergeClasses(classes9("pimolu-sidebar__icon", icon ? void 0 : "pimolu-sidebar__icon--fallback"), partClasses.icon),
|
|
8808
|
+
"aria-hidden": "true",
|
|
8809
|
+
children: icon ?? fallbackIcon
|
|
8810
|
+
}
|
|
8811
|
+
),
|
|
8812
|
+
/* @__PURE__ */ jsx41("span", { className: mergeClasses("pimolu-sidebar__label", partClasses.label), children })
|
|
8813
|
+
]
|
|
8814
|
+
}
|
|
8815
|
+
) }));
|
|
8816
|
+
}
|
|
8817
|
+
function SidebarFooter({
|
|
8818
|
+
classNames,
|
|
8819
|
+
children,
|
|
8820
|
+
collapsedContent,
|
|
8821
|
+
className,
|
|
8822
|
+
...props
|
|
8823
|
+
}) {
|
|
8824
|
+
const [partClasses, scopeParts] = usePartClasses("sidebar", classNames, false);
|
|
8825
|
+
return scopeParts(/* @__PURE__ */ jsx41(
|
|
8826
|
+
"div",
|
|
8827
|
+
{
|
|
8828
|
+
...props,
|
|
8829
|
+
"data-has-collapsed-content": collapsedContent != null || void 0,
|
|
8830
|
+
className: mergeClasses(classes9(
|
|
8831
|
+
"pimolu-sidebar__footer",
|
|
8832
|
+
className
|
|
8833
|
+
), partClasses.footer, classNames?.root),
|
|
8834
|
+
children: collapsedContent != null ? /* @__PURE__ */ jsxs31(Fragment7, { children: [
|
|
8835
|
+
/* @__PURE__ */ jsx41("div", { className: mergeClasses("pimolu-sidebar__expanded", partClasses.expanded), children }),
|
|
8836
|
+
/* @__PURE__ */ jsx41("div", { className: mergeClasses("pimolu-sidebar__compact", partClasses.compact), children: collapsedContent })
|
|
8837
|
+
] }) : children
|
|
8838
|
+
}
|
|
8839
|
+
));
|
|
8840
|
+
}
|
|
8841
|
+
|
|
8842
|
+
// navigation-menu/navigation-menu.tsx
|
|
8843
|
+
import {
|
|
8844
|
+
createContext as createContext13,
|
|
8845
|
+
useContext as useContext13,
|
|
8846
|
+
useEffect as useEffect23,
|
|
8847
|
+
useId as useId20,
|
|
8848
|
+
useRef as useRef22,
|
|
8849
|
+
useState as useState27
|
|
8850
|
+
} from "react";
|
|
8851
|
+
import { jsx as jsx42, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
8852
|
+
function slug2(value) {
|
|
8853
|
+
return value.replace(/[^a-zA-Z0-9_-]/g, "-") || "item";
|
|
8854
|
+
}
|
|
8855
|
+
function classes10(base, className) {
|
|
8856
|
+
return [base, className].filter(Boolean).join(" ");
|
|
8857
|
+
}
|
|
8858
|
+
function Chevron4({ classNames } = {}) {
|
|
8859
|
+
const [partClasses, scopeParts] = usePartClasses("navigation-menu", classNames, false);
|
|
8860
|
+
return scopeParts(/* @__PURE__ */ jsx42(
|
|
8861
|
+
"svg",
|
|
8862
|
+
{
|
|
8863
|
+
className: mergeClasses("pimolu-navigation-menu__chevron", partClasses.chevron),
|
|
8864
|
+
viewBox: "0 0 24 24",
|
|
8865
|
+
width: "14",
|
|
8866
|
+
height: "14",
|
|
8867
|
+
fill: "none",
|
|
8868
|
+
stroke: "currentColor",
|
|
8869
|
+
strokeWidth: "2",
|
|
8870
|
+
strokeLinecap: "round",
|
|
8871
|
+
strokeLinejoin: "round",
|
|
8872
|
+
"aria-hidden": "true",
|
|
8873
|
+
focusable: "false",
|
|
8874
|
+
children: /* @__PURE__ */ jsx42("path", { d: "m6 9 6 6 6-6" })
|
|
8875
|
+
}
|
|
8876
|
+
));
|
|
8877
|
+
}
|
|
8878
|
+
var NavigationMenuContext = createContext13(null);
|
|
8879
|
+
var NavigationMenuItemContext = createContext13(null);
|
|
8880
|
+
function useNavigationMenu(component) {
|
|
8881
|
+
const context = useContext13(NavigationMenuContext);
|
|
8882
|
+
if (!context) {
|
|
8883
|
+
throw new Error(
|
|
8884
|
+
`${component} must be used inside <NavigationMenu>.`
|
|
8885
|
+
);
|
|
8886
|
+
}
|
|
8887
|
+
return context;
|
|
8888
|
+
}
|
|
8889
|
+
function useNavigationMenuItem(component) {
|
|
8890
|
+
const context = useContext13(NavigationMenuItemContext);
|
|
8891
|
+
if (!context) {
|
|
8892
|
+
throw new Error(
|
|
8893
|
+
`${component} must be used inside <NavigationMenuItem>.`
|
|
8894
|
+
);
|
|
8895
|
+
}
|
|
8896
|
+
return context;
|
|
8897
|
+
}
|
|
8898
|
+
function NavigationMenu({
|
|
8899
|
+
classNames,
|
|
8900
|
+
children,
|
|
8901
|
+
label,
|
|
8902
|
+
"aria-label": ariaLabel,
|
|
8903
|
+
className,
|
|
8904
|
+
...props
|
|
8905
|
+
}) {
|
|
8906
|
+
const [partClasses, scopeParts] = usePartClasses("navigation-menu", classNames, true);
|
|
8907
|
+
const [openValue, setOpenValue] = useState27(
|
|
8908
|
+
null
|
|
8909
|
+
);
|
|
8910
|
+
const rootRef = useRef22(null);
|
|
8911
|
+
const baseId = `pimolu-navigation-menu-${useId20()}`;
|
|
8912
|
+
useOutsidePointer(
|
|
8913
|
+
rootRef,
|
|
8914
|
+
openValue !== null,
|
|
8915
|
+
() => setOpenValue(null)
|
|
8916
|
+
);
|
|
8917
|
+
useEffect23(() => {
|
|
8918
|
+
if (openValue === null) return;
|
|
8919
|
+
function handleKeyDown(event) {
|
|
8920
|
+
if (event.key !== "Escape" || openValue === null) return;
|
|
8921
|
+
event.preventDefault();
|
|
8922
|
+
document.getElementById(`${baseId}-trigger-${slug2(openValue)}`)?.focus();
|
|
8923
|
+
setOpenValue(null);
|
|
8924
|
+
}
|
|
8925
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
8926
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
8927
|
+
}, [baseId, openValue]);
|
|
8928
|
+
return scopeParts(/* @__PURE__ */ jsx42(
|
|
8929
|
+
NavigationMenuContext.Provider,
|
|
8930
|
+
{
|
|
8931
|
+
value: {
|
|
8932
|
+
baseId,
|
|
8933
|
+
openValue,
|
|
8934
|
+
setOpenValue,
|
|
8935
|
+
rootRef
|
|
8936
|
+
},
|
|
8937
|
+
children: /* @__PURE__ */ jsx42(
|
|
8938
|
+
"nav",
|
|
8939
|
+
{
|
|
8940
|
+
...props,
|
|
8941
|
+
ref: rootRef,
|
|
8942
|
+
"aria-label": ariaLabel ?? label ?? "Main",
|
|
8943
|
+
className: mergeClasses(classes10(
|
|
8944
|
+
"pimolu-navigation-menu",
|
|
8945
|
+
className
|
|
8946
|
+
), partClasses.root),
|
|
8947
|
+
children
|
|
8948
|
+
}
|
|
8949
|
+
)
|
|
8950
|
+
}
|
|
8951
|
+
));
|
|
8952
|
+
}
|
|
8953
|
+
function NavigationMenuList({
|
|
8954
|
+
classNames,
|
|
8955
|
+
children,
|
|
8956
|
+
className,
|
|
8957
|
+
...props
|
|
8958
|
+
}) {
|
|
8959
|
+
const [partClasses, scopeParts] = usePartClasses("navigation-menu", classNames, false);
|
|
8960
|
+
return scopeParts(/* @__PURE__ */ jsx42(
|
|
8961
|
+
"ul",
|
|
8962
|
+
{
|
|
8963
|
+
...props,
|
|
8964
|
+
className: mergeClasses(classes10(
|
|
8965
|
+
"pimolu-navigation-menu__list",
|
|
8966
|
+
className
|
|
8967
|
+
), partClasses.list, classNames?.root),
|
|
8968
|
+
children
|
|
8969
|
+
}
|
|
8970
|
+
));
|
|
8971
|
+
}
|
|
8972
|
+
function NavigationMenuItem({
|
|
8973
|
+
classNames,
|
|
8974
|
+
value,
|
|
8975
|
+
children,
|
|
8976
|
+
className,
|
|
8977
|
+
...props
|
|
8978
|
+
}) {
|
|
8979
|
+
const [partClasses, scopeParts] = usePartClasses("navigation-menu", classNames, false);
|
|
8379
8980
|
const root = useNavigationMenu("NavigationMenuItem");
|
|
8380
8981
|
const triggerId = `${root.baseId}-trigger-${slug2(value)}`;
|
|
8381
8982
|
const contentId = `${root.baseId}-content-${slug2(value)}`;
|
|
8382
|
-
return scopeParts(/* @__PURE__ */
|
|
8983
|
+
return scopeParts(/* @__PURE__ */ jsx42(
|
|
8383
8984
|
NavigationMenuItemContext.Provider,
|
|
8384
8985
|
{
|
|
8385
8986
|
value: { value, triggerId, contentId },
|
|
8386
|
-
children: /* @__PURE__ */
|
|
8987
|
+
children: /* @__PURE__ */ jsx42(
|
|
8387
8988
|
"li",
|
|
8388
8989
|
{
|
|
8389
8990
|
...props,
|
|
8390
|
-
className: mergeClasses(
|
|
8991
|
+
className: mergeClasses(classes10(
|
|
8391
8992
|
"pimolu-navigation-menu__item",
|
|
8392
8993
|
className
|
|
8393
8994
|
), partClasses.item, classNames?.root),
|
|
@@ -8426,7 +9027,7 @@ function NavigationMenuTrigger({
|
|
|
8426
9027
|
root.setOpenValue(null);
|
|
8427
9028
|
}
|
|
8428
9029
|
}
|
|
8429
|
-
return scopeParts(/* @__PURE__ */
|
|
9030
|
+
return scopeParts(/* @__PURE__ */ jsxs32(
|
|
8430
9031
|
"button",
|
|
8431
9032
|
{
|
|
8432
9033
|
type: "button",
|
|
@@ -8434,15 +9035,15 @@ function NavigationMenuTrigger({
|
|
|
8434
9035
|
"aria-expanded": open,
|
|
8435
9036
|
"aria-controls": item.contentId,
|
|
8436
9037
|
"data-state": open ? "open" : "closed",
|
|
8437
|
-
className: mergeClasses(
|
|
9038
|
+
className: mergeClasses(classes10(
|
|
8438
9039
|
"pimolu-navigation-menu__trigger",
|
|
8439
9040
|
className
|
|
8440
9041
|
), partClasses.trigger, classNames?.root),
|
|
8441
9042
|
onClick: () => root.setOpenValue(open ? null : item.value),
|
|
8442
9043
|
onKeyDown: handleKeyDown,
|
|
8443
9044
|
children: [
|
|
8444
|
-
/* @__PURE__ */
|
|
8445
|
-
/* @__PURE__ */
|
|
9045
|
+
/* @__PURE__ */ jsx42("span", { children }),
|
|
9046
|
+
/* @__PURE__ */ jsx42(Chevron4, {})
|
|
8446
9047
|
]
|
|
8447
9048
|
}
|
|
8448
9049
|
));
|
|
@@ -8456,14 +9057,14 @@ function NavigationMenuContent({
|
|
|
8456
9057
|
const root = useNavigationMenu("NavigationMenuContent");
|
|
8457
9058
|
const item = useNavigationMenuItem("NavigationMenuContent");
|
|
8458
9059
|
const open = root.openValue === item.value;
|
|
8459
|
-
return scopeParts(/* @__PURE__ */
|
|
9060
|
+
return scopeParts(/* @__PURE__ */ jsx42(
|
|
8460
9061
|
"div",
|
|
8461
9062
|
{
|
|
8462
9063
|
id: item.contentId,
|
|
8463
9064
|
"aria-labelledby": item.triggerId,
|
|
8464
9065
|
hidden: !open,
|
|
8465
9066
|
"data-state": open ? "open" : "closed",
|
|
8466
|
-
className: mergeClasses(
|
|
9067
|
+
className: mergeClasses(classes10(
|
|
8467
9068
|
"pimolu-navigation-menu__content",
|
|
8468
9069
|
className
|
|
8469
9070
|
), partClasses.content, classNames?.root),
|
|
@@ -8482,7 +9083,7 @@ function NavigationMenuLink({
|
|
|
8482
9083
|
}) {
|
|
8483
9084
|
const [partClasses, scopeParts, forwardedParts] = usePartClasses("navigation-menu", classNames, false);
|
|
8484
9085
|
const root = useNavigationMenu("NavigationMenuLink");
|
|
8485
|
-
return scopeParts(/* @__PURE__ */
|
|
9086
|
+
return scopeParts(/* @__PURE__ */ jsx42(
|
|
8486
9087
|
Link,
|
|
8487
9088
|
{
|
|
8488
9089
|
...props,
|
|
@@ -8490,7 +9091,7 @@ function NavigationMenuLink({
|
|
|
8490
9091
|
underline: "none",
|
|
8491
9092
|
disabled,
|
|
8492
9093
|
"aria-current": active ? "page" : void 0,
|
|
8493
|
-
className: mergeClasses(
|
|
9094
|
+
className: mergeClasses(classes10(
|
|
8494
9095
|
"pimolu-navigation-menu__link",
|
|
8495
9096
|
className
|
|
8496
9097
|
), partClasses.link, classNames?.root),
|
|
@@ -8507,8 +9108,8 @@ function NavigationMenuLink({
|
|
|
8507
9108
|
}
|
|
8508
9109
|
|
|
8509
9110
|
// scroll-area/scroll-area.tsx
|
|
8510
|
-
import { jsx as
|
|
8511
|
-
function
|
|
9111
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
9112
|
+
function classes11(base, className) {
|
|
8512
9113
|
return [base, className].filter(Boolean).join(" ");
|
|
8513
9114
|
}
|
|
8514
9115
|
function ScrollArea({
|
|
@@ -8526,19 +9127,19 @@ function ScrollArea({
|
|
|
8526
9127
|
"aria-labelledby": ariaLabelledBy,
|
|
8527
9128
|
...rest
|
|
8528
9129
|
} = props;
|
|
8529
|
-
return scopeParts(/* @__PURE__ */
|
|
9130
|
+
return scopeParts(/* @__PURE__ */ jsx43(
|
|
8530
9131
|
"div",
|
|
8531
9132
|
{
|
|
8532
9133
|
...rest,
|
|
8533
9134
|
"data-orientation": orientation,
|
|
8534
|
-
className: mergeClasses(
|
|
9135
|
+
className: mergeClasses(classes11(
|
|
8535
9136
|
"pimolu-scroll-area",
|
|
8536
9137
|
className
|
|
8537
9138
|
), partClasses.root),
|
|
8538
|
-
children: /* @__PURE__ */
|
|
9139
|
+
children: /* @__PURE__ */ jsx43(
|
|
8539
9140
|
"div",
|
|
8540
9141
|
{
|
|
8541
|
-
className: mergeClasses(
|
|
9142
|
+
className: mergeClasses(classes11(
|
|
8542
9143
|
"pimolu-scroll-area__viewport",
|
|
8543
9144
|
viewportClassName
|
|
8544
9145
|
), partClasses.viewport),
|
|
@@ -8555,11 +9156,11 @@ function ScrollArea({
|
|
|
8555
9156
|
|
|
8556
9157
|
// tree-view/tree-view.tsx
|
|
8557
9158
|
import {
|
|
8558
|
-
useEffect as
|
|
8559
|
-
useRef as
|
|
8560
|
-
useState as
|
|
9159
|
+
useEffect as useEffect24,
|
|
9160
|
+
useRef as useRef23,
|
|
9161
|
+
useState as useState28
|
|
8561
9162
|
} from "react";
|
|
8562
|
-
import { jsx as
|
|
9163
|
+
import { jsx as jsx44, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
8563
9164
|
function flatten(items, expanded, level = 1, parentId) {
|
|
8564
9165
|
const nodes = [];
|
|
8565
9166
|
for (const item of items) {
|
|
@@ -8579,7 +9180,7 @@ function flatten(items, expanded, level = 1, parentId) {
|
|
|
8579
9180
|
}
|
|
8580
9181
|
function Chevron5({ classNames } = {}) {
|
|
8581
9182
|
const [partClasses, scopeParts] = usePartClasses("tree-view", classNames, false);
|
|
8582
|
-
return scopeParts(/* @__PURE__ */
|
|
9183
|
+
return scopeParts(/* @__PURE__ */ jsx44(
|
|
8583
9184
|
"svg",
|
|
8584
9185
|
{
|
|
8585
9186
|
className: mergeClasses("pimolu-tree__chevron", partClasses.chevron),
|
|
@@ -8593,7 +9194,7 @@ function Chevron5({ classNames } = {}) {
|
|
|
8593
9194
|
strokeLinejoin: "round",
|
|
8594
9195
|
"aria-hidden": "true",
|
|
8595
9196
|
focusable: "false",
|
|
8596
|
-
children: /* @__PURE__ */
|
|
9197
|
+
children: /* @__PURE__ */ jsx44("path", { d: "m9 18 6-6-6-6" })
|
|
8597
9198
|
}
|
|
8598
9199
|
));
|
|
8599
9200
|
}
|
|
@@ -8611,16 +9212,16 @@ function TreeView({
|
|
|
8611
9212
|
}) {
|
|
8612
9213
|
const [partClasses, scopeParts] = usePartClasses("tree-view", classNames, true);
|
|
8613
9214
|
const isExpandedControlled = controlledExpanded !== void 0;
|
|
8614
|
-
const [uncontrolledExpanded, setUncontrolledExpanded] =
|
|
9215
|
+
const [uncontrolledExpanded, setUncontrolledExpanded] = useState28([...defaultExpandedIds]);
|
|
8615
9216
|
const expandedIds = isExpandedControlled ? [...controlledExpanded] : uncontrolledExpanded;
|
|
8616
9217
|
const expanded = new Set(expandedIds);
|
|
8617
9218
|
const isSelectedControlled = controlledSelected !== void 0;
|
|
8618
|
-
const [uncontrolledSelected, setUncontrolledSelected] =
|
|
9219
|
+
const [uncontrolledSelected, setUncontrolledSelected] = useState28(defaultSelectedId);
|
|
8619
9220
|
const selectedId = isSelectedControlled ? controlledSelected : uncontrolledSelected;
|
|
8620
9221
|
const visible = flatten(items, expanded);
|
|
8621
|
-
const [focusedId, setFocusedId] =
|
|
8622
|
-
const refs =
|
|
8623
|
-
|
|
9222
|
+
const [focusedId, setFocusedId] = useState28(selectedId ?? visible[0]?.item.id);
|
|
9223
|
+
const refs = useRef23(/* @__PURE__ */ new Map());
|
|
9224
|
+
useEffect24(() => {
|
|
8624
9225
|
if (focusedId && visible.some((node) => node.item.id === focusedId)) {
|
|
8625
9226
|
return;
|
|
8626
9227
|
}
|
|
@@ -8726,7 +9327,7 @@ function TreeView({
|
|
|
8726
9327
|
select(current.item.id);
|
|
8727
9328
|
}
|
|
8728
9329
|
}
|
|
8729
|
-
return scopeParts(/* @__PURE__ */
|
|
9330
|
+
return scopeParts(/* @__PURE__ */ jsx44(
|
|
8730
9331
|
"ul",
|
|
8731
9332
|
{
|
|
8732
9333
|
role: "tree",
|
|
@@ -8741,7 +9342,7 @@ function TreeView({
|
|
|
8741
9342
|
const open = expanded.has(item.id);
|
|
8742
9343
|
const hasChildren = Boolean(item.children?.length);
|
|
8743
9344
|
const selected = item.id === selectedId;
|
|
8744
|
-
return /* @__PURE__ */
|
|
9345
|
+
return /* @__PURE__ */ jsxs33(
|
|
8745
9346
|
"li",
|
|
8746
9347
|
{
|
|
8747
9348
|
ref: (element) => {
|
|
@@ -8772,15 +9373,15 @@ function TreeView({
|
|
|
8772
9373
|
}
|
|
8773
9374
|
},
|
|
8774
9375
|
children: [
|
|
8775
|
-
/* @__PURE__ */
|
|
9376
|
+
/* @__PURE__ */ jsx44(
|
|
8776
9377
|
"span",
|
|
8777
9378
|
{
|
|
8778
9379
|
className: mergeClasses("pimolu-tree__chevron-slot", partClasses.chevronSlot),
|
|
8779
9380
|
"aria-hidden": "true",
|
|
8780
|
-
children: hasChildren && /* @__PURE__ */
|
|
9381
|
+
children: hasChildren && /* @__PURE__ */ jsx44(Chevron5, {})
|
|
8781
9382
|
}
|
|
8782
9383
|
),
|
|
8783
|
-
/* @__PURE__ */
|
|
9384
|
+
/* @__PURE__ */ jsx44("span", { className: mergeClasses("pimolu-tree__label", partClasses.label), children: item.label })
|
|
8784
9385
|
]
|
|
8785
9386
|
},
|
|
8786
9387
|
item.id
|
|
@@ -8814,8 +9415,8 @@ var listVariants = createVariants33({
|
|
|
8814
9415
|
});
|
|
8815
9416
|
|
|
8816
9417
|
// list/list.tsx
|
|
8817
|
-
import { Fragment as Fragment8, jsx as
|
|
8818
|
-
function
|
|
9418
|
+
import { Fragment as Fragment8, jsx as jsx45, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
9419
|
+
function classes12(base, ...extra) {
|
|
8819
9420
|
return [base, ...extra].filter(Boolean).join(" ");
|
|
8820
9421
|
}
|
|
8821
9422
|
function List({
|
|
@@ -8827,7 +9428,7 @@ function List({
|
|
|
8827
9428
|
...props
|
|
8828
9429
|
}) {
|
|
8829
9430
|
const [partClasses, scopeParts] = usePartClasses("list", classNames, true);
|
|
8830
|
-
return scopeParts(/* @__PURE__ */
|
|
9431
|
+
return scopeParts(/* @__PURE__ */ jsx45(
|
|
8831
9432
|
"ul",
|
|
8832
9433
|
{
|
|
8833
9434
|
...props,
|
|
@@ -8850,8 +9451,8 @@ function ListItem({
|
|
|
8850
9451
|
...props
|
|
8851
9452
|
}) {
|
|
8852
9453
|
const [partClasses, scopeParts] = usePartClasses("list", classNames, false);
|
|
8853
|
-
const content = /* @__PURE__ */
|
|
8854
|
-
start && /* @__PURE__ */
|
|
9454
|
+
const content = /* @__PURE__ */ jsxs34(Fragment8, { children: [
|
|
9455
|
+
start && /* @__PURE__ */ jsx45(
|
|
8855
9456
|
"span",
|
|
8856
9457
|
{
|
|
8857
9458
|
className: mergeClasses("pimolu-list__start", partClasses.start, classNames?.root),
|
|
@@ -8859,23 +9460,23 @@ function ListItem({
|
|
|
8859
9460
|
children: start
|
|
8860
9461
|
}
|
|
8861
9462
|
),
|
|
8862
|
-
/* @__PURE__ */
|
|
8863
|
-
(title || children) && /* @__PURE__ */
|
|
8864
|
-
description && /* @__PURE__ */
|
|
9463
|
+
/* @__PURE__ */ jsxs34("span", { className: mergeClasses("pimolu-list__main", partClasses.main, classNames?.root), children: [
|
|
9464
|
+
(title || children) && /* @__PURE__ */ jsx45("span", { className: mergeClasses("pimolu-list__title", partClasses.title), children: title ?? children }),
|
|
9465
|
+
description && /* @__PURE__ */ jsx45("span", { className: mergeClasses("pimolu-list__description", partClasses.description), children: description })
|
|
8865
9466
|
] }),
|
|
8866
|
-
end && /* @__PURE__ */
|
|
9467
|
+
end && /* @__PURE__ */ jsx45("span", { className: mergeClasses("pimolu-list__end", partClasses.end, classNames?.root), children: end })
|
|
8867
9468
|
] });
|
|
8868
|
-
return scopeParts(/* @__PURE__ */
|
|
9469
|
+
return scopeParts(/* @__PURE__ */ jsx45(
|
|
8869
9470
|
"li",
|
|
8870
9471
|
{
|
|
8871
9472
|
...props,
|
|
8872
9473
|
"aria-current": active ? "true" : void 0,
|
|
8873
9474
|
"data-state": disabled ? "disabled" : active ? "active" : "default",
|
|
8874
|
-
className: mergeClasses(
|
|
9475
|
+
className: mergeClasses(classes12(
|
|
8875
9476
|
"pimolu-list__item",
|
|
8876
9477
|
className
|
|
8877
9478
|
), partClasses.item, classNames?.root),
|
|
8878
|
-
children: onClick ? /* @__PURE__ */
|
|
9479
|
+
children: onClick ? /* @__PURE__ */ jsx45(
|
|
8879
9480
|
"button",
|
|
8880
9481
|
{
|
|
8881
9482
|
type: "button",
|
|
@@ -8884,7 +9485,7 @@ function ListItem({
|
|
|
8884
9485
|
onClick,
|
|
8885
9486
|
children: content
|
|
8886
9487
|
}
|
|
8887
|
-
) : /* @__PURE__ */
|
|
9488
|
+
) : /* @__PURE__ */ jsx45("div", { className: mergeClasses("pimolu-list__row", partClasses.row), children: content })
|
|
8888
9489
|
}
|
|
8889
9490
|
));
|
|
8890
9491
|
}
|
|
@@ -8918,8 +9519,8 @@ var descriptionListVariants = createVariants34({
|
|
|
8918
9519
|
});
|
|
8919
9520
|
|
|
8920
9521
|
// description-list/description-list.tsx
|
|
8921
|
-
import { jsx as
|
|
8922
|
-
function
|
|
9522
|
+
import { jsx as jsx46, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
9523
|
+
function classes13(base, className) {
|
|
8923
9524
|
return [base, className].filter(Boolean).join(" ");
|
|
8924
9525
|
}
|
|
8925
9526
|
function DescriptionList({
|
|
@@ -8932,7 +9533,7 @@ function DescriptionList({
|
|
|
8932
9533
|
...props
|
|
8933
9534
|
}) {
|
|
8934
9535
|
const [partClasses, scopeParts] = usePartClasses("description-list", classNames, true);
|
|
8935
|
-
return scopeParts(/* @__PURE__ */
|
|
9536
|
+
return scopeParts(/* @__PURE__ */ jsx46(
|
|
8936
9537
|
"dl",
|
|
8937
9538
|
{
|
|
8938
9539
|
...props,
|
|
@@ -8951,25 +9552,25 @@ function DescriptionItem({
|
|
|
8951
9552
|
className
|
|
8952
9553
|
}) {
|
|
8953
9554
|
const [partClasses, scopeParts] = usePartClasses("description-list", classNames, false);
|
|
8954
|
-
return scopeParts(/* @__PURE__ */
|
|
9555
|
+
return scopeParts(/* @__PURE__ */ jsxs35(
|
|
8955
9556
|
"div",
|
|
8956
9557
|
{
|
|
8957
|
-
className: mergeClasses(
|
|
9558
|
+
className: mergeClasses(classes13(
|
|
8958
9559
|
"pimolu-description-list__item",
|
|
8959
9560
|
className
|
|
8960
9561
|
), partClasses.item, classNames?.root),
|
|
8961
9562
|
children: [
|
|
8962
|
-
/* @__PURE__ */
|
|
8963
|
-
/* @__PURE__ */
|
|
9563
|
+
/* @__PURE__ */ jsx46("dt", { className: mergeClasses("pimolu-description-list__term", partClasses.term), children: term }),
|
|
9564
|
+
/* @__PURE__ */ jsx46("dd", { className: mergeClasses("pimolu-description-list__details", partClasses.details), children: details })
|
|
8964
9565
|
]
|
|
8965
9566
|
}
|
|
8966
9567
|
));
|
|
8967
9568
|
}
|
|
8968
9569
|
|
|
8969
9570
|
// alert-dialog/alert-dialog.tsx
|
|
8970
|
-
import { jsx as
|
|
9571
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
8971
9572
|
function AlertDialog(props) {
|
|
8972
|
-
return /* @__PURE__ */
|
|
9573
|
+
return /* @__PURE__ */ jsx47(Dialog, { ...props });
|
|
8973
9574
|
}
|
|
8974
9575
|
function AlertDialogContent({
|
|
8975
9576
|
classNames,
|
|
@@ -8977,7 +9578,7 @@ function AlertDialogContent({
|
|
|
8977
9578
|
...props
|
|
8978
9579
|
}) {
|
|
8979
9580
|
const [, scopeParts, forwardedParts] = usePartClasses("alert-dialog", classNames, true);
|
|
8980
|
-
return scopeParts(/* @__PURE__ */
|
|
9581
|
+
return scopeParts(/* @__PURE__ */ jsx47(
|
|
8981
9582
|
DialogContent,
|
|
8982
9583
|
{
|
|
8983
9584
|
closeOnOverlayClick: false,
|
|
@@ -8993,73 +9594,29 @@ function AlertDialogContent({
|
|
|
8993
9594
|
function AlertDialogAction({
|
|
8994
9595
|
children
|
|
8995
9596
|
}) {
|
|
8996
|
-
return /* @__PURE__ */
|
|
9597
|
+
return /* @__PURE__ */ jsx47(DialogClose, { children });
|
|
8997
9598
|
}
|
|
8998
9599
|
function AlertDialogCancel({
|
|
8999
9600
|
children
|
|
9000
9601
|
}) {
|
|
9001
|
-
return /* @__PURE__ */
|
|
9602
|
+
return /* @__PURE__ */ jsx47(DialogClose, { children });
|
|
9002
9603
|
}
|
|
9003
9604
|
|
|
9004
9605
|
// dropdown-menu/dropdown-menu.tsx
|
|
9005
9606
|
import {
|
|
9006
|
-
cloneElement as
|
|
9007
|
-
createContext as
|
|
9008
|
-
isValidElement as
|
|
9009
|
-
useCallback as
|
|
9010
|
-
useContext as
|
|
9011
|
-
useId as
|
|
9012
|
-
useRef as
|
|
9013
|
-
useState as
|
|
9607
|
+
cloneElement as cloneElement7,
|
|
9608
|
+
createContext as createContext14,
|
|
9609
|
+
isValidElement as isValidElement8,
|
|
9610
|
+
useCallback as useCallback11,
|
|
9611
|
+
useContext as useContext14,
|
|
9612
|
+
useId as useId21,
|
|
9613
|
+
useRef as useRef24,
|
|
9614
|
+
useState as useState29
|
|
9014
9615
|
} from "react";
|
|
9015
|
-
|
|
9016
|
-
|
|
9017
|
-
import { useEffect as useEffect22, useRef as useRef22, useState as useState27 } from "react";
|
|
9018
|
-
function prefersReducedMotion5() {
|
|
9019
|
-
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
9020
|
-
}
|
|
9021
|
-
function usePresence(open, exitDuration = 150) {
|
|
9022
|
-
const [rendered, setRendered] = useState27(open);
|
|
9023
|
-
const [state, setState] = useState27(
|
|
9024
|
-
"open"
|
|
9025
|
-
);
|
|
9026
|
-
const timer = useRef22(
|
|
9027
|
-
null
|
|
9028
|
-
);
|
|
9029
|
-
function cancel() {
|
|
9030
|
-
if (timer.current !== null) {
|
|
9031
|
-
clearTimeout(timer.current);
|
|
9032
|
-
timer.current = null;
|
|
9033
|
-
}
|
|
9034
|
-
}
|
|
9035
|
-
useEffect22(() => {
|
|
9036
|
-
if (open) {
|
|
9037
|
-
cancel();
|
|
9038
|
-
setRendered(true);
|
|
9039
|
-
setState("open");
|
|
9040
|
-
return;
|
|
9041
|
-
}
|
|
9042
|
-
if (!rendered) return;
|
|
9043
|
-
if (prefersReducedMotion5()) {
|
|
9044
|
-
setRendered(false);
|
|
9045
|
-
return;
|
|
9046
|
-
}
|
|
9047
|
-
setState("closing");
|
|
9048
|
-
timer.current = setTimeout(() => {
|
|
9049
|
-
setRendered(false);
|
|
9050
|
-
timer.current = null;
|
|
9051
|
-
}, exitDuration);
|
|
9052
|
-
return cancel;
|
|
9053
|
-
}, [open, rendered, exitDuration]);
|
|
9054
|
-
useEffect22(() => cancel, []);
|
|
9055
|
-
return { rendered, state };
|
|
9056
|
-
}
|
|
9057
|
-
|
|
9058
|
-
// dropdown-menu/dropdown-menu.tsx
|
|
9059
|
-
import { jsx as jsx47, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
9060
|
-
var Context = createContext13(null);
|
|
9616
|
+
import { jsx as jsx48, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
9617
|
+
var Context = createContext14(null);
|
|
9061
9618
|
function useMenu(component) {
|
|
9062
|
-
const context =
|
|
9619
|
+
const context = useContext14(Context);
|
|
9063
9620
|
if (!context) {
|
|
9064
9621
|
throw new Error(
|
|
9065
9622
|
`${component} must be used inside <DropdownMenu>.`
|
|
@@ -9073,9 +9630,9 @@ function DropdownMenu({
|
|
|
9073
9630
|
defaultOpen = false,
|
|
9074
9631
|
onOpenChange
|
|
9075
9632
|
}) {
|
|
9076
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
9633
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState29(defaultOpen);
|
|
9077
9634
|
const open = controlledOpen === void 0 ? uncontrolledOpen : controlledOpen;
|
|
9078
|
-
const setOpen =
|
|
9635
|
+
const setOpen = useCallback11(
|
|
9079
9636
|
(next) => {
|
|
9080
9637
|
if (controlledOpen === void 0) {
|
|
9081
9638
|
setUncontrolledOpen(next);
|
|
@@ -9084,10 +9641,10 @@ function DropdownMenu({
|
|
|
9084
9641
|
},
|
|
9085
9642
|
[controlledOpen, onOpenChange]
|
|
9086
9643
|
);
|
|
9087
|
-
const triggerRef =
|
|
9088
|
-
const contentRef =
|
|
9089
|
-
const scopeRef =
|
|
9090
|
-
const contentId = `pimolu-dropdown-${
|
|
9644
|
+
const triggerRef = useRef24(null);
|
|
9645
|
+
const contentRef = useRef24(null);
|
|
9646
|
+
const scopeRef = useRef24(null);
|
|
9647
|
+
const contentId = `pimolu-dropdown-${useId21()}`;
|
|
9091
9648
|
const context = {
|
|
9092
9649
|
open,
|
|
9093
9650
|
setOpen,
|
|
@@ -9096,8 +9653,8 @@ function DropdownMenu({
|
|
|
9096
9653
|
contentRef,
|
|
9097
9654
|
scopeRef
|
|
9098
9655
|
};
|
|
9099
|
-
return /* @__PURE__ */
|
|
9100
|
-
/* @__PURE__ */
|
|
9656
|
+
return /* @__PURE__ */ jsxs36(Context.Provider, { value: context, children: [
|
|
9657
|
+
/* @__PURE__ */ jsx48("span", { ref: context.scopeRef, hidden: true }),
|
|
9101
9658
|
children
|
|
9102
9659
|
] });
|
|
9103
9660
|
}
|
|
@@ -9105,7 +9662,7 @@ function DropdownMenuTrigger({
|
|
|
9105
9662
|
children
|
|
9106
9663
|
}) {
|
|
9107
9664
|
const menu = useMenu("DropdownMenuTrigger");
|
|
9108
|
-
if (!
|
|
9665
|
+
if (!isValidElement8(children)) return children;
|
|
9109
9666
|
const trigger = children;
|
|
9110
9667
|
const props = trigger.props;
|
|
9111
9668
|
function assignRef(node) {
|
|
@@ -9119,7 +9676,7 @@ function DropdownMenuTrigger({
|
|
|
9119
9676
|
childRef.current = node;
|
|
9120
9677
|
}
|
|
9121
9678
|
}
|
|
9122
|
-
return
|
|
9679
|
+
return cloneElement7(trigger, {
|
|
9123
9680
|
ref: assignRef,
|
|
9124
9681
|
"aria-haspopup": "menu",
|
|
9125
9682
|
"aria-expanded": menu.open,
|
|
@@ -9162,7 +9719,7 @@ function DropdownMenuContent({
|
|
|
9162
9719
|
maxHeight: 320
|
|
9163
9720
|
}
|
|
9164
9721
|
);
|
|
9165
|
-
const attachContent =
|
|
9722
|
+
const attachContent = useCallback11((node) => {
|
|
9166
9723
|
menu.contentRef.current = node;
|
|
9167
9724
|
if (node && menu.open) {
|
|
9168
9725
|
node.querySelector(
|
|
@@ -9206,7 +9763,7 @@ function DropdownMenuContent({
|
|
|
9206
9763
|
event.preventDefault();
|
|
9207
9764
|
items[nextIndex]?.focus();
|
|
9208
9765
|
}
|
|
9209
|
-
return scopeParts(/* @__PURE__ */
|
|
9766
|
+
return scopeParts(/* @__PURE__ */ jsx48(Portal, { anchorRef: menu.scopeRef, children: /* @__PURE__ */ jsx48(
|
|
9210
9767
|
"div",
|
|
9211
9768
|
{
|
|
9212
9769
|
ref: attachContent,
|
|
@@ -9231,7 +9788,7 @@ function DropdownMenuItem({
|
|
|
9231
9788
|
}) {
|
|
9232
9789
|
const [partClasses, scopeParts] = usePartClasses("dropdown-menu", classNames, false);
|
|
9233
9790
|
const menu = useMenu("DropdownMenuItem");
|
|
9234
|
-
return scopeParts(/* @__PURE__ */
|
|
9791
|
+
return scopeParts(/* @__PURE__ */ jsx48(
|
|
9235
9792
|
"button",
|
|
9236
9793
|
{
|
|
9237
9794
|
type: "button",
|
|
@@ -9254,7 +9811,7 @@ function DropdownMenuSeparator({
|
|
|
9254
9811
|
className
|
|
9255
9812
|
}) {
|
|
9256
9813
|
const [partClasses, scopeParts] = usePartClasses("dropdown-menu", classNames, false);
|
|
9257
|
-
return scopeParts(/* @__PURE__ */
|
|
9814
|
+
return scopeParts(/* @__PURE__ */ jsx48(
|
|
9258
9815
|
"div",
|
|
9259
9816
|
{
|
|
9260
9817
|
role: "separator",
|
|
@@ -9271,7 +9828,7 @@ function DropdownMenuLabel({
|
|
|
9271
9828
|
className
|
|
9272
9829
|
}) {
|
|
9273
9830
|
const [partClasses, scopeParts] = usePartClasses("dropdown-menu", classNames, false);
|
|
9274
|
-
return scopeParts(/* @__PURE__ */
|
|
9831
|
+
return scopeParts(/* @__PURE__ */ jsx48(
|
|
9275
9832
|
"div",
|
|
9276
9833
|
{
|
|
9277
9834
|
className: mergeClasses([
|
|
@@ -9307,7 +9864,7 @@ var toastVariants = createVariants35({
|
|
|
9307
9864
|
});
|
|
9308
9865
|
|
|
9309
9866
|
// toast/toast.tsx
|
|
9310
|
-
import { Fragment as Fragment9, jsx as
|
|
9867
|
+
import { Fragment as Fragment9, jsx as jsx49, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
9311
9868
|
var toasts = [];
|
|
9312
9869
|
var serverSnapshot = [];
|
|
9313
9870
|
var counter = 0;
|
|
@@ -9437,8 +9994,8 @@ function useToasts() {
|
|
|
9437
9994
|
return useSyncExternalStore3(subscribe, getSnapshot, getServerSnapshot);
|
|
9438
9995
|
}
|
|
9439
9996
|
function ToastIcon({ variant }) {
|
|
9440
|
-
if (variant === "loading") return /* @__PURE__ */
|
|
9441
|
-
return /* @__PURE__ */
|
|
9997
|
+
if (variant === "loading") return /* @__PURE__ */ jsx49(Spinner, { size: "sm", decorative: true });
|
|
9998
|
+
return /* @__PURE__ */ jsx49(
|
|
9442
9999
|
"svg",
|
|
9443
10000
|
{
|
|
9444
10001
|
viewBox: "0 0 24 24",
|
|
@@ -9450,27 +10007,27 @@ function ToastIcon({ variant }) {
|
|
|
9450
10007
|
strokeLinecap: "round",
|
|
9451
10008
|
strokeLinejoin: "round",
|
|
9452
10009
|
focusable: "false",
|
|
9453
|
-
children: variant === "success" ? /* @__PURE__ */
|
|
9454
|
-
/* @__PURE__ */
|
|
9455
|
-
/* @__PURE__ */
|
|
9456
|
-
] }) : variant === "warning" ? /* @__PURE__ */
|
|
9457
|
-
/* @__PURE__ */
|
|
9458
|
-
/* @__PURE__ */
|
|
9459
|
-
] }) : variant === "danger" ? /* @__PURE__ */
|
|
9460
|
-
/* @__PURE__ */
|
|
9461
|
-
/* @__PURE__ */
|
|
9462
|
-
] }) : /* @__PURE__ */
|
|
9463
|
-
/* @__PURE__ */
|
|
9464
|
-
/* @__PURE__ */
|
|
10010
|
+
children: variant === "success" ? /* @__PURE__ */ jsxs37(Fragment9, { children: [
|
|
10011
|
+
/* @__PURE__ */ jsx49("circle", { cx: "12", cy: "12", r: "9" }),
|
|
10012
|
+
/* @__PURE__ */ jsx49("path", { d: "m8 12 3 3 5-6" })
|
|
10013
|
+
] }) : variant === "warning" ? /* @__PURE__ */ jsxs37(Fragment9, { children: [
|
|
10014
|
+
/* @__PURE__ */ jsx49("path", { d: "m12 3 10 18H2Z" }),
|
|
10015
|
+
/* @__PURE__ */ jsx49("path", { d: "M12 9v4m0 4h.01" })
|
|
10016
|
+
] }) : variant === "danger" ? /* @__PURE__ */ jsxs37(Fragment9, { children: [
|
|
10017
|
+
/* @__PURE__ */ jsx49("circle", { cx: "12", cy: "12", r: "9" }),
|
|
10018
|
+
/* @__PURE__ */ jsx49("path", { d: "m9 9 6 6m0-6-6 6" })
|
|
10019
|
+
] }) : /* @__PURE__ */ jsxs37(Fragment9, { children: [
|
|
10020
|
+
/* @__PURE__ */ jsx49("circle", { cx: "12", cy: "12", r: "9" }),
|
|
10021
|
+
/* @__PURE__ */ jsx49("path", { d: "M12 11v6m0-10h.01" })
|
|
9465
10022
|
] })
|
|
9466
10023
|
}
|
|
9467
10024
|
);
|
|
9468
10025
|
}
|
|
9469
10026
|
function ToastItem({ item }) {
|
|
9470
10027
|
const [partClasses, scopeParts] = usePartClasses("toast", item.classNames, false);
|
|
9471
|
-
const icon = item.icon === void 0 ? /* @__PURE__ */
|
|
10028
|
+
const icon = item.icon === void 0 ? /* @__PURE__ */ jsx49(ToastIcon, { variant: item.variant }) : item.icon;
|
|
9472
10029
|
return scopeParts(
|
|
9473
|
-
/* @__PURE__ */
|
|
10030
|
+
/* @__PURE__ */ jsxs37(
|
|
9474
10031
|
"div",
|
|
9475
10032
|
{
|
|
9476
10033
|
className: mergeClasses(toastVariants({ variant: item.variant }), partClasses.toast, item.classNames?.root),
|
|
@@ -9490,13 +10047,13 @@ function ToastItem({ item }) {
|
|
|
9490
10047
|
if (!event.currentTarget.contains(event.relatedTarget)) resumeTimer(item.id, "focus");
|
|
9491
10048
|
},
|
|
9492
10049
|
children: [
|
|
9493
|
-
icon != null && icon !== false && /* @__PURE__ */
|
|
9494
|
-
/* @__PURE__ */
|
|
9495
|
-
/* @__PURE__ */
|
|
9496
|
-
item.description != null && /* @__PURE__ */
|
|
10050
|
+
icon != null && icon !== false && /* @__PURE__ */ jsx49("span", { className: mergeClasses("pimolu-toast__icon", partClasses.icon), "aria-hidden": "true", children: icon }),
|
|
10051
|
+
/* @__PURE__ */ jsxs37("div", { className: mergeClasses("pimolu-toast__body", partClasses.body), children: [
|
|
10052
|
+
/* @__PURE__ */ jsx49("p", { className: mergeClasses("pimolu-toast__title", partClasses.title), children: item.title }),
|
|
10053
|
+
item.description != null && /* @__PURE__ */ jsx49("p", { className: mergeClasses("pimolu-toast__description", partClasses.description), children: item.description })
|
|
9497
10054
|
] }),
|
|
9498
|
-
(item.action || item.dismissible !== false) && /* @__PURE__ */
|
|
9499
|
-
item.action && /* @__PURE__ */
|
|
10055
|
+
(item.action || item.dismissible !== false) && /* @__PURE__ */ jsxs37("div", { className: mergeClasses("pimolu-toast__actions", partClasses.actions), children: [
|
|
10056
|
+
item.action && /* @__PURE__ */ jsx49(
|
|
9500
10057
|
"button",
|
|
9501
10058
|
{
|
|
9502
10059
|
type: "button",
|
|
@@ -9509,14 +10066,14 @@ function ToastItem({ item }) {
|
|
|
9509
10066
|
children: item.action.label
|
|
9510
10067
|
}
|
|
9511
10068
|
),
|
|
9512
|
-
item.dismissible !== false && /* @__PURE__ */
|
|
10069
|
+
item.dismissible !== false && /* @__PURE__ */ jsx49(
|
|
9513
10070
|
"button",
|
|
9514
10071
|
{
|
|
9515
10072
|
type: "button",
|
|
9516
10073
|
className: mergeClasses("pimolu-toast__close", partClasses.close),
|
|
9517
10074
|
"aria-label": item.dismissLabel ?? "Dismiss notification",
|
|
9518
10075
|
onClick: () => dismissToast(item.id),
|
|
9519
|
-
children: /* @__PURE__ */
|
|
10076
|
+
children: /* @__PURE__ */ jsx49(
|
|
9520
10077
|
"svg",
|
|
9521
10078
|
{
|
|
9522
10079
|
viewBox: "0 0 24 24",
|
|
@@ -9528,7 +10085,7 @@ function ToastItem({ item }) {
|
|
|
9528
10085
|
strokeLinecap: "round",
|
|
9529
10086
|
"aria-hidden": "true",
|
|
9530
10087
|
focusable: "false",
|
|
9531
|
-
children: /* @__PURE__ */
|
|
10088
|
+
children: /* @__PURE__ */ jsx49("path", { d: "m18 6-12 12M6 6l12 12" })
|
|
9532
10089
|
}
|
|
9533
10090
|
)
|
|
9534
10091
|
}
|
|
@@ -9543,7 +10100,7 @@ function Toaster({ classNames, position = "top-right", label = "Notifications" }
|
|
|
9543
10100
|
const [partClasses, scopeParts] = usePartClasses("toast", classNames, true);
|
|
9544
10101
|
const items = useToasts();
|
|
9545
10102
|
return scopeParts(
|
|
9546
|
-
/* @__PURE__ */
|
|
10103
|
+
/* @__PURE__ */ jsx49(
|
|
9547
10104
|
"div",
|
|
9548
10105
|
{
|
|
9549
10106
|
className: mergeClasses("pimolu-toaster", partClasses.root),
|
|
@@ -9552,480 +10109,12 @@ function Toaster({ classNames, position = "top-right", label = "Notifications" }
|
|
|
9552
10109
|
"aria-label": label,
|
|
9553
10110
|
"aria-live": "polite",
|
|
9554
10111
|
"aria-relevant": "additions text",
|
|
9555
|
-
children: items.map((item) => /* @__PURE__ */
|
|
10112
|
+
children: items.map((item) => /* @__PURE__ */ jsx49(ToastItem, { item }, item.id))
|
|
9556
10113
|
}
|
|
9557
10114
|
)
|
|
9558
10115
|
);
|
|
9559
10116
|
}
|
|
9560
10117
|
|
|
9561
|
-
// drawer/drawer.tsx
|
|
9562
|
-
import {
|
|
9563
|
-
cloneElement as cloneElement7,
|
|
9564
|
-
createContext as createContext14,
|
|
9565
|
-
isValidElement as isValidElement8,
|
|
9566
|
-
useCallback as useCallback11,
|
|
9567
|
-
useContext as useContext14,
|
|
9568
|
-
useEffect as useEffect24,
|
|
9569
|
-
useId as useId21,
|
|
9570
|
-
useMemo as useMemo7,
|
|
9571
|
-
useRef as useRef24,
|
|
9572
|
-
useState as useState29
|
|
9573
|
-
} from "react";
|
|
9574
|
-
|
|
9575
|
-
// internal/use-focus-trap.ts
|
|
9576
|
-
import {
|
|
9577
|
-
useEffect as useEffect23
|
|
9578
|
-
} from "react";
|
|
9579
|
-
function useFocusTrap({
|
|
9580
|
-
active,
|
|
9581
|
-
containerRef,
|
|
9582
|
-
returnFocusRef,
|
|
9583
|
-
initialFocus = "first"
|
|
9584
|
-
}) {
|
|
9585
|
-
useEffect23(() => {
|
|
9586
|
-
if (!active) return;
|
|
9587
|
-
const container = containerRef.current;
|
|
9588
|
-
if (!container) return;
|
|
9589
|
-
const previous = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
9590
|
-
const target = initialFocus === "container" ? container : getFocusable(container)[0] ?? container;
|
|
9591
|
-
target.focus();
|
|
9592
|
-
function handleKeyDown(event) {
|
|
9593
|
-
if (event.key !== "Tab") return;
|
|
9594
|
-
const focusable = getFocusable(container);
|
|
9595
|
-
if (focusable.length === 0) {
|
|
9596
|
-
event.preventDefault();
|
|
9597
|
-
container.focus();
|
|
9598
|
-
return;
|
|
9599
|
-
}
|
|
9600
|
-
const first = focusable[0];
|
|
9601
|
-
const last = focusable[focusable.length - 1];
|
|
9602
|
-
const current = document.activeElement;
|
|
9603
|
-
if (current === container) {
|
|
9604
|
-
event.preventDefault();
|
|
9605
|
-
(event.shiftKey ? last : first).focus();
|
|
9606
|
-
return;
|
|
9607
|
-
}
|
|
9608
|
-
if (event.shiftKey) {
|
|
9609
|
-
if (current === first || !container.contains(current)) {
|
|
9610
|
-
event.preventDefault();
|
|
9611
|
-
last.focus();
|
|
9612
|
-
}
|
|
9613
|
-
return;
|
|
9614
|
-
}
|
|
9615
|
-
if (current === last || !container.contains(current)) {
|
|
9616
|
-
event.preventDefault();
|
|
9617
|
-
first.focus();
|
|
9618
|
-
}
|
|
9619
|
-
}
|
|
9620
|
-
document.addEventListener("keydown", handleKeyDown);
|
|
9621
|
-
return () => {
|
|
9622
|
-
document.removeEventListener(
|
|
9623
|
-
"keydown",
|
|
9624
|
-
handleKeyDown
|
|
9625
|
-
);
|
|
9626
|
-
const trigger = returnFocusRef?.current;
|
|
9627
|
-
const restore = trigger?.isConnected ? trigger : previous;
|
|
9628
|
-
if (restore?.isConnected) {
|
|
9629
|
-
restore.focus();
|
|
9630
|
-
}
|
|
9631
|
-
};
|
|
9632
|
-
}, [active, containerRef, returnFocusRef, initialFocus]);
|
|
9633
|
-
}
|
|
9634
|
-
|
|
9635
|
-
// drawer/drawer.tsx
|
|
9636
|
-
import { jsx as jsx49, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
9637
|
-
var EXIT_DURATION4 = 180;
|
|
9638
|
-
var SIDE_CLASSES = {
|
|
9639
|
-
right: "pimolu-drawer__content--right",
|
|
9640
|
-
left: "pimolu-drawer__content--left",
|
|
9641
|
-
top: "pimolu-drawer__content--top",
|
|
9642
|
-
bottom: "pimolu-drawer__content--bottom"
|
|
9643
|
-
};
|
|
9644
|
-
var SIZE_CLASSES = {
|
|
9645
|
-
sm: "pimolu-drawer__content--sm",
|
|
9646
|
-
md: "pimolu-drawer__content--md",
|
|
9647
|
-
lg: "pimolu-drawer__content--lg"
|
|
9648
|
-
};
|
|
9649
|
-
function classes13(base, className) {
|
|
9650
|
-
return [base, className].filter(Boolean).join(" ");
|
|
9651
|
-
}
|
|
9652
|
-
function contentClasses(side, size, className) {
|
|
9653
|
-
return [
|
|
9654
|
-
"pimolu-drawer__content",
|
|
9655
|
-
SIDE_CLASSES[side],
|
|
9656
|
-
SIZE_CLASSES[size],
|
|
9657
|
-
className
|
|
9658
|
-
].filter(Boolean).join(" ");
|
|
9659
|
-
}
|
|
9660
|
-
function CloseIcon2() {
|
|
9661
|
-
return /* @__PURE__ */ jsxs37(
|
|
9662
|
-
"svg",
|
|
9663
|
-
{
|
|
9664
|
-
viewBox: "0 0 24 24",
|
|
9665
|
-
width: "16",
|
|
9666
|
-
height: "16",
|
|
9667
|
-
fill: "none",
|
|
9668
|
-
stroke: "currentColor",
|
|
9669
|
-
strokeWidth: "2",
|
|
9670
|
-
strokeLinecap: "round",
|
|
9671
|
-
"aria-hidden": "true",
|
|
9672
|
-
focusable: "false",
|
|
9673
|
-
children: [
|
|
9674
|
-
/* @__PURE__ */ jsx49("path", { d: "M18 6 6 18" }),
|
|
9675
|
-
/* @__PURE__ */ jsx49("path", { d: "m6 6 12 12" })
|
|
9676
|
-
]
|
|
9677
|
-
}
|
|
9678
|
-
);
|
|
9679
|
-
}
|
|
9680
|
-
var DrawerContext = createContext14(null);
|
|
9681
|
-
function useDrawer(component) {
|
|
9682
|
-
const context = useContext14(DrawerContext);
|
|
9683
|
-
if (!context) {
|
|
9684
|
-
throw new Error(
|
|
9685
|
-
`${component} must be used inside <Drawer>.`
|
|
9686
|
-
);
|
|
9687
|
-
}
|
|
9688
|
-
return context;
|
|
9689
|
-
}
|
|
9690
|
-
function Drawer({
|
|
9691
|
-
children,
|
|
9692
|
-
open: controlledOpen,
|
|
9693
|
-
defaultOpen = false,
|
|
9694
|
-
onOpenChange
|
|
9695
|
-
}) {
|
|
9696
|
-
const isControlled = controlledOpen !== void 0;
|
|
9697
|
-
const [uncontrolledOpen, setUncontrolledOpen] = useState29(defaultOpen);
|
|
9698
|
-
const open = isControlled ? controlledOpen : uncontrolledOpen;
|
|
9699
|
-
const contentId = `pimolu-drawer-${useId21()}`;
|
|
9700
|
-
const scopeRef = useRef24(
|
|
9701
|
-
null
|
|
9702
|
-
);
|
|
9703
|
-
const triggerRef = useRef24(null);
|
|
9704
|
-
const [titleId, setTitleId] = useState29(null);
|
|
9705
|
-
const [descriptionId, setDescriptionId] = useState29(null);
|
|
9706
|
-
const setOpen = useCallback11(
|
|
9707
|
-
(next) => {
|
|
9708
|
-
if (!isControlled) {
|
|
9709
|
-
setUncontrolledOpen(next);
|
|
9710
|
-
}
|
|
9711
|
-
onOpenChange?.(next);
|
|
9712
|
-
},
|
|
9713
|
-
[isControlled, onOpenChange]
|
|
9714
|
-
);
|
|
9715
|
-
const value = useMemo7(
|
|
9716
|
-
() => ({
|
|
9717
|
-
open,
|
|
9718
|
-
setOpen,
|
|
9719
|
-
contentId,
|
|
9720
|
-
titleId,
|
|
9721
|
-
descriptionId,
|
|
9722
|
-
setTitleId,
|
|
9723
|
-
setDescriptionId,
|
|
9724
|
-
scopeRef,
|
|
9725
|
-
triggerRef
|
|
9726
|
-
}),
|
|
9727
|
-
[
|
|
9728
|
-
open,
|
|
9729
|
-
setOpen,
|
|
9730
|
-
contentId,
|
|
9731
|
-
titleId,
|
|
9732
|
-
descriptionId
|
|
9733
|
-
]
|
|
9734
|
-
);
|
|
9735
|
-
return /* @__PURE__ */ jsxs37(DrawerContext.Provider, { value, children: [
|
|
9736
|
-
/* @__PURE__ */ jsx49("span", { ref: scopeRef, hidden: true }),
|
|
9737
|
-
children
|
|
9738
|
-
] });
|
|
9739
|
-
}
|
|
9740
|
-
function DrawerTrigger({
|
|
9741
|
-
children
|
|
9742
|
-
}) {
|
|
9743
|
-
const { open, setOpen, contentId, triggerRef } = useDrawer("DrawerTrigger");
|
|
9744
|
-
if (!isValidElement8(children)) return children;
|
|
9745
|
-
const trigger = children;
|
|
9746
|
-
const props = trigger.props;
|
|
9747
|
-
function assignRef(node) {
|
|
9748
|
-
triggerRef.current = node;
|
|
9749
|
-
const childRef = props.ref;
|
|
9750
|
-
if (typeof childRef === "function") {
|
|
9751
|
-
childRef(
|
|
9752
|
-
node
|
|
9753
|
-
);
|
|
9754
|
-
} else if (childRef && typeof childRef === "object" && "current" in childRef) {
|
|
9755
|
-
childRef.current = node;
|
|
9756
|
-
}
|
|
9757
|
-
}
|
|
9758
|
-
return cloneElement7(trigger, {
|
|
9759
|
-
ref: assignRef,
|
|
9760
|
-
"aria-haspopup": "dialog",
|
|
9761
|
-
"aria-expanded": open,
|
|
9762
|
-
"aria-controls": open ? contentId : void 0,
|
|
9763
|
-
"data-state": open ? "open" : "closed",
|
|
9764
|
-
onClick: (event) => {
|
|
9765
|
-
props.onClick?.(event);
|
|
9766
|
-
if (event.defaultPrevented) return;
|
|
9767
|
-
setOpen(!open);
|
|
9768
|
-
}
|
|
9769
|
-
});
|
|
9770
|
-
}
|
|
9771
|
-
function DrawerSurface({
|
|
9772
|
-
contentRef,
|
|
9773
|
-
id,
|
|
9774
|
-
open,
|
|
9775
|
-
state,
|
|
9776
|
-
side,
|
|
9777
|
-
size,
|
|
9778
|
-
className,
|
|
9779
|
-
classNames,
|
|
9780
|
-
style,
|
|
9781
|
-
showCloseButton,
|
|
9782
|
-
closeLabel,
|
|
9783
|
-
labelledBy,
|
|
9784
|
-
describedBy,
|
|
9785
|
-
ariaLabel,
|
|
9786
|
-
triggerRef,
|
|
9787
|
-
onClose,
|
|
9788
|
-
children
|
|
9789
|
-
}) {
|
|
9790
|
-
const [partClasses, scopeParts] = usePartClasses("drawer", classNames, false);
|
|
9791
|
-
useFocusTrap({
|
|
9792
|
-
active: open,
|
|
9793
|
-
containerRef: contentRef,
|
|
9794
|
-
returnFocusRef: triggerRef,
|
|
9795
|
-
initialFocus: "container"
|
|
9796
|
-
});
|
|
9797
|
-
useEffect24(() => {
|
|
9798
|
-
if (!open) return;
|
|
9799
|
-
const content = contentRef.current;
|
|
9800
|
-
if (!content) return;
|
|
9801
|
-
const preferred = getFocusable(content).find(
|
|
9802
|
-
(element) => !element.closest(".pimolu-drawer__footer") && !element.classList.contains(
|
|
9803
|
-
"pimolu-drawer__close"
|
|
9804
|
-
)
|
|
9805
|
-
);
|
|
9806
|
-
(preferred ?? content).focus();
|
|
9807
|
-
}, [open, contentRef]);
|
|
9808
|
-
return scopeParts(/* @__PURE__ */ jsxs37(
|
|
9809
|
-
"div",
|
|
9810
|
-
{
|
|
9811
|
-
ref: contentRef,
|
|
9812
|
-
id,
|
|
9813
|
-
role: "dialog",
|
|
9814
|
-
"aria-modal": "true",
|
|
9815
|
-
"aria-label": labelledBy ? void 0 : ariaLabel,
|
|
9816
|
-
"aria-labelledby": labelledBy,
|
|
9817
|
-
"aria-describedby": describedBy,
|
|
9818
|
-
tabIndex: -1,
|
|
9819
|
-
className: mergeClasses(contentClasses(side, size, className), partClasses.root),
|
|
9820
|
-
style,
|
|
9821
|
-
"data-state": state,
|
|
9822
|
-
"data-side": side,
|
|
9823
|
-
"data-close-button": showCloseButton ? "true" : void 0,
|
|
9824
|
-
children: [
|
|
9825
|
-
children,
|
|
9826
|
-
showCloseButton && /* @__PURE__ */ jsx49(
|
|
9827
|
-
"button",
|
|
9828
|
-
{
|
|
9829
|
-
type: "button",
|
|
9830
|
-
className: mergeClasses("pimolu-drawer__close", partClasses.closeButton),
|
|
9831
|
-
"aria-label": closeLabel,
|
|
9832
|
-
onClick: onClose,
|
|
9833
|
-
children: /* @__PURE__ */ jsx49(CloseIcon2, {})
|
|
9834
|
-
}
|
|
9835
|
-
)
|
|
9836
|
-
]
|
|
9837
|
-
}
|
|
9838
|
-
));
|
|
9839
|
-
}
|
|
9840
|
-
function DrawerContent({
|
|
9841
|
-
children,
|
|
9842
|
-
side = "right",
|
|
9843
|
-
size = "md",
|
|
9844
|
-
closeOnOverlayClick = true,
|
|
9845
|
-
closeOnEscape = true,
|
|
9846
|
-
showCloseButton = true,
|
|
9847
|
-
closeLabel = "Close",
|
|
9848
|
-
className,
|
|
9849
|
-
classNames,
|
|
9850
|
-
style,
|
|
9851
|
-
"aria-label": ariaLabel,
|
|
9852
|
-
"aria-labelledby": ariaLabelledBy,
|
|
9853
|
-
"aria-describedby": ariaDescribedBy
|
|
9854
|
-
}) {
|
|
9855
|
-
const [partClasses, scopeParts] = usePartClasses("drawer", classNames, true);
|
|
9856
|
-
const {
|
|
9857
|
-
open,
|
|
9858
|
-
setOpen,
|
|
9859
|
-
contentId,
|
|
9860
|
-
titleId,
|
|
9861
|
-
descriptionId,
|
|
9862
|
-
scopeRef,
|
|
9863
|
-
triggerRef
|
|
9864
|
-
} = useDrawer("DrawerContent");
|
|
9865
|
-
const contentRef = useRef24(
|
|
9866
|
-
null
|
|
9867
|
-
);
|
|
9868
|
-
const { rendered, state } = usePresence(
|
|
9869
|
-
open,
|
|
9870
|
-
EXIT_DURATION4
|
|
9871
|
-
);
|
|
9872
|
-
useBodyScrollLock(rendered);
|
|
9873
|
-
useDismissableLayer({
|
|
9874
|
-
open,
|
|
9875
|
-
target: contentRef,
|
|
9876
|
-
onDismiss: () => setOpen(false),
|
|
9877
|
-
closeOnOutside: closeOnOverlayClick,
|
|
9878
|
-
closeOnEscape
|
|
9879
|
-
});
|
|
9880
|
-
if (!rendered) return scopeParts(null);
|
|
9881
|
-
const labelledBy = ariaLabelledBy ?? titleId ?? void 0;
|
|
9882
|
-
const describedBy = ariaDescribedBy ?? descriptionId ?? void 0;
|
|
9883
|
-
return scopeParts(/* @__PURE__ */ jsx49(Portal, { anchorRef: scopeRef, children: /* @__PURE__ */ jsxs37(
|
|
9884
|
-
"div",
|
|
9885
|
-
{
|
|
9886
|
-
className: mergeClasses("pimolu-drawer", partClasses.root),
|
|
9887
|
-
"data-state": state,
|
|
9888
|
-
"data-side": side,
|
|
9889
|
-
children: [
|
|
9890
|
-
/* @__PURE__ */ jsx49(
|
|
9891
|
-
"div",
|
|
9892
|
-
{
|
|
9893
|
-
className: mergeClasses("pimolu-drawer__overlay", partClasses.overlay),
|
|
9894
|
-
"data-state": state
|
|
9895
|
-
}
|
|
9896
|
-
),
|
|
9897
|
-
/* @__PURE__ */ jsx49(
|
|
9898
|
-
DrawerSurface,
|
|
9899
|
-
{
|
|
9900
|
-
contentRef,
|
|
9901
|
-
id: contentId,
|
|
9902
|
-
open,
|
|
9903
|
-
state,
|
|
9904
|
-
side,
|
|
9905
|
-
size,
|
|
9906
|
-
className: mergeClasses(className, partClasses.content),
|
|
9907
|
-
classNames,
|
|
9908
|
-
style,
|
|
9909
|
-
showCloseButton,
|
|
9910
|
-
closeLabel,
|
|
9911
|
-
labelledBy,
|
|
9912
|
-
describedBy,
|
|
9913
|
-
ariaLabel,
|
|
9914
|
-
triggerRef,
|
|
9915
|
-
onClose: () => setOpen(false),
|
|
9916
|
-
children
|
|
9917
|
-
}
|
|
9918
|
-
)
|
|
9919
|
-
]
|
|
9920
|
-
}
|
|
9921
|
-
) }));
|
|
9922
|
-
}
|
|
9923
|
-
function DrawerHeader({
|
|
9924
|
-
classNames,
|
|
9925
|
-
children,
|
|
9926
|
-
className
|
|
9927
|
-
}) {
|
|
9928
|
-
const [partClasses, scopeParts] = usePartClasses("drawer", classNames, false);
|
|
9929
|
-
return scopeParts(/* @__PURE__ */ jsx49(
|
|
9930
|
-
"div",
|
|
9931
|
-
{
|
|
9932
|
-
className: mergeClasses(classes13(
|
|
9933
|
-
"pimolu-drawer__header",
|
|
9934
|
-
className
|
|
9935
|
-
), partClasses.header, classNames?.root),
|
|
9936
|
-
children
|
|
9937
|
-
}
|
|
9938
|
-
));
|
|
9939
|
-
}
|
|
9940
|
-
function DrawerFooter({
|
|
9941
|
-
classNames,
|
|
9942
|
-
children,
|
|
9943
|
-
className
|
|
9944
|
-
}) {
|
|
9945
|
-
const [partClasses, scopeParts] = usePartClasses("drawer", classNames, false);
|
|
9946
|
-
return scopeParts(/* @__PURE__ */ jsx49(
|
|
9947
|
-
"div",
|
|
9948
|
-
{
|
|
9949
|
-
className: mergeClasses(classes13(
|
|
9950
|
-
"pimolu-drawer__footer",
|
|
9951
|
-
className
|
|
9952
|
-
), partClasses.footer, classNames?.root),
|
|
9953
|
-
children
|
|
9954
|
-
}
|
|
9955
|
-
));
|
|
9956
|
-
}
|
|
9957
|
-
function DrawerTitle({
|
|
9958
|
-
classNames,
|
|
9959
|
-
children,
|
|
9960
|
-
id,
|
|
9961
|
-
className
|
|
9962
|
-
}) {
|
|
9963
|
-
const [partClasses, scopeParts] = usePartClasses("drawer", classNames, false);
|
|
9964
|
-
const { setTitleId } = useDrawer("DrawerTitle");
|
|
9965
|
-
const generatedId = useId21();
|
|
9966
|
-
const titleId = id ?? `pimolu-drawer-title-${generatedId}`;
|
|
9967
|
-
useEffect24(() => {
|
|
9968
|
-
setTitleId(titleId);
|
|
9969
|
-
return () => setTitleId(
|
|
9970
|
-
(current) => current === titleId ? null : current
|
|
9971
|
-
);
|
|
9972
|
-
}, [setTitleId, titleId]);
|
|
9973
|
-
return scopeParts(/* @__PURE__ */ jsx49(
|
|
9974
|
-
"h2",
|
|
9975
|
-
{
|
|
9976
|
-
id: titleId,
|
|
9977
|
-
className: mergeClasses(classes13(
|
|
9978
|
-
"pimolu-drawer__title",
|
|
9979
|
-
className
|
|
9980
|
-
), partClasses.title, classNames?.root),
|
|
9981
|
-
children
|
|
9982
|
-
}
|
|
9983
|
-
));
|
|
9984
|
-
}
|
|
9985
|
-
function DrawerDescription({
|
|
9986
|
-
classNames,
|
|
9987
|
-
children,
|
|
9988
|
-
id,
|
|
9989
|
-
className
|
|
9990
|
-
}) {
|
|
9991
|
-
const [partClasses, scopeParts] = usePartClasses("drawer", classNames, false);
|
|
9992
|
-
const { setDescriptionId } = useDrawer("DrawerDescription");
|
|
9993
|
-
const generatedId = useId21();
|
|
9994
|
-
const descriptionId = id ?? `pimolu-drawer-description-${generatedId}`;
|
|
9995
|
-
useEffect24(() => {
|
|
9996
|
-
setDescriptionId(descriptionId);
|
|
9997
|
-
return () => setDescriptionId(
|
|
9998
|
-
(current) => current === descriptionId ? null : current
|
|
9999
|
-
);
|
|
10000
|
-
}, [setDescriptionId, descriptionId]);
|
|
10001
|
-
return scopeParts(/* @__PURE__ */ jsx49(
|
|
10002
|
-
"p",
|
|
10003
|
-
{
|
|
10004
|
-
id: descriptionId,
|
|
10005
|
-
className: mergeClasses(classes13(
|
|
10006
|
-
"pimolu-drawer__description",
|
|
10007
|
-
className
|
|
10008
|
-
), partClasses.description, classNames?.root),
|
|
10009
|
-
children
|
|
10010
|
-
}
|
|
10011
|
-
));
|
|
10012
|
-
}
|
|
10013
|
-
function DrawerClose({
|
|
10014
|
-
children
|
|
10015
|
-
}) {
|
|
10016
|
-
const { setOpen } = useDrawer("DrawerClose");
|
|
10017
|
-
if (!isValidElement8(children)) return children;
|
|
10018
|
-
const trigger = children;
|
|
10019
|
-
const props = trigger.props;
|
|
10020
|
-
return cloneElement7(trigger, {
|
|
10021
|
-
onClick: (event) => {
|
|
10022
|
-
props.onClick?.(event);
|
|
10023
|
-
if (event.defaultPrevented) return;
|
|
10024
|
-
setOpen(false);
|
|
10025
|
-
}
|
|
10026
|
-
});
|
|
10027
|
-
}
|
|
10028
|
-
|
|
10029
10118
|
// context-menu/context-menu.tsx
|
|
10030
10119
|
import {
|
|
10031
10120
|
cloneElement as cloneElement8,
|
|
@@ -36667,6 +36756,7 @@ export {
|
|
|
36667
36756
|
NavbarBrand,
|
|
36668
36757
|
NavbarContent,
|
|
36669
36758
|
NavbarItem,
|
|
36759
|
+
NavbarMenu,
|
|
36670
36760
|
NavbarToggle,
|
|
36671
36761
|
NavigationMenu,
|
|
36672
36762
|
NavigationMenuContent,
|