@lerianstudio/sindarian-ui 2.0.0-beta.7 → 2.0.0-beta.9
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/components/breadcrumb/index.d.ts.map +1 -1
- package/dist/components/breadcrumb/index.js +25 -1
- package/dist/components/card/account-card/index.js +5 -5
- package/dist/components/card/basic-card/index.d.ts.map +1 -1
- package/dist/components/card/basic-card/index.js +2 -2
- package/dist/components/card/entity-card/index.js +1 -1
- package/dist/components/entity-box/index.d.ts +18 -2
- package/dist/components/entity-box/index.d.ts.map +1 -1
- package/dist/components/entity-box/index.js +32 -4
- package/dist/components/form/password-field/index.d.ts +5 -1
- package/dist/components/form/password-field/index.d.ts.map +1 -1
- package/dist/components/form/password-field/index.js +2 -2
- package/dist/components/page-header/index.js +1 -1
- package/dist/components/table/id-table-cell.d.ts +5 -1
- package/dist/components/table/id-table-cell.d.ts.map +1 -1
- package/dist/components/table/id-table-cell.js +48 -6
- package/dist/components/ui/autocomplete/index.d.ts +24 -0
- package/dist/components/ui/autocomplete/index.d.ts.map +1 -1
- package/dist/components/ui/autocomplete/index.js +24 -0
- package/dist/components/ui/copy-field/index.d.ts.map +1 -1
- package/dist/components/ui/copy-field/index.js +1 -1
- package/dist/components/ui/sheet/index.d.ts.map +1 -1
- package/dist/components/ui/sheet/index.js +2 -2
- package/dist/components/ui/sidebar/index.d.ts +1 -0
- package/dist/components/ui/sidebar/index.d.ts.map +1 -1
- package/dist/components/ui/sidebar/index.js +1 -0
- package/dist/components/ui/sidebar/sidebar-expand-button.d.ts +1 -1
- package/dist/components/ui/sidebar/sidebar-expand-button.d.ts.map +1 -1
- package/dist/components/ui/sidebar/sidebar-expand-button.js +15 -1
- package/dist/components/ui/sidebar/sidebar-item.d.ts +1 -1
- package/dist/components/ui/sidebar/sidebar-item.d.ts.map +1 -1
- package/dist/components/ui/sidebar/sidebar-item.js +28 -4
- package/dist/components/ui/sidebar/sidebar-provider.d.ts +37 -0
- package/dist/components/ui/sidebar/sidebar-provider.d.ts.map +1 -1
- package/dist/components/ui/sidebar/sidebar-provider.js +125 -4
- package/dist/components/ui/sidebar/sidebar-root.d.ts +38 -1
- package/dist/components/ui/sidebar/sidebar-root.d.ts.map +1 -1
- package/dist/components/ui/sidebar/sidebar-root.js +100 -5
- package/dist/components/ui/sidebar/sidebar-trigger.d.ts +18 -0
- package/dist/components/ui/sidebar/sidebar-trigger.d.ts.map +1 -0
- package/dist/components/ui/sidebar/sidebar-trigger.js +30 -0
- package/dist/esm/components/breadcrumb/index.d.ts.map +1 -1
- package/dist/esm/components/breadcrumb/index.js +25 -1
- package/dist/esm/components/card/account-card/index.js +5 -5
- package/dist/esm/components/card/basic-card/index.d.ts.map +1 -1
- package/dist/esm/components/card/basic-card/index.js +2 -2
- package/dist/esm/components/card/entity-card/index.js +1 -1
- package/dist/esm/components/entity-box/index.d.ts +18 -2
- package/dist/esm/components/entity-box/index.d.ts.map +1 -1
- package/dist/esm/components/entity-box/index.js +29 -4
- package/dist/esm/components/form/password-field/index.d.ts +5 -1
- package/dist/esm/components/form/password-field/index.d.ts.map +1 -1
- package/dist/esm/components/form/password-field/index.js +2 -2
- package/dist/esm/components/page-header/index.js +1 -1
- package/dist/esm/components/table/id-table-cell.d.ts +5 -1
- package/dist/esm/components/table/id-table-cell.d.ts.map +1 -1
- package/dist/esm/components/table/id-table-cell.js +48 -3
- package/dist/esm/components/ui/autocomplete/index.d.ts +24 -0
- package/dist/esm/components/ui/autocomplete/index.d.ts.map +1 -1
- package/dist/esm/components/ui/autocomplete/index.js +24 -0
- package/dist/esm/components/ui/copy-field/index.d.ts.map +1 -1
- package/dist/esm/components/ui/copy-field/index.js +1 -1
- package/dist/esm/components/ui/sheet/index.d.ts.map +1 -1
- package/dist/esm/components/ui/sheet/index.js +2 -2
- package/dist/esm/components/ui/sidebar/index.d.ts +1 -0
- package/dist/esm/components/ui/sidebar/index.d.ts.map +1 -1
- package/dist/esm/components/ui/sidebar/index.js +1 -0
- package/dist/esm/components/ui/sidebar/sidebar-expand-button.d.ts +1 -1
- package/dist/esm/components/ui/sidebar/sidebar-expand-button.d.ts.map +1 -1
- package/dist/esm/components/ui/sidebar/sidebar-expand-button.js +15 -1
- package/dist/esm/components/ui/sidebar/sidebar-item.d.ts +1 -1
- package/dist/esm/components/ui/sidebar/sidebar-item.d.ts.map +1 -1
- package/dist/esm/components/ui/sidebar/sidebar-item.js +28 -4
- package/dist/esm/components/ui/sidebar/sidebar-provider.d.ts +37 -0
- package/dist/esm/components/ui/sidebar/sidebar-provider.d.ts.map +1 -1
- package/dist/esm/components/ui/sidebar/sidebar-provider.js +122 -1
- package/dist/esm/components/ui/sidebar/sidebar-root.d.ts +38 -1
- package/dist/esm/components/ui/sidebar/sidebar-root.d.ts.map +1 -1
- package/dist/esm/components/ui/sidebar/sidebar-root.js +102 -7
- package/dist/esm/components/ui/sidebar/sidebar-trigger.d.ts +18 -0
- package/dist/esm/components/ui/sidebar/sidebar-trigger.d.ts.map +1 -0
- package/dist/esm/components/ui/sidebar/sidebar-trigger.js +26 -0
- package/dist/globals.css +49 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/entity-box/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAczB,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,6BAA6B,CAAA;AAIpC,iBAAS,SAAS,CAAC,EACjB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAa7B;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/entity-box/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAczB,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,uBAAuB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KAAK,CAAC,qBAU7B;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAa7B;AAED,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,2BAA2B,EAC3B,2BAA2B,EAC3B,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EACjB,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
2
3
|
import { cn } from '../../lib/utils.js';
|
|
3
4
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/tooltip/index.js';
|
|
4
5
|
import { CircleHelp, Settings2 } from 'lucide-react';
|
|
@@ -8,11 +9,35 @@ import { Separator } from '../ui/separator/index.js';
|
|
|
8
9
|
function EntityBox({ className, children, ...props }) {
|
|
9
10
|
return (_jsx("div", { "data-slot": "entity-box", className: cn('shadow-entity-box bg-card mb-2 flex items-center justify-between rounded-lg p-6', className), ...props, children: children }));
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* The open state, republished for the trigger.
|
|
14
|
+
*
|
|
15
|
+
* Radix keeps it in a context it does not export, and the trigger one element
|
|
16
|
+
* down needs it to say what activating it will DO. Mirroring it here rather
|
|
17
|
+
* than forcing every consumer to lift the state: all ten console call sites
|
|
18
|
+
* render `<EntityBoxCollapsible>` uncontrolled.
|
|
19
|
+
*/
|
|
20
|
+
const EntityBoxCollapsibleContext = React.createContext(false);
|
|
21
|
+
function EntityBoxCollapsible({ className, open, defaultOpen, onOpenChange, ...props }) {
|
|
22
|
+
const [uncontrolled, setUncontrolled] = React.useState(defaultOpen ?? false);
|
|
23
|
+
return (_jsx(EntityBoxCollapsibleContext.Provider, { value: open ?? uncontrolled, children: _jsx(Collapsible, { className: cn('shadow-entity-box bg-card mb-2 flex flex-col rounded-lg', className), open: open, defaultOpen: defaultOpen, onOpenChange: (next) => {
|
|
24
|
+
setUncontrolled(next);
|
|
25
|
+
onOpenChange?.(next);
|
|
26
|
+
}, ...props }) }));
|
|
13
27
|
}
|
|
14
|
-
|
|
15
|
-
|
|
28
|
+
/**
|
|
29
|
+
* ⛔ THIS TRIGGER HAS NO TEXT NODE. It is a `Settings2` glyph inside a Button,
|
|
30
|
+
* so without an `aria-label` a screen reader announced "button" and nothing
|
|
31
|
+
* else (SC 4.1.2) — and this is the control that opens the filter panel on
|
|
32
|
+
* every console list page.
|
|
33
|
+
*
|
|
34
|
+
* The name describes the ACTION and Radix's `aria-expanded` carries the state,
|
|
35
|
+
* so the two halves do not repeat each other. English defaults because no
|
|
36
|
+
* consumer passes a label today; a translated console overrides both.
|
|
37
|
+
*/
|
|
38
|
+
function EntityBoxCollapsibleTrigger({ expandLabel = 'Expand', collapseLabel = 'Collapse', 'aria-label': ariaLabel, ...props }) {
|
|
39
|
+
const open = React.useContext(EntityBoxCollapsibleContext);
|
|
40
|
+
return (_jsx(CollapsibleTrigger, { ...props, asChild: true, children: _jsx(Button, { variant: "secondary", className: "h-[34px] w-[34px] p-2", "aria-label": ariaLabel ?? (open ? collapseLabel : expandLabel), children: _jsx(Settings2, { size: 16, "aria-hidden": true }) }) }));
|
|
16
41
|
}
|
|
17
42
|
function EntityBoxCollapsibleContent({ children, ...props }) {
|
|
18
43
|
return (_jsxs(CollapsibleContent, { ...props, children: [_jsx(Separator, { orientation: "horizontal" }), _jsx("div", { className: "grid w-full grid-cols-3 p-6", children: children })] }));
|
|
@@ -9,6 +9,10 @@ export type PasswordFieldProps<TFieldValues extends FieldValues = FieldValues, T
|
|
|
9
9
|
required?: boolean;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
'data-testid'?: string;
|
|
12
|
+
/** Accessible name of the eye button while the password is hidden. */
|
|
13
|
+
showPasswordLabel?: string;
|
|
14
|
+
/** Accessible name of the eye button while the password is showing. */
|
|
15
|
+
hidePasswordLabel?: string;
|
|
12
16
|
};
|
|
13
|
-
export declare function PasswordField<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, label, tooltip, placeholder, control, required, disabled, 'data-testid': dataTestId }: PasswordFieldProps<TFieldValues, TName>): React.JSX.Element;
|
|
17
|
+
export declare function PasswordField<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, label, tooltip, placeholder, control, required, disabled, 'data-testid': dataTestId, showPasswordLabel, hidePasswordLabel }: PasswordFieldProps<TFieldValues, TName>): React.JSX.Element;
|
|
14
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/password-field/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAajE,MAAM,MAAM,kBAAkB,CAC5B,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,KAAK,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,IAC7D;IACF,IAAI,EAAE,KAAK,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/password-field/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAajE,MAAM,MAAM,kBAAkB,CAC5B,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,KAAK,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,IAC7D;IACF,IAAI,EAAE,KAAK,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,sEAAsE;IACtE,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,uEAAuE;IACvE,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,wBAAgB,aAAa,CAC3B,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,KAAK,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,EAC/D,EACA,IAAI,EACJ,KAAK,EACL,OAAO,EACP,WAAW,EACX,OAAO,EACP,QAAgB,EAChB,QAAgB,EAChB,aAAa,EAAE,UAAU,EACzB,iBAAmC,EACnC,iBAAmC,EACpC,EAAE,kBAAkB,CAAC,YAAY,EAAE,KAAK,CAAC,qBAuDzC"}
|
|
@@ -4,7 +4,7 @@ import { FormControl, FormField, FormItem, FormLabel, FormMessage, FormTooltip }
|
|
|
4
4
|
import { Input, InputAdornment } from '../../../components/ui/input/index.js';
|
|
5
5
|
import { Eye, EyeOff } from 'lucide-react';
|
|
6
6
|
import { IconButton } from '../../../components/ui/icon-button/index.js';
|
|
7
|
-
export function PasswordField({ name, label, tooltip, placeholder, control, required = false, disabled = false, 'data-testid': dataTestId }) {
|
|
7
|
+
export function PasswordField({ name, label, tooltip, placeholder, control, required = false, disabled = false, 'data-testid': dataTestId, showPasswordLabel = 'Show password', hidePasswordLabel = 'Hide password' }) {
|
|
8
8
|
const [show, setShow] = React.useState(false);
|
|
9
|
-
return (_jsx(FormField, { control: control, name: name, render: ({ field }) => (_jsxs(FormItem, { required: required, children: [_jsx(FormLabel, { extra: tooltip ? _jsx(FormTooltip, { children: tooltip }) : undefined, children: label }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: show ? 'text' : 'password', placeholder: placeholder, endAdornment: _jsx(InputAdornment, { position: "end", children: _jsx(IconButton, { type: "button", variant: "outline", rounded: true, onClick: () => setShow(!show), children: show ? _jsx(EyeOff, {}) : _jsx(Eye, {}) }) }), disabled: disabled, className: "pr-10", "data-testid": dataTestId }) }), _jsx(FormMessage, {})] })) }));
|
|
9
|
+
return (_jsx(FormField, { control: control, name: name, render: ({ field }) => (_jsxs(FormItem, { required: required, children: [_jsx(FormLabel, { extra: tooltip ? _jsx(FormTooltip, { children: tooltip }) : undefined, children: label }), _jsx(FormControl, { children: _jsx(Input, { ...field, type: show ? 'text' : 'password', placeholder: placeholder, endAdornment: _jsx(InputAdornment, { position: "end", children: _jsx(IconButton, { type: "button", variant: "outline", rounded: true, "aria-label": show ? hidePasswordLabel : showPasswordLabel, onClick: () => setShow(!show), children: show ? _jsx(EyeOff, { "aria-hidden": true }) : _jsx(Eye, { "aria-hidden": true }) }) }), disabled: disabled, className: "pr-10", "data-testid": dataTestId }) }), _jsx(FormMessage, {})] })) }));
|
|
10
10
|
}
|
|
@@ -67,5 +67,5 @@ export function PageHeaderCollapsibleInfoTrigger({ question }) {
|
|
|
67
67
|
return (_jsx("div", { "data-slot": "page-header-collapsible-info-trigger", children: _jsx(CollapsibleTrigger, { asChild: true, children: _jsxs(Button, { variant: "link", className: "flex gap-2 pr-0", children: [_jsx("span", { className: "text-foreground text-sm font-medium", children: question }), _jsx(HelpCircle, { className: "h-4 w-4" })] }) }) }));
|
|
68
68
|
}
|
|
69
69
|
export function PageHeaderCollapsibleInfo({ question, answer, seeMore, href }) {
|
|
70
|
-
return (_jsx("div", { "data-slot": "page-header-collapsible-info", children: _jsx(CollapsibleContent, { children: _jsxs("div", { className: "flex w-full justify-between pt-6", children: [_jsxs("div", { className: "mt-12 flex grow flex-col gap-3 pr-6", children: [_jsx("h2", { className: "text-foreground text-xl font-bold", children: question }), _jsxs("p", { className: "text-
|
|
70
|
+
return (_jsx("div", { "data-slot": "page-header-collapsible-info", children: _jsx(CollapsibleContent, { children: _jsxs("div", { className: "flex w-full justify-between pt-6", children: [_jsxs("div", { className: "mt-12 flex grow flex-col gap-3 pr-6", children: [_jsx("h2", { className: "text-foreground text-xl font-bold", children: question }), _jsxs("p", { className: "text-muted-foreground text-sm leading-relaxed font-medium", children: [answer, seeMore && href && (_jsxs(_Fragment, { children: [' ', _jsxs("a", { target: "_blank", rel: "noopener noreferrer", href: href, className: "text-muted-foreground font-medium", children: [_jsx("span", { className: "underline underline-offset-4", children: seeMore }), _jsx(ExternalLink, { size: 16, className: "ml-1 inline align-middle" })] })] }))] })] }), _jsx(CollapsibleTrigger, { asChild: true, children: _jsx(Button, { variant: "link", className: "cursor-pointer self-start", children: _jsx(ChevronUp, { size: 24, className: "text-muted-foreground" }) }) })] }) }) }));
|
|
71
71
|
}
|
|
@@ -2,6 +2,10 @@ import { TableCell } from '../../components/ui/table/index.js';
|
|
|
2
2
|
export type IdTableCellProps = Omit<React.ComponentProps<typeof TableCell>, 'onCopy'> & {
|
|
3
3
|
id?: string;
|
|
4
4
|
onCopy?: (id: string) => void;
|
|
5
|
+
/** Characters kept from the start of the id. */
|
|
6
|
+
head?: number;
|
|
7
|
+
/** Characters kept from the end of the id. */
|
|
8
|
+
tail?: number;
|
|
5
9
|
};
|
|
6
|
-
export declare const IdTableCell: ({ id, onCopy, ...others }: IdTableCellProps) => import("react").JSX.Element;
|
|
10
|
+
export declare const IdTableCell: ({ id, onCopy, head, tail, ...others }: IdTableCellProps) => import("react").JSX.Element;
|
|
7
11
|
//# sourceMappingURL=id-table-cell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id-table-cell.d.ts","sourceRoot":"","sources":["../../../../src/components/table/id-table-cell.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGV,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"id-table-cell.d.ts","sourceRoot":"","sources":["../../../../src/components/table/id-table-cell.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGV,MAAM,uBAAuB,CAAA;AAS9B,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,KAAK,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,EACtC,QAAQ,CACT,GAAG;IACF,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,gDAAgD;IAChD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,8CAA8C;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AA6CD,eAAO,MAAM,WAAW,GAAI,uCAMzB,gBAAgB,gCAiClB,CAAA"}
|
|
@@ -1,12 +1,57 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { TableCell, TableCellAction, TableCellWrapper } from '../../components/ui/table/index.js';
|
|
3
3
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../../components/ui/tooltip/index.js';
|
|
4
|
-
import truncate from 'lodash/truncate.js';
|
|
5
4
|
import { Copy } from 'lucide-react';
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* ⛔ TRUNCATE IN THE MIDDLE, NEVER FROM THE START.
|
|
7
|
+
*
|
|
8
|
+
* This cell renders UUIDs, and a ledger hands out long runs of them from a
|
|
9
|
+
* shared prefix — `00000000-0000-0000-0000-00000000000{1,2,3}`. Keeping the
|
|
10
|
+
* first 13 characters, which is what `truncate(id, { length: 16 })` did,
|
|
11
|
+
* rendered every one of those rows as the same string: the only part that told
|
|
12
|
+
* them apart was the part that was dropped, and the reader had to hover each
|
|
13
|
+
* row in turn to find the one they wanted.
|
|
14
|
+
*
|
|
15
|
+
* Both ends carry information — the head says which family the id belongs to,
|
|
16
|
+
* the tail says which member — so both ends stay.
|
|
17
|
+
*/
|
|
18
|
+
const DEFAULT_HEAD = 8;
|
|
19
|
+
const DEFAULT_TAIL = 4;
|
|
20
|
+
/**
|
|
21
|
+
* ⛔ A BAD LENGTH CANNOT THROW HERE. This runs in a render path, so refusing a
|
|
22
|
+
* malformed prop would unmount the whole table rather than one cell — a
|
|
23
|
+
* consumer computing `head` from data gets a broken cell, not a broken screen.
|
|
24
|
+
*
|
|
25
|
+
* `String.slice` reads a negative number as an offset from the END, so a
|
|
26
|
+
* negative `head` kept nearly the entire id and put an ellipsis in the middle
|
|
27
|
+
* of it, and `NaN` read as 0 and dropped the head — the exact failure middle
|
|
28
|
+
* truncation exists to prevent, and one character LONGER than the untruncated
|
|
29
|
+
* id. Clamped to a non-negative whole number; anything non-finite falls back
|
|
30
|
+
* to the default, which a caller passing `NaN` has already bypassed.
|
|
31
|
+
*/
|
|
32
|
+
function charCount(value, fallback) {
|
|
33
|
+
return Number.isFinite(value) ? Math.max(0, Math.trunc(value)) : fallback;
|
|
34
|
+
}
|
|
35
|
+
function truncateMiddle(id, head, tail) {
|
|
36
|
+
const start = charCount(head, DEFAULT_HEAD);
|
|
37
|
+
const end = charCount(tail, DEFAULT_TAIL);
|
|
38
|
+
// No ellipsis unless it actually saves characters: at head + tail + 1 the
|
|
39
|
+
// truncation is the same length as the id and hides a character for nothing.
|
|
40
|
+
return id.length <= start + end + 1
|
|
41
|
+
? id
|
|
42
|
+
: `${id.slice(0, start)}…${id.slice(id.length - end)}`;
|
|
43
|
+
}
|
|
44
|
+
export const IdTableCell = ({ id, onCopy, head = DEFAULT_HEAD, tail = DEFAULT_TAIL, ...others }) => {
|
|
7
45
|
const handleCopyToClipboard = () => {
|
|
46
|
+
// The WHOLE id, never what is rendered. The cell is the only place most
|
|
47
|
+
// consoles expose it, and a truncated id pasted into a query matches
|
|
48
|
+
// nothing.
|
|
8
49
|
navigator.clipboard.writeText(id);
|
|
9
50
|
onCopy?.(id);
|
|
10
51
|
};
|
|
11
|
-
return (_jsx(TableCell, { onClick: handleCopyToClipboard,
|
|
52
|
+
return (_jsx(TableCell, { onClick: handleCopyToClipboard,
|
|
53
|
+
// The tooltip is the styled affordance; `title` is the fallback that
|
|
54
|
+
// survives without it — a printed page, a portal that has not mounted,
|
|
55
|
+
// and the cell padding outside the trigger.
|
|
56
|
+
title: id, ...others, children: _jsxs(TableCellWrapper, { children: [_jsx(TooltipProvider, { children: _jsxs(Tooltip, { delayDuration: 300, children: [_jsx(TooltipTrigger, { children: id ? truncateMiddle(id, head, tail) : id }), _jsx(TooltipContent, { children: id })] }) }), _jsx(TableCellAction, { children: _jsx(Copy, { className: "size-3.5" }) })] }) }));
|
|
12
57
|
};
|
|
@@ -25,14 +25,29 @@ export type AutocompleteTriggerProps = React.ComponentProps<'div'> & {
|
|
|
25
25
|
clearLabel?: string;
|
|
26
26
|
};
|
|
27
27
|
export declare function AutocompleteTrigger({ ref, className, onClear, clearLabel, children }: AutocompleteTriggerProps): React.JSX.Element;
|
|
28
|
+
export declare namespace AutocompleteTrigger {
|
|
29
|
+
var displayName: string;
|
|
30
|
+
}
|
|
28
31
|
export declare function AutocompleteValue({ ref, className, value: valueProp, onValueChange, onBlur, ...props }: React.ComponentProps<typeof CommandPrimitive.Input>): React.JSX.Element;
|
|
32
|
+
export declare namespace AutocompleteValue {
|
|
33
|
+
var displayName: string;
|
|
34
|
+
}
|
|
29
35
|
export type AutocompleteMultipleValueProps = React.ComponentProps<typeof CommandPrimitive.Input> & {
|
|
30
36
|
/** Accessible label for each chip's remove button, prefixed to its value. */
|
|
31
37
|
clearLabel?: string;
|
|
32
38
|
};
|
|
33
39
|
export declare function AutocompleteMultipleValue({ ref, className, clearLabel, ...props }: AutocompleteMultipleValueProps): React.JSX.Element;
|
|
40
|
+
export declare namespace AutocompleteMultipleValue {
|
|
41
|
+
var displayName: string;
|
|
42
|
+
}
|
|
34
43
|
export declare function AutocompleteEmpty({ className, ...props }: React.ComponentProps<typeof CommandPrimitive.Empty>): React.JSX.Element | null;
|
|
44
|
+
export declare namespace AutocompleteEmpty {
|
|
45
|
+
var displayName: string;
|
|
46
|
+
}
|
|
35
47
|
export declare function AutocompleteLoading({ className, ref, ...props }: React.ComponentProps<typeof CommandPrimitive.Loading>): React.JSX.Element;
|
|
48
|
+
export declare namespace AutocompleteLoading {
|
|
49
|
+
var displayName: string;
|
|
50
|
+
}
|
|
36
51
|
export declare const SIDE_OPTIONS: string[];
|
|
37
52
|
type Side = (typeof SIDE_OPTIONS)[number];
|
|
38
53
|
export type AutocompleteContentProps = React.ComponentProps<typeof CommandPrimitive.List> & {
|
|
@@ -41,7 +56,13 @@ export type AutocompleteContentProps = React.ComponentProps<typeof CommandPrimit
|
|
|
41
56
|
onPointerDownOutside?: (event: MouseEvent | TouchEvent) => void;
|
|
42
57
|
};
|
|
43
58
|
export declare function AutocompleteContent({ className, position, side, ref, children, onMouseEnter, onMouseLeave, onPointerDownOutside, ...props }: AutocompleteContentProps): React.JSX.Element;
|
|
59
|
+
export declare namespace AutocompleteContent {
|
|
60
|
+
var displayName: string;
|
|
61
|
+
}
|
|
44
62
|
export declare function AutocompleteGroup({ className, ...props }: React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>): React.JSX.Element;
|
|
63
|
+
export declare namespace AutocompleteGroup {
|
|
64
|
+
var displayName: string;
|
|
65
|
+
}
|
|
45
66
|
export type AutocompleteItemProps = React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item> & {
|
|
46
67
|
/** Text this option reads as wherever it is rendered outside the list (the
|
|
47
68
|
* input, a chip and its remove button). Required only when the children are
|
|
@@ -78,5 +99,8 @@ export type AutocompleteProps = Omit<React.ComponentProps<typeof CommandPrimitiv
|
|
|
78
99
|
multiple?: boolean;
|
|
79
100
|
};
|
|
80
101
|
export declare function Autocomplete({ ref, value, defaultValue, onValueChange, onClear, className, open: openProp, onOpenChange, showValue, readOnly, disabled, multiple, onKeyDown, children, ...props }: AutocompleteProps): React.JSX.Element;
|
|
102
|
+
export declare namespace Autocomplete {
|
|
103
|
+
var displayName: string;
|
|
104
|
+
}
|
|
81
105
|
export {};
|
|
82
106
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/autocomplete/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAmB,MAAM,MAAM,CAAA;AAInE,MAAM,MAAM,uBAAuB,GACjC,KAAK,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,GAAG;IAC3C,sCAAsC;IACtC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,EAAE,CAAA;IAC7B,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,YAAY,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,WAAW,EAAE,MAAM,IAAI,CAAA;IACvB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,cAAc,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI,CAAA;IAC9C,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IAChC,OAAO,EAAE,MAAM,CAAC,MAAM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KAAK,EAIL,KAAK,EAAE,MAAM,EACb,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,qBAAqB,qBAsBvB;yBA/Be,gBAAgB;;;AA4ChC;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,EAC7C,OAAO,GAAG,cAAc,GAAG,eAAe,CAC3C,GAAG;IACF,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACzB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAChC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,IAAI,CAAA;IACnD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IAEpB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IAEtC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,YAAY,CAAC,EAC3B,GAAG,EACH,KAAK,EACL,YAAY,EACZ,aAAa,EACb,OAAO,EACP,SAAS,EACT,IAAI,EAAE,QAAQ,EACd,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,iBAAiB,qBAmInB;yBAnJe,YAAY"}
|
|
@@ -366,3 +366,27 @@ export function Autocomplete({ ref, value, defaultValue, onValueChange, onClear,
|
|
|
366
366
|
onKeyDown?.(e);
|
|
367
367
|
}, children: children }) }));
|
|
368
368
|
}
|
|
369
|
+
/**
|
|
370
|
+
* ⛔ THE REST OF THE SET, FOR THE SAME REASON AS `AutocompleteItem` ABOVE.
|
|
371
|
+
*
|
|
372
|
+
* A function component's `name` is whatever the bundler left it — one letter in
|
|
373
|
+
* a production build — so any lookup written against `child.type` needs an
|
|
374
|
+
* explicit string to compare. `AutocompleteItem` is the only part the walk
|
|
375
|
+
* reads TODAY, and it is the part that shipped an empty option registry to
|
|
376
|
+
* every consumer while it was anonymous. Naming the whole set costs a line each
|
|
377
|
+
* and removes the next instance of that defect before it is written; it also
|
|
378
|
+
* makes these parts legible in a React tree, which `MultipleSelect` next door
|
|
379
|
+
* has always done.
|
|
380
|
+
*
|
|
381
|
+
* `__tests__`-style enumeration lives in `autocomplete.test.tsx`: it reads the
|
|
382
|
+
* module's exports rather than a list, so a new part added without a name fails
|
|
383
|
+
* without anyone remembering to extend anything.
|
|
384
|
+
*/
|
|
385
|
+
Autocomplete.displayName = 'Autocomplete';
|
|
386
|
+
AutocompleteTrigger.displayName = 'AutocompleteTrigger';
|
|
387
|
+
AutocompleteValue.displayName = 'AutocompleteValue';
|
|
388
|
+
AutocompleteMultipleValue.displayName = 'AutocompleteMultipleValue';
|
|
389
|
+
AutocompleteContent.displayName = 'AutocompleteContent';
|
|
390
|
+
AutocompleteGroup.displayName = 'AutocompleteGroup';
|
|
391
|
+
AutocompleteEmpty.displayName = 'AutocompleteEmpty';
|
|
392
|
+
AutocompleteLoading.displayName = 'AutocompleteLoading';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/copy-field/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,MAAM,MAAM,cAAc,GAAG;IAC3B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;;;;;;;OAUG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B,CAAA;AAmCD,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,KAAK,EACL,MAAc,EACd,WAAW,EACX,WAA0B,EAC1B,SAAwB,EACxB,UAA4B,EAC5B,mBAAmB,EACpB,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/copy-field/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,MAAM,MAAM,cAAc,GAAG;IAC3B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;;;;;;;OAUG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAC7B,CAAA;AAmCD,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,KAAK,EACL,MAAc,EACd,WAAW,EACX,WAA0B,EAC1B,SAAwB,EACxB,UAA4B,EAC5B,mBAAmB,EACpB,EAAE,cAAc,qBAkKhB"}
|
|
@@ -115,5 +115,5 @@ export function CopyField({ value, label, masked = false, onCopyLabel, revealLab
|
|
|
115
115
|
// long value (e.g. a UUID recovery code) scrolls inside the field
|
|
116
116
|
// instead of overflowing its container. No `font-mono`: the value
|
|
117
117
|
// inherits the app sans font (Inter) so it matches every other field.
|
|
118
|
-
className: "text-input-foreground h-full min-w-0 flex-1 cursor-text border-none bg-transparent text-sm outline-none select-text focus:ring-0 focus:ring-offset-0" }), masked ? (_jsx(IconButton, { type: "button", variant: "outline", size: "small", rounded: true, "aria-
|
|
118
|
+
className: "text-input-foreground h-full min-w-0 flex-1 cursor-text border-none bg-transparent text-sm outline-none select-text focus:ring-0 focus:ring-offset-0" }), masked ? (_jsx(IconButton, { type: "button", variant: "outline", size: "small", rounded: true, "aria-label": revealed ? hideLabel : revealLabel, onClick: () => setRevealed((prev) => !prev), children: revealed ? _jsx(EyeOff, {}) : _jsx(Eye, {}) })) : null, _jsx(IconButton, { type: "button", variant: "outline", size: "small", rounded: true, "aria-label": copyAccessibleName, onClick: handleCopy, children: copied ? _jsx(Check, {}) : _jsx(Copy, {}) })] })] }));
|
|
119
119
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/sheet/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,cAAc,MAAM,wBAAwB,CAAA;AACxD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAIjE,iBAAS,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,qBAE5E;AAED,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,qBAErD;AAED,iBAAS,UAAU,CAAC,EAClB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,qBAEnD;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAA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C,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,qBAWrD;AAED,QAAA,MAAM,aAAa;;8EAiBlB,CAAA;AAED,KAAK,iBAAiB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,OAAO,CAAC,GAC1E,YAAY,CAAC,OAAO,aAAa,CAAC,CAAA;AAEpC,iBAAS,YAAY,CAAC,EACpB,IAAc,EACd,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,iBAAiB,qBA6CnB;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAWxE;AAED,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAWxE;AAED,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,KAAK,CAAC,qBAWnD;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,WAAW,CAAC,qBAQzD;AAED,OAAO,EACL,KAAK,EACL,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,gBAAgB,EACjB,CAAA"}
|
|
@@ -42,7 +42,7 @@ function SheetContent({ side = 'right', className, children, onInteractOutside,
|
|
|
42
42
|
}
|
|
43
43
|
onInteractOutside?.(event);
|
|
44
44
|
}, [onInteractOutside]);
|
|
45
|
-
return (_jsxs(SheetPortal, { children: [_jsx(SheetOverlay, {}), _jsxs(SheetPrimitive.Content, { "data-slot": "sheet-content", className: cn('flex max-h-screen flex-col overflow-x-auto px-8 pb-0', sheetVariants({ side }), className), onInteractOutside: handleInteractOutside, ...props, children: [children, _jsxs(SheetPrimitive.Close, { className: "data-[state=open]:bg-secondary absolute top-7 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-hidden disabled:pointer-events-none", children: [_jsx(X, { className: "h-6 w-6" }), _jsx("span", { className: "sr-only", children: "Close" })] })] })] }));
|
|
45
|
+
return (_jsxs(SheetPortal, { children: [_jsx(SheetOverlay, {}), _jsxs(SheetPrimitive.Content, { "data-slot": "sheet-content", className: cn('flex max-h-screen flex-col overflow-x-auto px-8 pb-0', sheetVariants({ side }), className), onInteractOutside: handleInteractOutside, ...props, children: [children, _jsxs(SheetPrimitive.Close, { className: "data-[state=open]:bg-secondary ring-offset-background focus-visible:ring-ring absolute top-7 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none", children: [_jsx(X, { className: "h-6 w-6" }), _jsx("span", { className: "sr-only", children: "Close" })] })] })] }));
|
|
46
46
|
}
|
|
47
47
|
function SheetHeader({ className, ...props }) {
|
|
48
48
|
return (_jsx("div", { "data-slot": "sheet-header", className: cn('mb-4 flex flex-col space-y-2 text-center sm:text-left', className), ...props }));
|
|
@@ -54,6 +54,6 @@ function SheetTitle({ className, ...props }) {
|
|
|
54
54
|
return (_jsx(SheetPrimitive.Title, { "data-slot": "sheet-title", className: cn('text-muted-foreground mb-2 flex text-xl font-bold', className), ...props }));
|
|
55
55
|
}
|
|
56
56
|
function SheetDescription({ className, ...props }) {
|
|
57
|
-
return (_jsx(SheetPrimitive.Description, { "data-slot": "sheet-description", className: cn('text-
|
|
57
|
+
return (_jsx(SheetPrimitive.Description, { "data-slot": "sheet-description", className: cn('text-muted-foreground text-sm font-medium', className), ...props }));
|
|
58
58
|
}
|
|
59
59
|
export { Sheet, SheetPortal, SheetOverlay, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription };
|
|
@@ -4,6 +4,7 @@ export * from './sidebar-item-icon-button.js';
|
|
|
4
4
|
export * from './sidebar-item-button.js';
|
|
5
5
|
export * from './sidebar-item.js';
|
|
6
6
|
export * from './sidebar-expand-button.js';
|
|
7
|
+
export * from './sidebar-trigger.js';
|
|
7
8
|
export * from './sidebar-back-button.js';
|
|
8
9
|
export * from './sidebar-provider.js';
|
|
9
10
|
export * from './sidebar-item-collapsible.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/sidebar/index.tsx"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/sidebar/index.tsx"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uBAAuB,CAAA;AACrC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,kBAAkB,CAAA"}
|
|
@@ -4,6 +4,7 @@ export * from './sidebar-item-icon-button.js';
|
|
|
4
4
|
export * from './sidebar-item-button.js';
|
|
5
5
|
export * from './sidebar-item.js';
|
|
6
6
|
export * from './sidebar-expand-button.js';
|
|
7
|
+
export * from './sidebar-trigger.js';
|
|
7
8
|
export * from './sidebar-back-button.js';
|
|
8
9
|
export * from './sidebar-provider.js';
|
|
9
10
|
export * from './sidebar-item-collapsible.js';
|
|
@@ -7,6 +7,6 @@ type SidebarExpandButtonProps = {
|
|
|
7
7
|
*/
|
|
8
8
|
tooltip?: string;
|
|
9
9
|
};
|
|
10
|
-
export declare const SidebarExpandButton: ({ tooltip }: SidebarExpandButtonProps) => React.JSX.Element;
|
|
10
|
+
export declare const SidebarExpandButton: ({ tooltip }: SidebarExpandButtonProps) => React.JSX.Element | null;
|
|
11
11
|
export {};
|
|
12
12
|
//# sourceMappingURL=sidebar-expand-button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-expand-button.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/sidebar/sidebar-expand-button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAYzB,KAAK,wBAAwB,GAAG;IAC9B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,aAAa,wBAAwB,
|
|
1
|
+
{"version":3,"file":"sidebar-expand-button.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/sidebar/sidebar-expand-button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAYzB,KAAK,wBAAwB,GAAG;IAC9B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,aAAa,wBAAwB,6BAwExE,CAAA"}
|
|
@@ -7,7 +7,21 @@ import { SidebarFooter } from './sidebar-components.js';
|
|
|
7
7
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../../ui/tooltip/index.js';
|
|
8
8
|
import { IconButton } from '../icon-button/index.js';
|
|
9
9
|
export const SidebarExpandButton = ({ tooltip }) => {
|
|
10
|
-
const { isCollapsed, toggleSidebar } = useSidebar();
|
|
10
|
+
const { isCollapsed, isDrawer, toggleSidebar } = useSidebar();
|
|
11
|
+
/**
|
|
12
|
+
* Nothing to collapse in a drawer. The expanded branch below hangs its button
|
|
13
|
+
* at `right-[-20px]`, twenty pixels outside the rail — off the canvas of an
|
|
14
|
+
* overlay that has no page beside it — and collapsing to a 72px strip inside
|
|
15
|
+
* a 244px sheet is not a state worth reaching. The drawer's own close control
|
|
16
|
+
* and the backdrop are how it is dismissed.
|
|
17
|
+
*
|
|
18
|
+
* ⚠️ `isDrawer`, NOT `isMobile`. A consumer left on the default
|
|
19
|
+
* `mobile="inline"` still has a real rail below 768px, and its collapse
|
|
20
|
+
* control has to come with it.
|
|
21
|
+
*/
|
|
22
|
+
if (isDrawer) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
11
25
|
return (_jsxs(React.Fragment, { children: [!isCollapsed && (_jsx("div", { "data-slot": "sidebar-expand-button", className: "border-border bg-card flex w-full", children: _jsx("div", { className: "absolute right-[-20px] bottom-4", children: _jsx(IconButton, { variant: "secondary", rounded: true, onClick: toggleSidebar, "aria-label": tooltip || 'Collapse sidebar', "aria-expanded": true, children: _jsx(PanelLeftClose, { className: "text-muted-foreground" }) }) }) })), isCollapsed && (_jsx(SidebarFooter, { children: _jsx(TooltipProvider, { children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger
|
|
12
26
|
// `hover:text-accent-foreground` on the TRIGGER, not only on
|
|
13
27
|
// the glyph below. The base ink here used to be base/400, which
|
|
@@ -9,5 +9,5 @@ export type SidebarItemProps = React.ComponentProps<typeof SidebarItemButton> &
|
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
children?: React.ReactNode;
|
|
11
11
|
};
|
|
12
|
-
export declare const SidebarItem: ({ active, href, children: _children, ...props }: SidebarItemProps) => React.JSX.Element;
|
|
12
|
+
export declare const SidebarItem: ({ active, href, children: _children, onClick, ...props }: SidebarItemProps) => React.JSX.Element;
|
|
13
13
|
//# sourceMappingURL=sidebar-item.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-item.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/sidebar/sidebar-item.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAIlE,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,GAC3E,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,GAAG;IACnD,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA;AAEH,eAAO,MAAM,WAAW,GAAI,
|
|
1
|
+
{"version":3,"file":"sidebar-item.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/sidebar/sidebar-item.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAIlE,MAAM,MAAM,gBAAgB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,GAC3E,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,GAAG;IACnD,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,CAAA;AAEH,eAAO,MAAM,WAAW,GAAI,0DAMzB,gBAAgB,sBAsDlB,CAAA"}
|
|
@@ -4,13 +4,37 @@ import { SidebarItemButton } from './sidebar-item-button.js';
|
|
|
4
4
|
import { SidebarItemIconButton } from './sidebar-item-icon-button.js';
|
|
5
5
|
import { useSidebar } from './sidebar-provider.js';
|
|
6
6
|
import { useSidebarRouter } from './sidebar-router.js';
|
|
7
|
-
export const SidebarItem = ({ active, href, children: _children, ...props }) => {
|
|
7
|
+
export const SidebarItem = ({ active, href, children: _children, onClick, ...props }) => {
|
|
8
8
|
const { usePathname } = useSidebarRouter();
|
|
9
9
|
const pathname = usePathname();
|
|
10
|
-
const { isCollapsed } = useSidebar();
|
|
10
|
+
const { isCollapsed, isDrawer, setOpenMobile } = useSidebar();
|
|
11
11
|
const isActive = (href) => pathname === href;
|
|
12
|
+
/**
|
|
13
|
+
* ⛔ ACTIVATING A DESTINATION CLOSES THE DRAWER. It is the whole point of the
|
|
14
|
+
* drawer and it was the one interaction that left it open: Escape, the
|
|
15
|
+
* backdrop and the X all dismissed it, a navigation link did not.
|
|
16
|
+
*
|
|
17
|
+
* The overlay is modal, so `document.body` carries `pointer-events: none`
|
|
18
|
+
* while it is up, and a consumer's `SidebarItem` is a client-side `Link`
|
|
19
|
+
* under a provider that survives the route change — so the reader landed on
|
|
20
|
+
* the new page rendered INERT behind a drawer they had to dismiss a second
|
|
21
|
+
* time, on a phone.
|
|
22
|
+
*
|
|
23
|
+
* Here rather than in `SidebarRoot`, because this is the component that knows
|
|
24
|
+
* an activation happened; `SidebarBackButton` and every
|
|
25
|
+
* `SidebarItemCollapsibleContent` leaf render through it, so they are covered
|
|
26
|
+
* by construction. Guarded on `isDrawer` so an inline rail — where nothing is
|
|
27
|
+
* covering the page — behaves exactly as before, and the consumer's own
|
|
28
|
+
* handler still runs either way.
|
|
29
|
+
*/
|
|
30
|
+
const handleClick = (event) => {
|
|
31
|
+
onClick?.(event);
|
|
32
|
+
if (isDrawer) {
|
|
33
|
+
setOpenMobile(false);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
12
36
|
if (isCollapsed) {
|
|
13
|
-
return (_jsx(SidebarItemIconButton, { "data-slot": "sidebar-item", href: href, active: isActive(href) || active, ...props }));
|
|
37
|
+
return (_jsx(SidebarItemIconButton, { "data-slot": "sidebar-item", href: href, active: isActive(href) || active, onClick: handleClick, ...props }));
|
|
14
38
|
}
|
|
15
|
-
return (_jsx(SidebarItemButton, { "data-slot": "sidebar-item", href: href, active: isActive(href) || active, ...props }));
|
|
39
|
+
return (_jsx(SidebarItemButton, { "data-slot": "sidebar-item", href: href, active: isActive(href) || active, onClick: handleClick, ...props }));
|
|
16
40
|
};
|
|
@@ -1,12 +1,49 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The viewport below which the rail stops being a layout and becomes a drawer.
|
|
4
|
+
*
|
|
5
|
+
* 767px rather than 768px: this is the upper bound of `max-width`, so it is the
|
|
6
|
+
* complement of Tailwind's `md` breakpoint (`min-width: 768px`) and `md:hidden`
|
|
7
|
+
* on `SidebarTrigger` flips at exactly the same pixel the query does.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SIDEBAR_MOBILE_QUERY = "(max-width: 767px)";
|
|
2
10
|
export type SidebarContextProps = {
|
|
3
11
|
isCollapsed: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* True only inside a drawer that `SidebarRoot` is actually rendering, which
|
|
14
|
+
* needs `mobile="drawer"` as well as a narrow viewport. `SidebarRoot`
|
|
15
|
+
* re-provides the context for that subtree; nothing else sets it.
|
|
16
|
+
*/
|
|
17
|
+
isDrawer: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* True while the viewport is narrow enough for a drawer. Reported in BOTH
|
|
20
|
+
* modes, so a consumer still on `mobile="inline"` can build its own
|
|
21
|
+
* responsive behaviour from it.
|
|
22
|
+
*/
|
|
23
|
+
isMobile: boolean;
|
|
24
|
+
/** Whether the mobile drawer is showing. Meaningless while `isMobile` is false. */
|
|
25
|
+
openMobile: boolean;
|
|
26
|
+
setOpenMobile: (open: boolean) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Puts focus back on whatever opened the drawer. `SidebarRoot` calls it when
|
|
29
|
+
* the drawer closes; nothing else should need it.
|
|
30
|
+
*/
|
|
31
|
+
restoreDrawerFocus: () => void;
|
|
32
|
+
/** The drawer's DOM id, so `SidebarTrigger` can point `aria-controls` at it. */
|
|
33
|
+
sidebarId: string;
|
|
4
34
|
items: Record<string, boolean>;
|
|
5
35
|
setItems: React.Dispatch<React.SetStateAction<Record<string, boolean>>>;
|
|
6
36
|
getItemCollapsed: (key: string) => boolean;
|
|
7
37
|
setItemCollapsed: (key: string, value: boolean) => void;
|
|
8
38
|
toggleSidebar: () => void;
|
|
9
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* Exported so `SidebarRoot` can re-provide it for the drawer's subtree. That
|
|
42
|
+
* subtree is the only place `isCollapsed` and `isDrawer` differ from the
|
|
43
|
+
* provider's own values, and scoping the override to it is what keeps a
|
|
44
|
+
* consumer on `mobile="inline"` seeing exactly today's rail.
|
|
45
|
+
*/
|
|
46
|
+
export declare const SidebarContext: React.Context<SidebarContextProps | undefined>;
|
|
10
47
|
export declare const useSidebar: () => SidebarContextProps;
|
|
11
48
|
export declare const SidebarProvider: ({ children }: React.PropsWithChildren) => React.JSX.Element;
|
|
12
49
|
//# sourceMappingURL=sidebar-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-provider.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/sidebar/sidebar-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,MAAM,MAAM,mBAAmB,GAAG;IAChC,WAAW,EAAE,OAAO,CAAA;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,QAAQ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