@hyphen/hyphen-components 9.0.0-beta.1 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/index.css +17 -0
- package/dist/css/index.css.map +1 -1
- package/dist/css/utilities.css +1 -1
- package/dist/css/utilities.css.map +1 -1
- package/dist/hyphen-components.cjs.development.js +355 -143
- package/dist/hyphen-components.cjs.development.js.map +1 -1
- package/dist/hyphen-components.cjs.production.min.js +2 -2
- package/dist/hyphen-components.cjs.production.min.js.map +1 -1
- package/dist/hyphen-components.esm.js +346 -134
- package/dist/hyphen-components.esm.js.map +1 -1
- package/dist/index.d.ts +14 -1
- package/package.json +4 -3
- package/src/components/Box/Box.mdx +3 -0
- package/src/components/Button/Button.mdx +13 -1
- package/src/components/Sidebar/Sidebar.mdx +18 -0
- package/src/components/Sidebar/Sidebar.module.scss +18 -0
- package/src/components/Sidebar/Sidebar.react17.test.tsx +35 -0
- package/src/components/Sidebar/Sidebar.resize.test.tsx +368 -0
- package/src/components/Sidebar/Sidebar.stories.tsx +36 -0
- package/src/components/Sidebar/Sidebar.test.tsx +46 -0
- package/src/components/Sidebar/Sidebar.tsx +242 -150
- package/src/components/Sidebar/useSidebarResize.ts +214 -0
- package/src/docs/GetStarted.mdx +7 -0
- package/src/docs/PolymorphicComposition.mdx +184 -0
|
@@ -4254,13 +4254,14 @@ var ResponsiveProvider = ({
|
|
|
4254
4254
|
};
|
|
4255
4255
|
|
|
4256
4256
|
// src/components/Sidebar/Sidebar.tsx
|
|
4257
|
-
import
|
|
4257
|
+
import React59, {
|
|
4258
4258
|
useCallback as useCallback4,
|
|
4259
4259
|
useMemo as useMemo4,
|
|
4260
|
-
useState as
|
|
4261
|
-
useEffect as
|
|
4260
|
+
useState as useState5,
|
|
4261
|
+
useEffect as useEffect4,
|
|
4262
4262
|
forwardRef as forwardRef15
|
|
4263
4263
|
} from "react";
|
|
4264
|
+
import { useId } from "@radix-ui/react-id";
|
|
4264
4265
|
import { Slot as Slot3 } from "@radix-ui/react-slot";
|
|
4265
4266
|
import classNames34 from "classnames";
|
|
4266
4267
|
|
|
@@ -4285,10 +4286,179 @@ function useIsMobile() {
|
|
|
4285
4286
|
}
|
|
4286
4287
|
|
|
4287
4288
|
// src/components/Sidebar/Sidebar.module.scss
|
|
4288
|
-
var Sidebar_module_default = { "rail": "rail__OwBtB", "group-data-": "group-data-__af4bi" };
|
|
4289
|
+
var Sidebar_module_default = { "rail": "rail__OwBtB", "group-data-": "group-data-__af4bi", "resizeDescription": "resizeDescription__Ou7UB" };
|
|
4290
|
+
|
|
4291
|
+
// src/components/Sidebar/useSidebarResize.ts
|
|
4292
|
+
import React57, { useEffect as useEffect3, useRef, useState as useState4 } from "react";
|
|
4293
|
+
function useSidebarResize({
|
|
4294
|
+
resizable = false,
|
|
4295
|
+
defaultWidth,
|
|
4296
|
+
minWidth = 256,
|
|
4297
|
+
maxWidth = 960,
|
|
4298
|
+
widthStorageKey,
|
|
4299
|
+
side,
|
|
4300
|
+
isMobile,
|
|
4301
|
+
expanded,
|
|
4302
|
+
rootRef
|
|
4303
|
+
}) {
|
|
4304
|
+
const initialWidth = defaultWidth ?? (side === "left" ? 256 : 384);
|
|
4305
|
+
const [preferredWidth, setPreferredWidth] = useState4(initialWidth);
|
|
4306
|
+
const [containerWidth, setContainerWidth] = useState4(Infinity);
|
|
4307
|
+
const [dragging, setDragging] = useState4(false);
|
|
4308
|
+
const gesture = useRef(null);
|
|
4309
|
+
const suppressClick = useRef(false);
|
|
4310
|
+
const currentWidth = useRef(preferredWidth);
|
|
4311
|
+
const enabled = resizable && !isMobile && expanded;
|
|
4312
|
+
const maximum = Math.max(0, Math.min(maxWidth, containerWidth * (2 / 3)));
|
|
4313
|
+
const minimum = Math.min(Math.max(0, minWidth), maximum);
|
|
4314
|
+
const clamp = (value) => Math.max(minimum, Math.min(maximum, value));
|
|
4315
|
+
const width = clamp(preferredWidth);
|
|
4316
|
+
const [settledWidth, setSettledWidth] = useState4(width);
|
|
4317
|
+
useIsomorphicLayoutEffect(() => {
|
|
4318
|
+
if (!resizable) return;
|
|
4319
|
+
let savedWidth = initialWidth;
|
|
4320
|
+
try {
|
|
4321
|
+
const saved = widthStorageKey && localStorage.getItem(widthStorageKey);
|
|
4322
|
+
if (saved && Number.isFinite(Number(saved)) && Number(saved) > 0) {
|
|
4323
|
+
savedWidth = Number(saved);
|
|
4324
|
+
}
|
|
4325
|
+
} catch {
|
|
4326
|
+
}
|
|
4327
|
+
setPreferredWidth(savedWidth);
|
|
4328
|
+
}, [resizable, initialWidth, widthStorageKey]);
|
|
4329
|
+
useIsomorphicLayoutEffect(() => {
|
|
4330
|
+
if (!resizable || isMobile) return;
|
|
4331
|
+
const container = rootRef.current?.closest("[data-sidebar-provider]");
|
|
4332
|
+
if (!container) return;
|
|
4333
|
+
const measure = () => setContainerWidth(container.getBoundingClientRect().width);
|
|
4334
|
+
measure();
|
|
4335
|
+
if (typeof ResizeObserver === "undefined") {
|
|
4336
|
+
window.addEventListener("resize", measure);
|
|
4337
|
+
return () => window.removeEventListener("resize", measure);
|
|
4338
|
+
}
|
|
4339
|
+
const observer = new ResizeObserver(measure);
|
|
4340
|
+
observer.observe(container);
|
|
4341
|
+
return () => observer.disconnect();
|
|
4342
|
+
}, [resizable, isMobile, rootRef]);
|
|
4343
|
+
useIsomorphicLayoutEffect(() => {
|
|
4344
|
+
if (dragging || width === settledWidth) return;
|
|
4345
|
+
rootRef.current?.getBoundingClientRect();
|
|
4346
|
+
setSettledWidth(width);
|
|
4347
|
+
}, [dragging, width, settledWidth, rootRef]);
|
|
4348
|
+
useEffect3(() => {
|
|
4349
|
+
if (!enabled) {
|
|
4350
|
+
gesture.current = null;
|
|
4351
|
+
setDragging(false);
|
|
4352
|
+
}
|
|
4353
|
+
}, [enabled]);
|
|
4354
|
+
useEffect3(() => {
|
|
4355
|
+
if (!dragging) return;
|
|
4356
|
+
const { cursor, userSelect } = document.body.style;
|
|
4357
|
+
document.body.style.cursor = "col-resize";
|
|
4358
|
+
document.body.style.userSelect = "none";
|
|
4359
|
+
return () => {
|
|
4360
|
+
document.body.style.cursor = cursor;
|
|
4361
|
+
document.body.style.userSelect = userSelect;
|
|
4362
|
+
};
|
|
4363
|
+
}, [dragging]);
|
|
4364
|
+
const update = (next) => {
|
|
4365
|
+
currentWidth.current = clamp(next);
|
|
4366
|
+
setPreferredWidth(currentWidth.current);
|
|
4367
|
+
};
|
|
4368
|
+
const persist = () => {
|
|
4369
|
+
if (!widthStorageKey) return;
|
|
4370
|
+
try {
|
|
4371
|
+
localStorage.setItem(widthStorageKey, String(currentWidth.current));
|
|
4372
|
+
} catch {
|
|
4373
|
+
}
|
|
4374
|
+
};
|
|
4375
|
+
const cancel = () => {
|
|
4376
|
+
if (!gesture.current) return;
|
|
4377
|
+
setPreferredWidth(gesture.current.preferred);
|
|
4378
|
+
gesture.current = null;
|
|
4379
|
+
setDragging(false);
|
|
4380
|
+
};
|
|
4381
|
+
const railProps = {
|
|
4382
|
+
onPointerDown: (event) => {
|
|
4383
|
+
suppressClick.current = false;
|
|
4384
|
+
if (!enabled || event.button !== 0 || gesture.current) return;
|
|
4385
|
+
gesture.current = {
|
|
4386
|
+
id: event.pointerId,
|
|
4387
|
+
x: event.clientX,
|
|
4388
|
+
width,
|
|
4389
|
+
preferred: preferredWidth,
|
|
4390
|
+
moved: false
|
|
4391
|
+
};
|
|
4392
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
4393
|
+
},
|
|
4394
|
+
onPointerMove: (event) => {
|
|
4395
|
+
const start = gesture.current;
|
|
4396
|
+
if (!start || start.id !== event.pointerId) return;
|
|
4397
|
+
const delta = event.clientX - start.x;
|
|
4398
|
+
if (!start.moved && Math.abs(delta) < 4) return;
|
|
4399
|
+
start.moved = true;
|
|
4400
|
+
suppressClick.current = true;
|
|
4401
|
+
setDragging(true);
|
|
4402
|
+
update(start.width + (side === "left" ? delta : -delta));
|
|
4403
|
+
},
|
|
4404
|
+
onPointerUp: (event) => {
|
|
4405
|
+
const start = gesture.current;
|
|
4406
|
+
if (!start || start.id !== event.pointerId) return;
|
|
4407
|
+
if (start.moved) {
|
|
4408
|
+
update(
|
|
4409
|
+
start.width + (side === "left" ? 1 : -1) * (event.clientX - start.x)
|
|
4410
|
+
);
|
|
4411
|
+
persist();
|
|
4412
|
+
}
|
|
4413
|
+
gesture.current = null;
|
|
4414
|
+
setDragging(false);
|
|
4415
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
4416
|
+
},
|
|
4417
|
+
onPointerCancel: cancel,
|
|
4418
|
+
onLostPointerCapture: cancel,
|
|
4419
|
+
onClickCapture: (event) => {
|
|
4420
|
+
if (suppressClick.current && event.detail !== 0) {
|
|
4421
|
+
event.preventDefault();
|
|
4422
|
+
event.stopPropagation();
|
|
4423
|
+
suppressClick.current = false;
|
|
4424
|
+
}
|
|
4425
|
+
},
|
|
4426
|
+
onKeyDown: (event) => {
|
|
4427
|
+
const modified = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
|
|
4428
|
+
if (!enabled || modified) return;
|
|
4429
|
+
let next;
|
|
4430
|
+
switch (event.key) {
|
|
4431
|
+
case "ArrowLeft":
|
|
4432
|
+
next = width + (side === "left" ? -10 : 10);
|
|
4433
|
+
break;
|
|
4434
|
+
case "ArrowRight":
|
|
4435
|
+
next = width + (side === "left" ? 10 : -10);
|
|
4436
|
+
break;
|
|
4437
|
+
case "Home":
|
|
4438
|
+
next = minimum;
|
|
4439
|
+
break;
|
|
4440
|
+
case "End":
|
|
4441
|
+
next = maximum;
|
|
4442
|
+
break;
|
|
4443
|
+
default:
|
|
4444
|
+
return;
|
|
4445
|
+
}
|
|
4446
|
+
event.preventDefault();
|
|
4447
|
+
update(next);
|
|
4448
|
+
persist();
|
|
4449
|
+
}
|
|
4450
|
+
};
|
|
4451
|
+
return {
|
|
4452
|
+
width,
|
|
4453
|
+
animate: !dragging && width === settledWidth,
|
|
4454
|
+
enabled,
|
|
4455
|
+
railProps
|
|
4456
|
+
};
|
|
4457
|
+
}
|
|
4458
|
+
var SidebarResizeContext = React57.createContext(null);
|
|
4289
4459
|
|
|
4290
4460
|
// src/components/Tooltip/Tooltip.tsx
|
|
4291
|
-
import * as
|
|
4461
|
+
import * as React58 from "react";
|
|
4292
4462
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
4293
4463
|
|
|
4294
4464
|
// src/components/Tooltip/Tooltip.module.scss
|
|
@@ -4300,7 +4470,7 @@ var TooltipProvider = TooltipPrimitive.Provider;
|
|
|
4300
4470
|
var Tooltip = TooltipPrimitive.Root;
|
|
4301
4471
|
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
4302
4472
|
var TooltipPortal = TooltipPrimitive.Portal;
|
|
4303
|
-
var TooltipContent =
|
|
4473
|
+
var TooltipContent = React58.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ React58.createElement(
|
|
4304
4474
|
TooltipPrimitive.Content,
|
|
4305
4475
|
{
|
|
4306
4476
|
ref,
|
|
@@ -4321,14 +4491,14 @@ var SIDEBAR_RIGHT_WIDTH = "24rem";
|
|
|
4321
4491
|
var SIDEBAR_WIDTH_ICON = "44px";
|
|
4322
4492
|
var SIDEBAR_KEYBOARD_SHORTCUT_LEFT = "[";
|
|
4323
4493
|
var SIDEBAR_KEYBOARD_SHORTCUT_RIGHT = "]";
|
|
4324
|
-
var SidebarIsMobileContext =
|
|
4325
|
-
var SidebarLeftContext =
|
|
4494
|
+
var SidebarIsMobileContext = React59.createContext(null);
|
|
4495
|
+
var SidebarLeftContext = React59.createContext(
|
|
4326
4496
|
null
|
|
4327
4497
|
);
|
|
4328
|
-
var SidebarRightContext =
|
|
4498
|
+
var SidebarRightContext = React59.createContext(
|
|
4329
4499
|
null
|
|
4330
4500
|
);
|
|
4331
|
-
var SidebarSideContext =
|
|
4501
|
+
var SidebarSideContext = React59.createContext("left");
|
|
4332
4502
|
var resolveSideValue = (value, side, fallback) => {
|
|
4333
4503
|
if (typeof value === "boolean") {
|
|
4334
4504
|
return value;
|
|
@@ -4381,14 +4551,14 @@ var useSidebarSideState = ({
|
|
|
4381
4551
|
);
|
|
4382
4552
|
const controlledOpen = resolveControlledOpen(openProp, side);
|
|
4383
4553
|
const isControlled = typeof controlledOpen === "boolean";
|
|
4384
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
4554
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState5(
|
|
4385
4555
|
controlledOpen ?? initialDefaultOpen
|
|
4386
4556
|
);
|
|
4387
|
-
const [openMobile, setOpenMobile] =
|
|
4557
|
+
const [openMobile, setOpenMobile] = useState5(
|
|
4388
4558
|
() => isMobile ? false : controlledOpen ?? initialDefaultOpen
|
|
4389
4559
|
);
|
|
4390
4560
|
const open = controlledOpen ?? uncontrolledOpen;
|
|
4391
|
-
|
|
4561
|
+
useEffect4(() => {
|
|
4392
4562
|
if (isMobile) {
|
|
4393
4563
|
setOpenMobile(false);
|
|
4394
4564
|
} else {
|
|
@@ -4432,13 +4602,13 @@ var useSidebarSideState = ({
|
|
|
4432
4602
|
);
|
|
4433
4603
|
};
|
|
4434
4604
|
function useSidebar(sideOverride) {
|
|
4435
|
-
const isMobile =
|
|
4605
|
+
const isMobile = React59.useContext(SidebarIsMobileContext);
|
|
4436
4606
|
if (typeof isMobile !== "boolean") {
|
|
4437
4607
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
4438
4608
|
}
|
|
4439
|
-
const contextSide =
|
|
4609
|
+
const contextSide = React59.useContext(SidebarSideContext);
|
|
4440
4610
|
const side = sideOverride ?? contextSide;
|
|
4441
|
-
const sideContext =
|
|
4611
|
+
const sideContext = React59.useContext(
|
|
4442
4612
|
side === "left" ? SidebarLeftContext : SidebarRightContext
|
|
4443
4613
|
);
|
|
4444
4614
|
if (!sideContext) {
|
|
@@ -4462,9 +4632,9 @@ var SidebarProvider = forwardRef15(
|
|
|
4462
4632
|
...props
|
|
4463
4633
|
}, ref) => {
|
|
4464
4634
|
const isMobile = useIsMobile();
|
|
4465
|
-
const lastToggledSideRef =
|
|
4466
|
-
const leftToggleRef =
|
|
4467
|
-
const rightToggleRef =
|
|
4635
|
+
const lastToggledSideRef = React59.useRef("left");
|
|
4636
|
+
const leftToggleRef = React59.useRef(null);
|
|
4637
|
+
const rightToggleRef = React59.useRef(null);
|
|
4468
4638
|
const leftState = useSidebarSideState({
|
|
4469
4639
|
side: "left",
|
|
4470
4640
|
isMobile,
|
|
@@ -4483,18 +4653,21 @@ var SidebarProvider = forwardRef15(
|
|
|
4483
4653
|
storageKey,
|
|
4484
4654
|
lastToggledSideRef
|
|
4485
4655
|
});
|
|
4486
|
-
|
|
4656
|
+
useEffect4(() => {
|
|
4487
4657
|
leftToggleRef.current = leftState.toggleSidebar;
|
|
4488
4658
|
}, [leftState.toggleSidebar]);
|
|
4489
|
-
|
|
4659
|
+
useEffect4(() => {
|
|
4490
4660
|
rightToggleRef.current = rightState.toggleSidebar;
|
|
4491
4661
|
}, [rightState.toggleSidebar]);
|
|
4492
|
-
|
|
4662
|
+
useEffect4(() => {
|
|
4493
4663
|
const handleKeyDown = (event) => {
|
|
4494
4664
|
const target = event.target;
|
|
4495
4665
|
if (target && (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.tagName === "SELECT" || target.isContentEditable)) {
|
|
4496
4666
|
return;
|
|
4497
4667
|
}
|
|
4668
|
+
if (event.metaKey || event.ctrlKey && !event.getModifierState("AltGraph")) {
|
|
4669
|
+
return;
|
|
4670
|
+
}
|
|
4498
4671
|
const shortcutSide = event.key === SIDEBAR_KEYBOARD_SHORTCUT_LEFT ? "left" : event.key === SIDEBAR_KEYBOARD_SHORTCUT_RIGHT ? "right" : null;
|
|
4499
4672
|
if (!shortcutSide) {
|
|
4500
4673
|
return;
|
|
@@ -4506,7 +4679,7 @@ var SidebarProvider = forwardRef15(
|
|
|
4506
4679
|
window.addEventListener("keydown", handleKeyDown);
|
|
4507
4680
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
4508
4681
|
}, []);
|
|
4509
|
-
return /* @__PURE__ */
|
|
4682
|
+
return /* @__PURE__ */ React59.createElement(SidebarIsMobileContext.Provider, { value: isMobile }, /* @__PURE__ */ React59.createElement(SidebarLeftContext.Provider, { value: leftState }, /* @__PURE__ */ React59.createElement(SidebarRightContext.Provider, { value: rightState }, /* @__PURE__ */ React59.createElement(TooltipProvider, { delayDuration: 0 }, /* @__PURE__ */ React59.createElement(
|
|
4510
4683
|
"div",
|
|
4511
4684
|
{
|
|
4512
4685
|
style: {
|
|
@@ -4520,6 +4693,7 @@ var SidebarProvider = forwardRef15(
|
|
|
4520
4693
|
className
|
|
4521
4694
|
),
|
|
4522
4695
|
ref,
|
|
4696
|
+
"data-sidebar-provider": "",
|
|
4523
4697
|
...props
|
|
4524
4698
|
},
|
|
4525
4699
|
children
|
|
@@ -4527,23 +4701,54 @@ var SidebarProvider = forwardRef15(
|
|
|
4527
4701
|
}
|
|
4528
4702
|
);
|
|
4529
4703
|
SidebarProvider.displayName = "SidebarProvider";
|
|
4530
|
-
var Sidebar =
|
|
4531
|
-
({
|
|
4704
|
+
var Sidebar = React59.forwardRef(
|
|
4705
|
+
({
|
|
4706
|
+
side = "left",
|
|
4707
|
+
collapsible = "offcanvas",
|
|
4708
|
+
className,
|
|
4709
|
+
children,
|
|
4710
|
+
resizable,
|
|
4711
|
+
defaultWidth,
|
|
4712
|
+
minWidth,
|
|
4713
|
+
maxWidth,
|
|
4714
|
+
widthStorageKey,
|
|
4715
|
+
...props
|
|
4716
|
+
}, ref) => {
|
|
4532
4717
|
const { isMobile, state, openMobile, setOpenMobile } = useSidebar(side);
|
|
4533
|
-
const
|
|
4718
|
+
const rootRef = React59.useRef(null);
|
|
4719
|
+
const setRootRef = React59.useCallback(
|
|
4720
|
+
(node) => {
|
|
4721
|
+
rootRef.current = node;
|
|
4722
|
+
if (typeof ref === "function") ref(node);
|
|
4723
|
+
else if (ref) ref.current = node;
|
|
4724
|
+
},
|
|
4725
|
+
[ref]
|
|
4726
|
+
);
|
|
4727
|
+
const resize = useSidebarResize({
|
|
4728
|
+
resizable,
|
|
4729
|
+
defaultWidth,
|
|
4730
|
+
minWidth,
|
|
4731
|
+
maxWidth,
|
|
4732
|
+
widthStorageKey,
|
|
4733
|
+
side,
|
|
4734
|
+
isMobile,
|
|
4735
|
+
expanded: state === "expanded" || collapsible === "none",
|
|
4736
|
+
rootRef
|
|
4737
|
+
});
|
|
4738
|
+
const sidebarWidth = resizable ? `${resize.width}px` : side === "right" ? SIDEBAR_RIGHT_WIDTH : SIDEBAR_WIDTH;
|
|
4534
4739
|
if (isMobile) {
|
|
4535
|
-
return /* @__PURE__ */
|
|
4740
|
+
return /* @__PURE__ */ React59.createElement(SidebarSideContext.Provider, { value: side }, /* @__PURE__ */ React59.createElement(SidebarResizeContext.Provider, { value: resize }, /* @__PURE__ */ React59.createElement(
|
|
4536
4741
|
Drawer,
|
|
4537
4742
|
{
|
|
4538
4743
|
isOpen: openMobile,
|
|
4539
4744
|
onDismiss: () => setOpenMobile(false),
|
|
4540
4745
|
placement: side
|
|
4541
4746
|
},
|
|
4542
|
-
/* @__PURE__ */
|
|
4543
|
-
));
|
|
4747
|
+
/* @__PURE__ */ React59.createElement(Box, { "data-sidebar": "sidebar", "data-mobile": "true", height: "100" }, children)
|
|
4748
|
+
)));
|
|
4544
4749
|
}
|
|
4545
4750
|
if (collapsible === "none") {
|
|
4546
|
-
return /* @__PURE__ */
|
|
4751
|
+
return /* @__PURE__ */ React59.createElement(SidebarSideContext.Provider, { value: side }, /* @__PURE__ */ React59.createElement(SidebarResizeContext.Provider, { value: resize }, /* @__PURE__ */ React59.createElement(
|
|
4547
4752
|
"div",
|
|
4548
4753
|
{
|
|
4549
4754
|
className: classNames34(
|
|
@@ -4552,18 +4757,19 @@ var Sidebar = React58.forwardRef(
|
|
|
4552
4757
|
),
|
|
4553
4758
|
style: {
|
|
4554
4759
|
"--sidebar-width": sidebarWidth,
|
|
4555
|
-
width: "var(--sidebar-width)"
|
|
4760
|
+
width: "var(--sidebar-width)",
|
|
4761
|
+
...resizable ? { position: "relative", flexShrink: 0 } : {}
|
|
4556
4762
|
},
|
|
4557
|
-
ref,
|
|
4763
|
+
ref: setRootRef,
|
|
4558
4764
|
...props
|
|
4559
4765
|
},
|
|
4560
4766
|
children
|
|
4561
|
-
));
|
|
4767
|
+
)));
|
|
4562
4768
|
}
|
|
4563
|
-
return /* @__PURE__ */
|
|
4769
|
+
return /* @__PURE__ */ React59.createElement(SidebarSideContext.Provider, { value: side }, /* @__PURE__ */ React59.createElement(SidebarResizeContext.Provider, { value: resize }, /* @__PURE__ */ React59.createElement(
|
|
4564
4770
|
Box,
|
|
4565
4771
|
{
|
|
4566
|
-
ref,
|
|
4772
|
+
ref: setRootRef,
|
|
4567
4773
|
background: "primary",
|
|
4568
4774
|
display: { base: "none", desktop: "block" },
|
|
4569
4775
|
color: "base",
|
|
@@ -4577,13 +4783,13 @@ var Sidebar = React58.forwardRef(
|
|
|
4577
4783
|
"data-side": side,
|
|
4578
4784
|
className: "group"
|
|
4579
4785
|
},
|
|
4580
|
-
/* @__PURE__ */
|
|
4786
|
+
/* @__PURE__ */ React59.createElement(
|
|
4581
4787
|
"div",
|
|
4582
4788
|
{
|
|
4583
4789
|
style: {
|
|
4584
4790
|
animationTimingFunction: "var(--sidebar-transition-timing, linear)",
|
|
4585
4791
|
transitionTimingFunction: "var(--sidebar-transition-timing, linear)",
|
|
4586
|
-
transitionDuration: "var(--sidebar-transition-duration, 200ms)",
|
|
4792
|
+
transitionDuration: resize.animate ? "var(--sidebar-transition-duration, 200ms)" : "0ms",
|
|
4587
4793
|
animationDuration: "var(--sidebar-transition-duration, 200ms)",
|
|
4588
4794
|
transitionProperty: "width",
|
|
4589
4795
|
width: getSidebarWidth(state, collapsible),
|
|
@@ -4592,7 +4798,7 @@ var Sidebar = React58.forwardRef(
|
|
|
4592
4798
|
className: classNames34("position-relative", className)
|
|
4593
4799
|
}
|
|
4594
4800
|
),
|
|
4595
|
-
/* @__PURE__ */
|
|
4801
|
+
/* @__PURE__ */ React59.createElement(
|
|
4596
4802
|
"div",
|
|
4597
4803
|
{
|
|
4598
4804
|
className: classNames34(
|
|
@@ -4606,7 +4812,7 @@ var Sidebar = React58.forwardRef(
|
|
|
4606
4812
|
zIndex: "var(--size-z-index-drawer)",
|
|
4607
4813
|
animationTimingFunction: "var(--sidebar-transition-timing, linear)",
|
|
4608
4814
|
transitionTimingFunction: "var(--sidebar-transition-timing, linear)",
|
|
4609
|
-
transitionDuration: "var(--sidebar-transition-duration, 200ms)",
|
|
4815
|
+
transitionDuration: resize.animate ? "var(--sidebar-transition-duration, 200ms)" : "0ms",
|
|
4610
4816
|
animationDuration: "var(--sidebar-transition-duration, 200ms)",
|
|
4611
4817
|
transitionProperty: "left, right, width",
|
|
4612
4818
|
width: state === "collapsed" && collapsible === "icon" ? "var(--sidebar-width-icon)" : "var(--sidebar-width)",
|
|
@@ -4614,7 +4820,7 @@ var Sidebar = React58.forwardRef(
|
|
|
4614
4820
|
},
|
|
4615
4821
|
...props
|
|
4616
4822
|
},
|
|
4617
|
-
/* @__PURE__ */
|
|
4823
|
+
/* @__PURE__ */ React59.createElement(
|
|
4618
4824
|
"div",
|
|
4619
4825
|
{
|
|
4620
4826
|
"data-sidebar": "sidebar",
|
|
@@ -4628,13 +4834,13 @@ var Sidebar = React58.forwardRef(
|
|
|
4628
4834
|
children
|
|
4629
4835
|
)
|
|
4630
4836
|
)
|
|
4631
|
-
));
|
|
4837
|
+
)));
|
|
4632
4838
|
}
|
|
4633
4839
|
);
|
|
4634
4840
|
Sidebar.displayName = "Sidebar";
|
|
4635
|
-
var SidebarTrigger =
|
|
4841
|
+
var SidebarTrigger = React59.forwardRef(({ className, onClick, side, iconName = "dock-left", ...props }, ref) => {
|
|
4636
4842
|
const { toggleSidebar, side: contextSide } = useSidebar(side);
|
|
4637
|
-
return /* @__PURE__ */
|
|
4843
|
+
return /* @__PURE__ */ React59.createElement(
|
|
4638
4844
|
Button,
|
|
4639
4845
|
{
|
|
4640
4846
|
ref,
|
|
@@ -4659,8 +4865,8 @@ var SidebarTrigger = React58.forwardRef(({ className, onClick, side, iconName =
|
|
|
4659
4865
|
);
|
|
4660
4866
|
});
|
|
4661
4867
|
SidebarTrigger.displayName = "SidebarTrigger";
|
|
4662
|
-
var SidebarInset =
|
|
4663
|
-
return /* @__PURE__ */
|
|
4868
|
+
var SidebarInset = React59.forwardRef(({ className, ...props }, ref) => {
|
|
4869
|
+
return /* @__PURE__ */ React59.createElement(
|
|
4664
4870
|
"main",
|
|
4665
4871
|
{
|
|
4666
4872
|
ref,
|
|
@@ -4673,10 +4879,10 @@ var SidebarInset = React58.forwardRef(({ className, ...props }, ref) => {
|
|
|
4673
4879
|
);
|
|
4674
4880
|
});
|
|
4675
4881
|
SidebarInset.displayName = "SidebarInset";
|
|
4676
|
-
var SidebarHeader =
|
|
4882
|
+
var SidebarHeader = React59.forwardRef(({ className, ...props }, ref) => {
|
|
4677
4883
|
const { state } = useSidebar();
|
|
4678
4884
|
const isCollapsed = state === "collapsed";
|
|
4679
|
-
return /* @__PURE__ */
|
|
4885
|
+
return /* @__PURE__ */ React59.createElement(
|
|
4680
4886
|
"div",
|
|
4681
4887
|
{
|
|
4682
4888
|
ref,
|
|
@@ -4691,8 +4897,8 @@ var SidebarHeader = React58.forwardRef(({ className, ...props }, ref) => {
|
|
|
4691
4897
|
);
|
|
4692
4898
|
});
|
|
4693
4899
|
SidebarHeader.displayName = "SidebarHeader";
|
|
4694
|
-
var SidebarFooter =
|
|
4695
|
-
return /* @__PURE__ */
|
|
4900
|
+
var SidebarFooter = React59.forwardRef(({ className, ...props }, ref) => {
|
|
4901
|
+
return /* @__PURE__ */ React59.createElement(
|
|
4696
4902
|
"div",
|
|
4697
4903
|
{
|
|
4698
4904
|
ref,
|
|
@@ -4706,8 +4912,8 @@ var SidebarFooter = React58.forwardRef(({ className, ...props }, ref) => {
|
|
|
4706
4912
|
);
|
|
4707
4913
|
});
|
|
4708
4914
|
SidebarFooter.displayName = "SidebarFooter";
|
|
4709
|
-
var SidebarContent =
|
|
4710
|
-
return /* @__PURE__ */
|
|
4915
|
+
var SidebarContent = React59.forwardRef(({ className, ...props }, ref) => {
|
|
4916
|
+
return /* @__PURE__ */ React59.createElement(
|
|
4711
4917
|
"div",
|
|
4712
4918
|
{
|
|
4713
4919
|
ref,
|
|
@@ -4722,7 +4928,7 @@ var SidebarContent = React58.forwardRef(({ className, ...props }, ref) => {
|
|
|
4722
4928
|
);
|
|
4723
4929
|
});
|
|
4724
4930
|
SidebarContent.displayName = "SidebarContent";
|
|
4725
|
-
var SidebarMenu =
|
|
4931
|
+
var SidebarMenu = React59.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React59.createElement(
|
|
4726
4932
|
"ul",
|
|
4727
4933
|
{
|
|
4728
4934
|
ref,
|
|
@@ -4738,7 +4944,7 @@ var SidebarMenu = React58.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
4738
4944
|
}
|
|
4739
4945
|
));
|
|
4740
4946
|
SidebarMenu.displayName = "SidebarMenu";
|
|
4741
|
-
var SidebarMenuItem =
|
|
4947
|
+
var SidebarMenuItem = React59.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React59.createElement(
|
|
4742
4948
|
"li",
|
|
4743
4949
|
{
|
|
4744
4950
|
ref,
|
|
@@ -4749,11 +4955,11 @@ var SidebarMenuItem = React58.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
4749
4955
|
}
|
|
4750
4956
|
));
|
|
4751
4957
|
SidebarMenuItem.displayName = "SidebarMenuItem";
|
|
4752
|
-
var SidebarMenuButton =
|
|
4958
|
+
var SidebarMenuButton = React59.forwardRef(
|
|
4753
4959
|
({ asChild = false, isActive = false, tooltip, className, ...props }, ref) => {
|
|
4754
4960
|
const Comp = asChild ? Slot3 : "button";
|
|
4755
4961
|
const { isMobile, state, side } = useSidebar();
|
|
4756
|
-
const button = /* @__PURE__ */
|
|
4962
|
+
const button = /* @__PURE__ */ React59.createElement(
|
|
4757
4963
|
Comp,
|
|
4758
4964
|
{
|
|
4759
4965
|
ref,
|
|
@@ -4779,7 +4985,7 @@ var SidebarMenuButton = React58.forwardRef(
|
|
|
4779
4985
|
children: tooltip
|
|
4780
4986
|
};
|
|
4781
4987
|
}
|
|
4782
|
-
return /* @__PURE__ */
|
|
4988
|
+
return /* @__PURE__ */ React59.createElement(Tooltip, null, /* @__PURE__ */ React59.createElement(TooltipTrigger, { asChild: true }, button), /* @__PURE__ */ React59.createElement(
|
|
4783
4989
|
TooltipContent,
|
|
4784
4990
|
{
|
|
4785
4991
|
side: side === "right" ? "left" : "right",
|
|
@@ -4791,8 +4997,8 @@ var SidebarMenuButton = React58.forwardRef(
|
|
|
4791
4997
|
}
|
|
4792
4998
|
);
|
|
4793
4999
|
SidebarMenuButton.displayName = "SidebarMenuButton";
|
|
4794
|
-
var SidebarGroup =
|
|
4795
|
-
return /* @__PURE__ */
|
|
5000
|
+
var SidebarGroup = React59.forwardRef(({ className, ...props }, ref) => {
|
|
5001
|
+
return /* @__PURE__ */ React59.createElement(
|
|
4796
5002
|
"div",
|
|
4797
5003
|
{
|
|
4798
5004
|
ref,
|
|
@@ -4806,8 +5012,8 @@ var SidebarGroup = React58.forwardRef(({ className, ...props }, ref) => {
|
|
|
4806
5012
|
);
|
|
4807
5013
|
});
|
|
4808
5014
|
SidebarGroup.displayName = "SidebarGroup";
|
|
4809
|
-
var SidebarGroupLabel =
|
|
4810
|
-
return /* @__PURE__ */
|
|
5015
|
+
var SidebarGroupLabel = React59.forwardRef(({ className, ...props }, ref) => {
|
|
5016
|
+
return /* @__PURE__ */ React59.createElement(
|
|
4811
5017
|
"div",
|
|
4812
5018
|
{
|
|
4813
5019
|
ref,
|
|
@@ -4821,7 +5027,7 @@ var SidebarGroupLabel = React58.forwardRef(({ className, ...props }, ref) => {
|
|
|
4821
5027
|
);
|
|
4822
5028
|
});
|
|
4823
5029
|
SidebarGroupLabel.displayName = "SidebarGroupLabel";
|
|
4824
|
-
var SidebarMenuSub =
|
|
5030
|
+
var SidebarMenuSub = React59.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React59.createElement(
|
|
4825
5031
|
"ul",
|
|
4826
5032
|
{
|
|
4827
5033
|
ref,
|
|
@@ -4837,11 +5043,11 @@ var SidebarMenuSub = React58.forwardRef(({ className, ...props }, ref) => /* @__
|
|
|
4837
5043
|
}
|
|
4838
5044
|
));
|
|
4839
5045
|
SidebarMenuSub.displayName = "SidebarMenuSub";
|
|
4840
|
-
var SidebarMenuSubItem =
|
|
5046
|
+
var SidebarMenuSubItem = React59.forwardRef(({ ...props }, ref) => /* @__PURE__ */ React59.createElement("li", { ref, ...props }));
|
|
4841
5047
|
SidebarMenuSubItem.displayName = "SidebarMenuSubItem";
|
|
4842
|
-
var SidebarMenuSubButton =
|
|
5048
|
+
var SidebarMenuSubButton = React59.forwardRef(({ asChild = false, isActive, className, ...props }, ref) => {
|
|
4843
5049
|
const Comp = asChild ? Slot3 : "a";
|
|
4844
|
-
return /* @__PURE__ */
|
|
5050
|
+
return /* @__PURE__ */ React59.createElement(
|
|
4845
5051
|
Comp,
|
|
4846
5052
|
{
|
|
4847
5053
|
ref,
|
|
@@ -4860,9 +5066,9 @@ var SidebarMenuSubButton = React58.forwardRef(({ asChild = false, isActive, clas
|
|
|
4860
5066
|
);
|
|
4861
5067
|
});
|
|
4862
5068
|
SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
|
|
4863
|
-
var SidebarMenuAction =
|
|
5069
|
+
var SidebarMenuAction = React59.forwardRef(({ className, asChild = false, ...props }, ref) => {
|
|
4864
5070
|
const Comp = asChild ? Slot3 : "button";
|
|
4865
|
-
return /* @__PURE__ */
|
|
5071
|
+
return /* @__PURE__ */ React59.createElement(
|
|
4866
5072
|
Comp,
|
|
4867
5073
|
{
|
|
4868
5074
|
ref,
|
|
@@ -4880,25 +5086,30 @@ var SidebarMenuAction = React58.forwardRef(({ className, asChild = false, ...pro
|
|
|
4880
5086
|
);
|
|
4881
5087
|
});
|
|
4882
5088
|
SidebarMenuAction.displayName = "SidebarMenuAction";
|
|
4883
|
-
var SidebarRail =
|
|
5089
|
+
var SidebarRail = React59.forwardRef(({ className, ...props }, ref) => {
|
|
4884
5090
|
const { open, toggleSidebar, side } = useSidebar();
|
|
5091
|
+
const resize = React59.useContext(SidebarResizeContext);
|
|
5092
|
+
const descriptionId = useId();
|
|
4885
5093
|
const shortcutLabel = side === "left" ? SIDEBAR_KEYBOARD_SHORTCUT_LEFT : SIDEBAR_KEYBOARD_SHORTCUT_RIGHT;
|
|
4886
5094
|
const caretIcon = open ? side === "right" ? "caret-sm-right" : "caret-sm-left" : side === "right" ? "caret-sm-left" : "caret-sm-right";
|
|
4887
|
-
return /* @__PURE__ */
|
|
5095
|
+
return /* @__PURE__ */ React59.createElement(React59.Fragment, null, /* @__PURE__ */ React59.createElement(
|
|
4888
5096
|
"button",
|
|
4889
5097
|
{
|
|
4890
5098
|
ref,
|
|
4891
5099
|
"data-sidebar": "rail",
|
|
4892
|
-
"
|
|
4893
|
-
|
|
5100
|
+
"data-resizable": resize?.enabled || void 0,
|
|
5101
|
+
"aria-label": resize?.enabled ? `Resize or toggle ${side} sidebar` : "Toggle Sidebar",
|
|
5102
|
+
"aria-describedby": resize?.enabled ? descriptionId : void 0,
|
|
5103
|
+
tabIndex: resize?.enabled ? 0 : -1,
|
|
5104
|
+
...resize?.enabled ? resize.railProps : {},
|
|
4894
5105
|
onClick: toggleSidebar,
|
|
4895
|
-
title: `Toggle Sidebar ${shortcutLabel}`,
|
|
5106
|
+
title: resize?.enabled ? `Drag to resize; click to toggle (${shortcutLabel})` : `Toggle Sidebar ${shortcutLabel}`,
|
|
4896
5107
|
className: classNames34(
|
|
4897
5108
|
Sidebar_module_default.rail,
|
|
4898
5109
|
"hover-show-child background-color-transparent display-flex p-top-5xl p-left-xl p-right-0 justify-content-center position-absolute",
|
|
4899
5110
|
{
|
|
4900
|
-
"cursor-w-resize": open && side === "left" || !open && side === "right",
|
|
4901
|
-
"cursor-e-resize": !open && side === "left" || open && side === "right"
|
|
5111
|
+
"cursor-w-resize": !resize?.enabled && (open && side === "left" || !open && side === "right"),
|
|
5112
|
+
"cursor-e-resize": !resize?.enabled && (!open && side === "left" || open && side === "right")
|
|
4902
5113
|
},
|
|
4903
5114
|
className
|
|
4904
5115
|
),
|
|
@@ -4907,12 +5118,13 @@ var SidebarRail = React58.forwardRef(({ className, ...props }, ref) => {
|
|
|
4907
5118
|
bottom: "20px",
|
|
4908
5119
|
right: side === "left" ? "-14px" : void 0,
|
|
4909
5120
|
left: side === "right" ? "-18px" : void 0,
|
|
4910
|
-
width: "10px"
|
|
5121
|
+
width: "10px",
|
|
5122
|
+
...resize?.enabled ? { cursor: "col-resize", touchAction: "none" } : {}
|
|
4911
5123
|
},
|
|
4912
5124
|
type: "button",
|
|
4913
5125
|
...props
|
|
4914
5126
|
},
|
|
4915
|
-
/* @__PURE__ */
|
|
5127
|
+
/* @__PURE__ */ React59.createElement(
|
|
4916
5128
|
Box,
|
|
4917
5129
|
{
|
|
4918
5130
|
radius: "xl",
|
|
@@ -4929,18 +5141,18 @@ var SidebarRail = React58.forwardRef(({ className, ...props }, ref) => {
|
|
|
4929
5141
|
className: classNames34(
|
|
4930
5142
|
"hover-child",
|
|
4931
5143
|
{
|
|
4932
|
-
"cursor-w-resize": open && side === "left" || !open && side === "right",
|
|
4933
|
-
"cursor-e-resize": !open && side === "left" || open && side === "right"
|
|
5144
|
+
"cursor-w-resize": !resize?.enabled && (open && side === "left" || !open && side === "right"),
|
|
5145
|
+
"cursor-e-resize": !resize?.enabled && (!open && side === "left" || open && side === "right")
|
|
4934
5146
|
},
|
|
4935
5147
|
className
|
|
4936
5148
|
)
|
|
4937
5149
|
},
|
|
4938
|
-
/* @__PURE__ */
|
|
5150
|
+
/* @__PURE__ */ React59.createElement(Icon, { name: caretIcon })
|
|
4939
5151
|
)
|
|
4940
|
-
);
|
|
5152
|
+
), resize?.enabled && /* @__PURE__ */ React59.createElement("span", { id: descriptionId, className: Sidebar_module_default.resizeDescription }, "Width ", Math.round(resize.width), " pixels. Use left and right arrows to resize, Home for minimum, End for maximum, and Enter or Space to toggle."));
|
|
4941
5153
|
});
|
|
4942
5154
|
SidebarRail.displayName = "SidebarRail";
|
|
4943
|
-
var SidebarMenuBadge =
|
|
5155
|
+
var SidebarMenuBadge = React59.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React59.createElement(
|
|
4944
5156
|
"div",
|
|
4945
5157
|
{
|
|
4946
5158
|
ref,
|
|
@@ -4959,28 +5171,28 @@ var SidebarMenuBadge = React58.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
4959
5171
|
SidebarMenuBadge.displayName = "SidebarMenuBadge";
|
|
4960
5172
|
|
|
4961
5173
|
// src/components/Table/Table.tsx
|
|
4962
|
-
import
|
|
5174
|
+
import React65 from "react";
|
|
4963
5175
|
import classNames40 from "classnames";
|
|
4964
5176
|
|
|
4965
5177
|
// src/components/Table/Table.module.scss
|
|
4966
5178
|
var Table_module_default = { "container": "container__zReWp", "loading-mask": "loading-mask__gwG6j", "scroll-container": "scroll-container__79zJk", "table": "table__ojslm", "auto": "auto__bXEGP", "fixed": "fixed__zPdl3", "borderless": "borderless__AlDGM", "scrollable": "scrollable__HSxT1", "scrollable-x": "scrollable-x__aKmx8", "scrollable-y": "scrollable-y__8nNit", "table-bordered": "table-bordered__oTd6P", "full-height": "full-height__YPJfE" };
|
|
4967
5179
|
|
|
4968
5180
|
// src/components/Table/TableBody/TableBody.tsx
|
|
4969
|
-
import
|
|
5181
|
+
import React63 from "react";
|
|
4970
5182
|
import classNames38 from "classnames";
|
|
4971
5183
|
|
|
4972
5184
|
// src/components/Table/TableBody/TableBody.module.scss
|
|
4973
5185
|
var TableBody_module_default = { "table-body": "table-body__cX0OQ", "striped": "striped__1Epqn", "hover": "hover__I3QF4" };
|
|
4974
5186
|
|
|
4975
5187
|
// src/components/Table/common/TableRow/TableRow.tsx
|
|
4976
|
-
import
|
|
5188
|
+
import React62 from "react";
|
|
4977
5189
|
import classNames37 from "classnames";
|
|
4978
5190
|
|
|
4979
5191
|
// src/components/Table/common/TableRow/TableRow.module.scss
|
|
4980
5192
|
var TableRow_module_default = { "table-row": "table-row__BdHbx", "hoverable": "hoverable__Bdemq" };
|
|
4981
5193
|
|
|
4982
5194
|
// src/components/Table/TableBody/TableBodyCell/TableBodyCell.tsx
|
|
4983
|
-
import
|
|
5195
|
+
import React60 from "react";
|
|
4984
5196
|
import classNames35 from "classnames";
|
|
4985
5197
|
|
|
4986
5198
|
// src/components/Table/TableBody/TableBodyCell/TableBodyCell.module.scss
|
|
@@ -5013,7 +5225,7 @@ var TableBodyCell = ({
|
|
|
5013
5225
|
},
|
|
5014
5226
|
className
|
|
5015
5227
|
);
|
|
5016
|
-
return /* @__PURE__ */
|
|
5228
|
+
return /* @__PURE__ */ React60.createElement(
|
|
5017
5229
|
Box,
|
|
5018
5230
|
{
|
|
5019
5231
|
as: columnIsSticky ? "th" : "td",
|
|
@@ -5031,7 +5243,7 @@ var TableBodyCell = ({
|
|
|
5031
5243
|
var TableBodyCell_default = TableBodyCell;
|
|
5032
5244
|
|
|
5033
5245
|
// src/components/Table/TableHead/TableHeaderCell/TableHeaderCell.tsx
|
|
5034
|
-
import
|
|
5246
|
+
import React61 from "react";
|
|
5035
5247
|
import classNames36 from "classnames";
|
|
5036
5248
|
|
|
5037
5249
|
// src/components/Table/TableHead/TableHeaderCell/TableHeaderCell.module.scss
|
|
@@ -5058,7 +5270,7 @@ var TableHeaderCell = ({
|
|
|
5058
5270
|
const renderIcon = () => {
|
|
5059
5271
|
const renderArrows = () => {
|
|
5060
5272
|
if (getSortDirection() === "ascending") {
|
|
5061
|
-
return /* @__PURE__ */
|
|
5273
|
+
return /* @__PURE__ */ React61.createElement(
|
|
5062
5274
|
Icon,
|
|
5063
5275
|
{
|
|
5064
5276
|
name: "caret-sm-up",
|
|
@@ -5067,7 +5279,7 @@ var TableHeaderCell = ({
|
|
|
5067
5279
|
);
|
|
5068
5280
|
}
|
|
5069
5281
|
if (getSortDirection() === "descending") {
|
|
5070
|
-
return /* @__PURE__ */
|
|
5282
|
+
return /* @__PURE__ */ React61.createElement(
|
|
5071
5283
|
Icon,
|
|
5072
5284
|
{
|
|
5073
5285
|
name: "caret-sm-down",
|
|
@@ -5075,7 +5287,7 @@ var TableHeaderCell = ({
|
|
|
5075
5287
|
}
|
|
5076
5288
|
);
|
|
5077
5289
|
}
|
|
5078
|
-
return /* @__PURE__ */
|
|
5290
|
+
return /* @__PURE__ */ React61.createElement(
|
|
5079
5291
|
Box,
|
|
5080
5292
|
{
|
|
5081
5293
|
display: "inline-block",
|
|
@@ -5086,7 +5298,7 @@ var TableHeaderCell = ({
|
|
|
5086
5298
|
}
|
|
5087
5299
|
);
|
|
5088
5300
|
};
|
|
5089
|
-
return /* @__PURE__ */
|
|
5301
|
+
return /* @__PURE__ */ React61.createElement("span", { className: TableHeaderCell_module_default["sort-icon"] }, renderArrows());
|
|
5090
5302
|
};
|
|
5091
5303
|
const handleKeyPress = (event) => {
|
|
5092
5304
|
if (!onSort || !isSortable) return;
|
|
@@ -5118,7 +5330,7 @@ var TableHeaderCell = ({
|
|
|
5118
5330
|
},
|
|
5119
5331
|
className
|
|
5120
5332
|
);
|
|
5121
|
-
return /* @__PURE__ */
|
|
5333
|
+
return /* @__PURE__ */ React61.createElement(
|
|
5122
5334
|
Box,
|
|
5123
5335
|
{
|
|
5124
5336
|
as: "th",
|
|
@@ -5131,7 +5343,7 @@ var TableHeaderCell = ({
|
|
|
5131
5343
|
onKeyDown: handleKeyPress,
|
|
5132
5344
|
scope: "col"
|
|
5133
5345
|
},
|
|
5134
|
-
/* @__PURE__ */
|
|
5346
|
+
/* @__PURE__ */ React61.createElement("div", { className: TableHeaderCell_module_default.heading }, column.heading, isSortable && renderIcon())
|
|
5135
5347
|
);
|
|
5136
5348
|
};
|
|
5137
5349
|
|
|
@@ -5164,7 +5376,7 @@ var TableRow = ({
|
|
|
5164
5376
|
return true;
|
|
5165
5377
|
}
|
|
5166
5378
|
if (Array.isArray(value)) return value.every(isRenderableCell);
|
|
5167
|
-
return
|
|
5379
|
+
return React62.isValidElement(value);
|
|
5168
5380
|
};
|
|
5169
5381
|
const renderCellContent = (column) => {
|
|
5170
5382
|
if (column.render) {
|
|
@@ -5184,8 +5396,8 @@ var TableRow = ({
|
|
|
5184
5396
|
}
|
|
5185
5397
|
return void 0;
|
|
5186
5398
|
};
|
|
5187
|
-
return /* @__PURE__ */
|
|
5188
|
-
(column, columnIndex) => isTableHead ? /* @__PURE__ */
|
|
5399
|
+
return /* @__PURE__ */ React62.createElement("tr", { className: tableRowClasses }, Object.values(columns).map(
|
|
5400
|
+
(column, columnIndex) => isTableHead ? /* @__PURE__ */ React62.createElement(
|
|
5189
5401
|
TableHeaderCell,
|
|
5190
5402
|
{
|
|
5191
5403
|
column,
|
|
@@ -5203,7 +5415,7 @@ var TableRow = ({
|
|
|
5203
5415
|
hasStickyHeader,
|
|
5204
5416
|
sticky: column.sticky
|
|
5205
5417
|
}
|
|
5206
|
-
) : /* @__PURE__ */
|
|
5418
|
+
) : /* @__PURE__ */ React62.createElement(
|
|
5207
5419
|
TableBodyCell_default,
|
|
5208
5420
|
{
|
|
5209
5421
|
align: column.align || align,
|
|
@@ -5250,7 +5462,7 @@ var TableBody = ({
|
|
|
5250
5462
|
}
|
|
5251
5463
|
return `row-index-${rowIndex}`;
|
|
5252
5464
|
};
|
|
5253
|
-
return /* @__PURE__ */
|
|
5465
|
+
return /* @__PURE__ */ React63.createElement("tbody", { className: tableBodyClasses }, rows.map((row, rowIndex) => /* @__PURE__ */ React63.createElement(
|
|
5254
5466
|
TableRow,
|
|
5255
5467
|
{
|
|
5256
5468
|
columns,
|
|
@@ -5267,7 +5479,7 @@ var TableBody = ({
|
|
|
5267
5479
|
};
|
|
5268
5480
|
|
|
5269
5481
|
// src/components/Table/TableHead/TableHead.tsx
|
|
5270
|
-
import
|
|
5482
|
+
import React64 from "react";
|
|
5271
5483
|
import classNames39 from "classnames";
|
|
5272
5484
|
var TableHead = ({
|
|
5273
5485
|
columns,
|
|
@@ -5281,7 +5493,7 @@ var TableHead = ({
|
|
|
5281
5493
|
truncateOverflow = false
|
|
5282
5494
|
}) => {
|
|
5283
5495
|
const tableHeadClasses = classNames39(className);
|
|
5284
|
-
return /* @__PURE__ */
|
|
5496
|
+
return /* @__PURE__ */ React64.createElement("thead", { className: tableHeadClasses }, /* @__PURE__ */ React64.createElement(
|
|
5285
5497
|
TableRow,
|
|
5286
5498
|
{
|
|
5287
5499
|
columns,
|
|
@@ -5335,13 +5547,13 @@ var Table = ({
|
|
|
5335
5547
|
[Table_module_default.borderless]: isBorderless,
|
|
5336
5548
|
[Table_module_default.compact]: isCompact
|
|
5337
5549
|
});
|
|
5338
|
-
return /* @__PURE__ */
|
|
5550
|
+
return /* @__PURE__ */ React65.createElement("div", { className: containerClasses }, isLoading && /* @__PURE__ */ React65.createElement("div", { className: Table_module_default["loading-mask"] }, /* @__PURE__ */ React65.createElement(Spinner, { size: "xl" })), /* @__PURE__ */ React65.createElement(
|
|
5339
5551
|
"div",
|
|
5340
5552
|
{
|
|
5341
5553
|
className: scrollContainerClasses,
|
|
5342
5554
|
"data-testid": "tableContainerDiv-testid"
|
|
5343
5555
|
},
|
|
5344
|
-
/* @__PURE__ */
|
|
5556
|
+
/* @__PURE__ */ React65.createElement("table", { className: tableClasses }, /* @__PURE__ */ React65.createElement(
|
|
5345
5557
|
TableHead,
|
|
5346
5558
|
{
|
|
5347
5559
|
columns,
|
|
@@ -5353,7 +5565,7 @@ var Table = ({
|
|
|
5353
5565
|
truncateOverflow,
|
|
5354
5566
|
hasStickyHeader
|
|
5355
5567
|
}
|
|
5356
|
-
), /* @__PURE__ */
|
|
5568
|
+
), /* @__PURE__ */ React65.createElement(
|
|
5357
5569
|
TableBody,
|
|
5358
5570
|
{
|
|
5359
5571
|
rows,
|
|
@@ -5372,7 +5584,7 @@ var Table = ({
|
|
|
5372
5584
|
};
|
|
5373
5585
|
|
|
5374
5586
|
// src/components/ThemeProvider/ThemeProvider.tsx
|
|
5375
|
-
import
|
|
5587
|
+
import React66, { createContext as createContext4, useState as useState6, useEffect as useEffect5 } from "react";
|
|
5376
5588
|
var initialState = {
|
|
5377
5589
|
theme: "system",
|
|
5378
5590
|
setTheme: () => null
|
|
@@ -5384,10 +5596,10 @@ function ThemeProvider({
|
|
|
5384
5596
|
storageKey = "hyphen-ui-theme",
|
|
5385
5597
|
...props
|
|
5386
5598
|
}) {
|
|
5387
|
-
const [theme, setTheme] =
|
|
5599
|
+
const [theme, setTheme] = useState6(
|
|
5388
5600
|
() => localStorage.getItem(storageKey) || defaultTheme
|
|
5389
5601
|
);
|
|
5390
|
-
|
|
5602
|
+
useEffect5(() => {
|
|
5391
5603
|
const root = window.document.documentElement;
|
|
5392
5604
|
root.classList.remove("light", "dark");
|
|
5393
5605
|
if (theme === "system") {
|
|
@@ -5406,14 +5618,14 @@ function ThemeProvider({
|
|
|
5406
5618
|
},
|
|
5407
5619
|
isDarkMode
|
|
5408
5620
|
};
|
|
5409
|
-
return /* @__PURE__ */
|
|
5621
|
+
return /* @__PURE__ */ React66.createElement(ThemeProviderContext.Provider, { ...props, value }, children);
|
|
5410
5622
|
}
|
|
5411
5623
|
|
|
5412
5624
|
// src/components/Toast/ToastContainer.tsx
|
|
5413
|
-
import
|
|
5625
|
+
import React68 from "react";
|
|
5414
5626
|
|
|
5415
5627
|
// src/components/Toast/ToastNotification.tsx
|
|
5416
|
-
import
|
|
5628
|
+
import React67 from "react";
|
|
5417
5629
|
import classNames41 from "classnames";
|
|
5418
5630
|
|
|
5419
5631
|
// src/components/Toast/ToastNotification.module.scss
|
|
@@ -5446,12 +5658,12 @@ var renderToastIcon = (toast2) => {
|
|
|
5446
5658
|
iconName = "c-warning";
|
|
5447
5659
|
iconColor = "white";
|
|
5448
5660
|
}
|
|
5449
|
-
const icon = type !== "loading" ? /* @__PURE__ */
|
|
5450
|
-
return /* @__PURE__ */
|
|
5661
|
+
const icon = type !== "loading" ? /* @__PURE__ */ React67.createElement(Icon, { name: iconName, color: iconColor }) : /* @__PURE__ */ React67.createElement(Spinner, null);
|
|
5662
|
+
return /* @__PURE__ */ React67.createElement(Box, { justifyContent: "center", height: "100" }, icon);
|
|
5451
5663
|
};
|
|
5452
5664
|
var renderDismissIcon = (toast2, onDismiss) => {
|
|
5453
5665
|
if (!toast2.canDismiss) return;
|
|
5454
|
-
return /* @__PURE__ */
|
|
5666
|
+
return /* @__PURE__ */ React67.createElement(
|
|
5455
5667
|
Box,
|
|
5456
5668
|
{
|
|
5457
5669
|
as: "button",
|
|
@@ -5466,12 +5678,12 @@ var renderDismissIcon = (toast2, onDismiss) => {
|
|
|
5466
5678
|
onClick: onDismiss,
|
|
5467
5679
|
"aria-label": "dismiss notification"
|
|
5468
5680
|
},
|
|
5469
|
-
/* @__PURE__ */
|
|
5681
|
+
/* @__PURE__ */ React67.createElement(Icon, { name: "remove" })
|
|
5470
5682
|
);
|
|
5471
5683
|
};
|
|
5472
|
-
var ToastNotification =
|
|
5684
|
+
var ToastNotification = React67.memo(
|
|
5473
5685
|
({ toast: toast2, position = "top-center", style, children, onDismiss }) => {
|
|
5474
|
-
const message = /* @__PURE__ */
|
|
5686
|
+
const message = /* @__PURE__ */ React67.createElement(
|
|
5475
5687
|
Box,
|
|
5476
5688
|
{
|
|
5477
5689
|
direction: "row",
|
|
@@ -5493,7 +5705,7 @@ var ToastNotification = React66.memo(
|
|
|
5493
5705
|
[ToastNotification_module_default["toast-error"]]: toast2.type === "error"
|
|
5494
5706
|
}
|
|
5495
5707
|
);
|
|
5496
|
-
return /* @__PURE__ */
|
|
5708
|
+
return /* @__PURE__ */ React67.createElement(
|
|
5497
5709
|
Box,
|
|
5498
5710
|
{
|
|
5499
5711
|
alignItems: "center",
|
|
@@ -5510,16 +5722,16 @@ var ToastNotification = React66.memo(
|
|
|
5510
5722
|
},
|
|
5511
5723
|
typeof children === "function" ? children({
|
|
5512
5724
|
message
|
|
5513
|
-
}) : /* @__PURE__ */
|
|
5725
|
+
}) : /* @__PURE__ */ React67.createElement(React67.Fragment, null, renderToastIcon(toast2), message, renderDismissIcon(toast2, onDismiss))
|
|
5514
5726
|
);
|
|
5515
5727
|
}
|
|
5516
5728
|
);
|
|
5517
5729
|
|
|
5518
5730
|
// src/components/Toast/useToasts.ts
|
|
5519
|
-
import { useEffect as
|
|
5731
|
+
import { useEffect as useEffect7, useMemo as useMemo5 } from "react";
|
|
5520
5732
|
|
|
5521
5733
|
// src/components/Toast/Toast.store.ts
|
|
5522
|
-
import { useState as
|
|
5734
|
+
import { useState as useState7, useEffect as useEffect6 } from "react";
|
|
5523
5735
|
var TOAST_LIMIT = 20;
|
|
5524
5736
|
var toastTimeouts = /* @__PURE__ */ new Map();
|
|
5525
5737
|
var addToDismissedQueue = (toastId) => {
|
|
@@ -5655,8 +5867,8 @@ var defaultTimeouts = {
|
|
|
5655
5867
|
custom: 4e3
|
|
5656
5868
|
};
|
|
5657
5869
|
var useToastStore = (toastOptions = {}) => {
|
|
5658
|
-
const [state, setState] =
|
|
5659
|
-
|
|
5870
|
+
const [state, setState] = useState7(memoryState);
|
|
5871
|
+
useEffect6(() => {
|
|
5660
5872
|
listeners.push(setState);
|
|
5661
5873
|
return () => {
|
|
5662
5874
|
const index = listeners.indexOf(setState);
|
|
@@ -5743,7 +5955,7 @@ toast.async = function(promise, messages, opts) {
|
|
|
5743
5955
|
// src/components/Toast/useToasts.ts
|
|
5744
5956
|
var useToasts = (toastOptions) => {
|
|
5745
5957
|
const { toasts, pausedAt } = useToastStore(toastOptions);
|
|
5746
|
-
|
|
5958
|
+
useEffect7(() => {
|
|
5747
5959
|
if (pausedAt) {
|
|
5748
5960
|
return;
|
|
5749
5961
|
}
|
|
@@ -5847,7 +6059,7 @@ var renderNotification = (currentToast, children, containerPosition) => {
|
|
|
5847
6059
|
if (children) {
|
|
5848
6060
|
return children(currentToast);
|
|
5849
6061
|
}
|
|
5850
|
-
return /* @__PURE__ */
|
|
6062
|
+
return /* @__PURE__ */ React68.createElement(
|
|
5851
6063
|
ToastNotification,
|
|
5852
6064
|
{
|
|
5853
6065
|
toast: currentToast,
|
|
@@ -5867,7 +6079,7 @@ var ToastContainer = ({
|
|
|
5867
6079
|
...restProps
|
|
5868
6080
|
}) => {
|
|
5869
6081
|
const { toasts, handlers } = useToasts(toastOptions);
|
|
5870
|
-
return /* @__PURE__ */
|
|
6082
|
+
return /* @__PURE__ */ React68.createElement(
|
|
5871
6083
|
Box,
|
|
5872
6084
|
{
|
|
5873
6085
|
style: {
|
|
@@ -5897,7 +6109,7 @@ var ToastContainer = ({
|
|
|
5897
6109
|
const ref = t.height ? void 0 : createRectRef((rect) => {
|
|
5898
6110
|
handlers.updateHeight(t.id, rect.height);
|
|
5899
6111
|
});
|
|
5900
|
-
return /* @__PURE__ */
|
|
6112
|
+
return /* @__PURE__ */ React68.createElement(
|
|
5901
6113
|
Box,
|
|
5902
6114
|
{
|
|
5903
6115
|
ref,
|
|
@@ -5915,7 +6127,7 @@ var ToastContainer = ({
|
|
|
5915
6127
|
};
|
|
5916
6128
|
|
|
5917
6129
|
// src/components/Toggle/Toggle.tsx
|
|
5918
|
-
import
|
|
6130
|
+
import React69, { forwardRef as forwardRef16 } from "react";
|
|
5919
6131
|
import * as TogglePrimitive from "@radix-ui/react-toggle";
|
|
5920
6132
|
|
|
5921
6133
|
// src/components/Toggle/Toggle.module.scss
|
|
@@ -5923,7 +6135,7 @@ var Toggle_module_default = { "item": "item__PrPsJ", "outline": "outline__Lkabh"
|
|
|
5923
6135
|
|
|
5924
6136
|
// src/components/Toggle/Toggle.tsx
|
|
5925
6137
|
import classNames42 from "classnames";
|
|
5926
|
-
var Toggle = forwardRef16(({ className, variant = "default", children, ...props }, ref) => /* @__PURE__ */
|
|
6138
|
+
var Toggle = forwardRef16(({ className, variant = "default", children, ...props }, ref) => /* @__PURE__ */ React69.createElement(
|
|
5927
6139
|
TogglePrimitive.Root,
|
|
5928
6140
|
{
|
|
5929
6141
|
ref,
|
|
@@ -5940,12 +6152,12 @@ var Toggle = forwardRef16(({ className, variant = "default", children, ...props
|
|
|
5940
6152
|
Toggle.displayName = "Toggle";
|
|
5941
6153
|
|
|
5942
6154
|
// src/hooks/useBreakpoint/useBreakpoint.ts
|
|
5943
|
-
import { useState as
|
|
6155
|
+
import { useState as useState8 } from "react";
|
|
5944
6156
|
|
|
5945
6157
|
// src/hooks/useWindowSize/useWindowSize.ts
|
|
5946
|
-
import
|
|
6158
|
+
import React70 from "react";
|
|
5947
6159
|
var useWindowSize = () => {
|
|
5948
|
-
const { innerWidth, innerHeight, outerHeight, outerWidth, isCreated } =
|
|
6160
|
+
const { innerWidth, innerHeight, outerHeight, outerWidth, isCreated } = React70.useContext(ResponsiveContext);
|
|
5949
6161
|
if (isCreated) {
|
|
5950
6162
|
return {
|
|
5951
6163
|
innerHeight,
|
|
@@ -5961,7 +6173,7 @@ var useWindowSize = () => {
|
|
|
5961
6173
|
var defaultBreakpoint = { name: "base", minWidth: 0 };
|
|
5962
6174
|
var useBreakpoint = () => {
|
|
5963
6175
|
const windowSize = useWindowSize();
|
|
5964
|
-
const [breakpoint, setBreakpoint] =
|
|
6176
|
+
const [breakpoint, setBreakpoint] = useState8({
|
|
5965
6177
|
...defaultBreakpoint
|
|
5966
6178
|
});
|
|
5967
6179
|
useIsomorphicLayoutEffect(() => {
|
|
@@ -5988,7 +6200,7 @@ var useBreakpoint = () => {
|
|
|
5988
6200
|
};
|
|
5989
6201
|
|
|
5990
6202
|
// src/hooks/useOpenClose/useOpenClose.tsx
|
|
5991
|
-
import { useCallback as useCallback5, useState as
|
|
6203
|
+
import { useCallback as useCallback5, useState as useState9 } from "react";
|
|
5992
6204
|
var useOpenClose = (props = {}) => {
|
|
5993
6205
|
const {
|
|
5994
6206
|
defaultIsOpen,
|
|
@@ -6002,7 +6214,7 @@ var useOpenClose = (props = {}) => {
|
|
|
6002
6214
|
const closeCallback = useCallback5(() => {
|
|
6003
6215
|
onCloseProp?.();
|
|
6004
6216
|
}, [onCloseProp]);
|
|
6005
|
-
const [isOpenState, setIsOpen] =
|
|
6217
|
+
const [isOpenState, setIsOpen] = useState9(defaultIsOpen || false);
|
|
6006
6218
|
const isOpen = isOpenProp !== void 0 ? isOpenProp : isOpenState;
|
|
6007
6219
|
const isControlled = isOpenProp !== void 0;
|
|
6008
6220
|
const handleClose = useCallback5(() => {
|
|
@@ -6033,9 +6245,9 @@ var useOpenClose = (props = {}) => {
|
|
|
6033
6245
|
};
|
|
6034
6246
|
|
|
6035
6247
|
// src/hooks/useTheme/useTheme.ts
|
|
6036
|
-
import
|
|
6248
|
+
import React71 from "react";
|
|
6037
6249
|
var useTheme = () => {
|
|
6038
|
-
const context =
|
|
6250
|
+
const context = React71.useContext(ThemeProviderContext);
|
|
6039
6251
|
if (context === void 0)
|
|
6040
6252
|
throw new Error(
|
|
6041
6253
|
"useTheme must be used within a ThemeProvider. Be sure your App is wrapped in ThemeProvider."
|