@knkcs/anker 1.9.2 → 1.9.4
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.
|
@@ -153,7 +153,6 @@ interface ContextRailProps {
|
|
|
153
153
|
interface ContextRailHeaderProps {
|
|
154
154
|
eyebrow?: React__default.ReactNode;
|
|
155
155
|
title: React__default.ReactNode;
|
|
156
|
-
onClose?: () => void;
|
|
157
156
|
}
|
|
158
157
|
interface ContextRailSectionProps {
|
|
159
158
|
id: string;
|
|
@@ -168,7 +167,7 @@ declare const ContextRail: {
|
|
|
168
167
|
displayName: string;
|
|
169
168
|
} & {
|
|
170
169
|
Header: {
|
|
171
|
-
({ eyebrow, title
|
|
170
|
+
({ eyebrow, title }: ContextRailHeaderProps): react_jsx_runtime.JSX.Element;
|
|
172
171
|
displayName: string;
|
|
173
172
|
};
|
|
174
173
|
Section: {
|
package/dist/components/index.js
CHANGED
|
@@ -5,12 +5,12 @@ import { Popover, PopoverTrigger, PopoverContent, PopoverBody, Switch } from '..
|
|
|
5
5
|
import { text_input_default } from '../chunk-OU6H3KU4.js';
|
|
6
6
|
import { Button, IconButton } from '../chunk-JS7ZEZV3.js';
|
|
7
7
|
export { AuthCard, PageHeader } from '../chunk-D5ICTOCW.js';
|
|
8
|
-
import { Box, Flex,
|
|
8
|
+
import { Box, Flex, Heading, Text, HStack, Grid, GridItem, Code, Link, VStack, Spacer, Stack } from '../chunk-G4QMIXLC.js';
|
|
9
9
|
import { PanelRightOpen, PanelRightClose, ChevronRight, Search, PanelLeftOpen, PanelLeftClose, X, Ellipsis, Plus, ChevronLeft, ArrowUp, ArrowDown, ArrowUpDown, ChevronDown, Check, Upload } from 'lucide-react';
|
|
10
10
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
11
|
-
import { createContext, Timeline, TreeView, Card as Card$1, Menu, Portal, Checkbox, Drawer, ButtonGroup, Dialog, useSlotRecipe, chakra } from '@chakra-ui/react';
|
|
11
|
+
import { createContext as createContext$1, Timeline, TreeView, Card as Card$1, Menu, Portal, Checkbox, Drawer, ButtonGroup, Dialog, useSlotRecipe, chakra } from '@chakra-ui/react';
|
|
12
12
|
export { createTreeCollection } from '@chakra-ui/react';
|
|
13
|
-
import React3, { createContext
|
|
13
|
+
import React3, { createContext, useState, useEffect, useMemo, useContext, useRef, Children, useCallback } from 'react';
|
|
14
14
|
import dayjs from 'dayjs';
|
|
15
15
|
import { Link as Link$1 } from 'react-router-dom';
|
|
16
16
|
import { useReactTable, getSortedRowModel, getCoreRowModel, flexRender } from '@tanstack/react-table';
|
|
@@ -393,6 +393,23 @@ ChipPicker.displayName = "ChipPicker";
|
|
|
393
393
|
var COLLAPSED_WIDTH = "44px";
|
|
394
394
|
var EXPANDED_WIDTH = "360px";
|
|
395
395
|
var COLLAPSE_BREAKPOINT = 1440;
|
|
396
|
+
var RailRootContext = createContext(false);
|
|
397
|
+
function isDevMode() {
|
|
398
|
+
const proc = globalThis.process;
|
|
399
|
+
return proc?.env?.NODE_ENV !== "production";
|
|
400
|
+
}
|
|
401
|
+
function useWarnIfOutsideRailRoot(componentName) {
|
|
402
|
+
const insideRoot = useContext(RailRootContext);
|
|
403
|
+
const warnedRef = useRef(false);
|
|
404
|
+
useEffect(() => {
|
|
405
|
+
if (!insideRoot && !warnedRef.current && isDevMode()) {
|
|
406
|
+
warnedRef.current = true;
|
|
407
|
+
console.warn(
|
|
408
|
+
`${componentName} was rendered outside <ContextRail>. Wrap rail content in <ContextRail> to get column width, collapse toggle, inner padding, and persistence. See docs/page-patterns.md.`
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
}, [insideRoot, componentName]);
|
|
412
|
+
}
|
|
396
413
|
function getInitialCollapsed(storageKey) {
|
|
397
414
|
if (typeof window === "undefined") return false;
|
|
398
415
|
if (storageKey) {
|
|
@@ -411,16 +428,13 @@ var ContextRailRoot = ({ storageKey, children }) => {
|
|
|
411
428
|
window.localStorage.setItem(storageKey, String(collapsed));
|
|
412
429
|
}
|
|
413
430
|
}, [collapsed, storageKey]);
|
|
414
|
-
return /* @__PURE__ */ jsx(
|
|
431
|
+
return /* @__PURE__ */ jsx(RailRootContext.Provider, { value: true, children: /* @__PURE__ */ jsx(
|
|
415
432
|
Box,
|
|
416
433
|
{
|
|
417
434
|
"data-testid": "context-rail",
|
|
418
435
|
"data-collapsed": collapsed ? "true" : "false",
|
|
419
436
|
w: collapsed ? COLLAPSED_WIDTH : EXPANDED_WIDTH,
|
|
420
437
|
minH: "100vh",
|
|
421
|
-
bg: "bg-surface",
|
|
422
|
-
borderLeftWidth: "1px",
|
|
423
|
-
borderLeftColor: "border",
|
|
424
438
|
transition: "width 250ms ease-out",
|
|
425
439
|
overflow: "hidden",
|
|
426
440
|
position: "relative",
|
|
@@ -449,38 +463,37 @@ var ContextRailRoot = ({ storageKey, children }) => {
|
|
|
449
463
|
/* @__PURE__ */ jsx(Box, { flex: "1", overflowY: "auto", px: "4", pb: "4", children })
|
|
450
464
|
] })
|
|
451
465
|
}
|
|
452
|
-
);
|
|
466
|
+
) });
|
|
453
467
|
};
|
|
454
468
|
ContextRailRoot.displayName = "ContextRail";
|
|
455
|
-
var ContextRailHeader = ({
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
] });
|
|
469
|
+
var ContextRailHeader = ({ eyebrow, title }) => {
|
|
470
|
+
useWarnIfOutsideRailRoot("ContextRail.Header");
|
|
471
|
+
return /* @__PURE__ */ jsxs(Box, { mb: "4", pb: "3", borderBottomWidth: "1px", borderBottomColor: "border", children: [
|
|
472
|
+
eyebrow && /* @__PURE__ */ jsx(
|
|
473
|
+
Text,
|
|
474
|
+
{
|
|
475
|
+
fontSize: "2xs",
|
|
476
|
+
fontWeight: "semibold",
|
|
477
|
+
letterSpacing: "wider",
|
|
478
|
+
textTransform: "uppercase",
|
|
479
|
+
color: "muted",
|
|
480
|
+
mb: "1",
|
|
481
|
+
children: eyebrow
|
|
482
|
+
}
|
|
483
|
+
),
|
|
484
|
+
/* @__PURE__ */ jsx(
|
|
485
|
+
Heading,
|
|
486
|
+
{
|
|
487
|
+
as: "h2",
|
|
488
|
+
fontSize: "lg",
|
|
489
|
+
fontWeight: "semibold",
|
|
490
|
+
color: "default",
|
|
491
|
+
letterSpacing: "-0.01em",
|
|
492
|
+
children: title
|
|
493
|
+
}
|
|
494
|
+
)
|
|
495
|
+
] });
|
|
496
|
+
};
|
|
484
497
|
ContextRailHeader.displayName = "ContextRail.Header";
|
|
485
498
|
var ContextRailSection = ({
|
|
486
499
|
id,
|
|
@@ -490,6 +503,7 @@ var ContextRailSection = ({
|
|
|
490
503
|
action,
|
|
491
504
|
children
|
|
492
505
|
}) => {
|
|
506
|
+
useWarnIfOutsideRailRoot("ContextRail.Section");
|
|
493
507
|
const [open, setOpen] = useState(defaultOpen);
|
|
494
508
|
return /* @__PURE__ */ jsxs(
|
|
495
509
|
Box,
|
|
@@ -1968,7 +1982,7 @@ var SidebarSection2 = ({
|
|
|
1968
1982
|
] });
|
|
1969
1983
|
};
|
|
1970
1984
|
SidebarSection2.displayName = "SidebarSection";
|
|
1971
|
-
var [StepperProvider, useStepperContext] = createContext({
|
|
1985
|
+
var [StepperProvider, useStepperContext] = createContext$1({
|
|
1972
1986
|
name: "StepperContext",
|
|
1973
1987
|
errorMessage: "useStepperContext: `context` is undefined. Seems you forgot to wrap stepper components in `<Stepper />`"
|
|
1974
1988
|
});
|
|
@@ -2074,7 +2088,7 @@ function getChildrenOfType(children, type) {
|
|
|
2074
2088
|
}
|
|
2075
2089
|
var dataAttr = (condition) => condition ? "" : void 0;
|
|
2076
2090
|
var cx = (...classes) => classes.filter(Boolean).join(" ");
|
|
2077
|
-
var StylesContext = createContext
|
|
2091
|
+
var StylesContext = createContext({});
|
|
2078
2092
|
var useStyles = () => useContext(StylesContext);
|
|
2079
2093
|
var Stepper = ({
|
|
2080
2094
|
ref,
|