@moldable-ai/ui 0.2.21 → 0.2.22
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/catalog/catalog-types.d.ts +7 -0
- package/dist/catalog/catalog-types.d.ts.map +1 -1
- package/dist/catalog/catalog-types.js +1 -0
- package/dist/catalog/core-catalog-exclusions.d.ts.map +1 -1
- package/dist/catalog/core-catalog-exclusions.js +4 -0
- package/dist/catalog/core-collection-stories.js +1 -1
- package/dist/catalog/core-control-stories.d.ts.map +1 -1
- package/dist/catalog/core-control-stories.js +6 -3
- package/dist/components/app-error-boundary.d.ts.map +1 -1
- package/dist/components/app-error-boundary.js +3 -2
- package/dist/components/ui/alert-dialog.d.ts +4 -2
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.js +8 -4
- package/dist/components/ui/alert.d.ts +1 -1
- package/dist/components/ui/button.d.ts +6 -4
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +40 -8
- package/dist/components/ui/confirm-dialog.d.ts.map +1 -1
- package/dist/components/ui/confirm-dialog.js +1 -1
- package/dist/components/ui/dialog-primary-action.d.ts +4 -0
- package/dist/components/ui/dialog-primary-action.d.ts.map +1 -0
- package/dist/components/ui/dialog-primary-action.js +37 -0
- package/dist/components/ui/dialog.d.ts +6 -2
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +10 -3
- package/dist/components/ui/error-boundary-view.d.ts +12 -0
- package/dist/components/ui/error-boundary-view.d.ts.map +1 -0
- package/dist/components/ui/error-boundary-view.js +8 -0
- package/dist/components/ui/icon-button.d.ts.map +1 -1
- package/dist/components/ui/icon-button.js +1 -2
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +1 -0
- package/dist/components/ui/input-group.d.ts +1 -1
- package/dist/components/ui/spinner.d.ts.map +1 -1
- package/dist/components/ui/spinner.js +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/lib/frame-lifecycle.d.ts +22 -0
- package/dist/lib/frame-lifecycle.d.ts.map +1 -1
- package/dist/lib/frame-lifecycle.js +27 -1
- package/dist/lib/host-date-time-picker.d.ts +36 -0
- package/dist/lib/host-date-time-picker.d.ts.map +1 -0
- package/dist/lib/host-date-time-picker.js +162 -0
- package/dist/lib/host-file-dialog.d.ts +66 -0
- package/dist/lib/host-file-dialog.d.ts.map +1 -0
- package/dist/lib/host-file-dialog.js +221 -0
- package/dist/lib/host-native-menu.d.ts +75 -0
- package/dist/lib/host-native-menu.d.ts.map +1 -0
- package/dist/lib/host-native-menu.js +187 -0
- package/dist/lib/host-services.d.ts +13 -0
- package/dist/lib/host-services.d.ts.map +1 -0
- package/dist/lib/host-services.js +161 -0
- package/dist/lib/host-share.d.ts +39 -0
- package/dist/lib/host-share.d.ts.map +1 -0
- package/dist/lib/host-share.js +161 -0
- package/docs/README.md +1 -0
- package/docs/visual-regression.md +78 -0
- package/package.json +12 -3
- package/src/components/ui/alert-dialog.md +27 -0
- package/src/components/ui/button.md +10 -3
- package/src/components/ui/dialog.md +23 -4
- package/src/components/ui/error-boundary-view.md +98 -0
|
@@ -4,11 +4,13 @@ export declare const catalogDensities: readonly ["regular", "compact"];
|
|
|
4
4
|
export declare const catalogViewports: readonly ["wide", "narrow"];
|
|
5
5
|
export declare const catalogAccessibilityModes: readonly ["standard", "reduced-transparency", "increased-contrast", "reduced-motion"];
|
|
6
6
|
export declare const catalogInteractions: readonly ["rest", "hover", "focus-visible", "pressed", "selected", "disabled", "invalid", "loading", "empty"];
|
|
7
|
+
export declare const catalogLiveStates: readonly ["hover", "focus", "pressed"];
|
|
7
8
|
export type CatalogTheme = (typeof catalogThemes)[number];
|
|
8
9
|
export type CatalogDensity = (typeof catalogDensities)[number];
|
|
9
10
|
export type CatalogViewport = (typeof catalogViewports)[number];
|
|
10
11
|
export type CatalogAccessibilityMode = (typeof catalogAccessibilityModes)[number];
|
|
11
12
|
export type CatalogInteraction = (typeof catalogInteractions)[number];
|
|
13
|
+
export type CatalogLiveState = (typeof catalogLiveStates)[number];
|
|
12
14
|
export interface CatalogCaseContext {
|
|
13
15
|
caseId: string;
|
|
14
16
|
sectionId: string;
|
|
@@ -33,6 +35,11 @@ export interface CatalogStoryDefinition {
|
|
|
33
35
|
viewports?: readonly CatalogViewport[];
|
|
34
36
|
accessibilityModes?: readonly CatalogAccessibilityMode[];
|
|
35
37
|
interactions?: readonly CatalogInteraction[];
|
|
38
|
+
/**
|
|
39
|
+
* Browser-driven states captured from the element marked with
|
|
40
|
+
* `data-state-target="<space-separated states>"`.
|
|
41
|
+
*/
|
|
42
|
+
liveStates?: readonly CatalogLiveState[];
|
|
36
43
|
render: (context: CatalogCaseContext) => React.ReactNode;
|
|
37
44
|
}
|
|
38
45
|
export interface CatalogSectionDefinition {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog-types.d.ts","sourceRoot":"","sources":["../../src/catalog/catalog-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAEnC,eAAO,MAAM,aAAa,4BAA6B,CAAA;AACvD,eAAO,MAAM,gBAAgB,iCAAkC,CAAA;AAC/D,eAAO,MAAM,gBAAgB,6BAA8B,CAAA;AAC3D,eAAO,MAAM,yBAAyB,uFAK5B,CAAA;AACV,eAAO,MAAM,mBAAmB,+GAUtB,CAAA;
|
|
1
|
+
{"version":3,"file":"catalog-types.d.ts","sourceRoot":"","sources":["../../src/catalog/catalog-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAEnC,eAAO,MAAM,aAAa,4BAA6B,CAAA;AACvD,eAAO,MAAM,gBAAgB,iCAAkC,CAAA;AAC/D,eAAO,MAAM,gBAAgB,6BAA8B,CAAA;AAC3D,eAAO,MAAM,yB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E,MAAM,oBAAoB,CAAA;AAElE;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,wBAAwB,
|
|
1
|
+
{"version":3,"file":"core-catalog-exclusions.d.ts","sourceRoot":"","sources":["../../src/catalog/core-catalog-exclusions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAElE;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAAE,SAAS,wBAAwB,EAsJ3D,CAAA"}
|
|
@@ -60,6 +60,10 @@ export const coreCatalogExclusions = [
|
|
|
60
60
|
component: 'dropdown-menu',
|
|
61
61
|
reason: 'Requires isolated portal and keyboard coverage.',
|
|
62
62
|
},
|
|
63
|
+
{
|
|
64
|
+
component: 'error-boundary-view',
|
|
65
|
+
reason: 'Needs the separately planned pane and full-window catalog test host.',
|
|
66
|
+
},
|
|
63
67
|
{
|
|
64
68
|
component: 'date-picker',
|
|
65
69
|
reason: 'Requires isolated calendar portal rendering.',
|
|
@@ -36,7 +36,7 @@ export const coreCollectionsSection = {
|
|
|
36
36
|
title: 'Item anatomy',
|
|
37
37
|
components: ['item'],
|
|
38
38
|
viewports: ['narrow'],
|
|
39
|
-
render: () => (_jsx(ItemGroup, { children: _jsxs(Item, { size: "sm", variant: "outline", children: [_jsx(ItemMedia, { variant: "icon", children: _jsx(FileTextIcon, {}) }), _jsxs(ItemContent, { children: [_jsx(ItemTitle, { children: "Project brief" }), _jsx(ItemDescription, { children: "Edited five minutes ago" })] }), _jsx(ItemActions, { children: _jsx(IconButton, { label: "More actions", size: "sm", variant: "ghost", children: _jsx(MoreHorizontalIcon, {}) }) })] }) })),
|
|
39
|
+
render: () => (_jsx(ItemGroup, { children: _jsxs(Item, { role: "listitem", size: "sm", variant: "outline", children: [_jsx(ItemMedia, { variant: "icon", children: _jsx(FileTextIcon, {}) }), _jsxs(ItemContent, { children: [_jsx(ItemTitle, { children: "Project brief" }), _jsx(ItemDescription, { children: "Edited five minutes ago" })] }), _jsx(ItemActions, { children: _jsx(IconButton, { label: "More actions", size: "sm", variant: "ghost", children: _jsx(MoreHorizontalIcon, {}) }) })] }) })),
|
|
40
40
|
},
|
|
41
41
|
],
|
|
42
42
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-control-stories.d.ts","sourceRoot":"","sources":["../../src/catalog/core-control-stories.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAA;AAM/D,eAAO,MAAM,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"core-control-stories.d.ts","sourceRoot":"","sources":["../../src/catalog/core-control-stories.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAA;AAM/D,eAAO,MAAM,mBAAmB,EAAE,wBAwPjC,CAAA"}
|
|
@@ -29,7 +29,8 @@ export const coreControlsSection = {
|
|
|
29
29
|
title: 'Button',
|
|
30
30
|
components: ['button'],
|
|
31
31
|
interactions: ['rest', 'focus-visible', 'disabled'],
|
|
32
|
-
|
|
32
|
+
liveStates: ['hover', 'focus', 'pressed'],
|
|
33
|
+
render: ({ interaction }) => (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsx(Button, { "data-catalog-target": true, "data-state-target": "hover focus pressed", autoFocus: interaction === 'focus-visible', disabled: interaction === 'disabled', children: "Continue" }), _jsx(Button, { variant: "outline", disabled: interaction === 'disabled', children: "Cancel" })] })),
|
|
33
34
|
},
|
|
34
35
|
{
|
|
35
36
|
id: 'icon-button',
|
|
@@ -43,7 +44,8 @@ export const coreControlsSection = {
|
|
|
43
44
|
title: 'Segmented control',
|
|
44
45
|
components: ['segmented-control'],
|
|
45
46
|
interactions: ['rest', 'focus-visible', 'disabled'],
|
|
46
|
-
|
|
47
|
+
liveStates: ['hover', 'focus', 'pressed'],
|
|
48
|
+
render: ({ interaction }) => (_jsxs(SegmentedControl, { "aria-label": "Calendar view", defaultValue: "month", disabled: interaction === 'disabled', children: [_jsx(SegmentedControlItem, { "data-catalog-target": true, "data-state-target": "hover focus pressed", value: "week", autoFocus: interaction === 'focus-visible', children: "Week" }), _jsx(SegmentedControlItem, { value: "month", children: "Month" })] })),
|
|
47
49
|
},
|
|
48
50
|
{
|
|
49
51
|
id: 'text-field',
|
|
@@ -81,7 +83,8 @@ export const coreControlsSection = {
|
|
|
81
83
|
title: 'Toggle and grouped controls',
|
|
82
84
|
components: ['button-group', 'kbd', 'toggle', 'toggle-group'],
|
|
83
85
|
interactions: ['rest', 'selected', 'disabled'],
|
|
84
|
-
|
|
86
|
+
liveStates: ['hover', 'focus', 'pressed'],
|
|
87
|
+
render: ({ interaction }) => (_jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [_jsx(ToggleButton, { "data-catalog-target": true, "data-state-target": "hover focus pressed", iconOnly: true, "aria-label": "Bold", defaultPressed: interaction === 'selected', disabled: interaction === 'disabled', children: _jsx(BoldIcon, {}) }), _jsxs(ToggleGroup, { type: "multiple", variant: "outline", defaultValue: interaction === 'selected' ? ['italic'] : [], disabled: interaction === 'disabled', "aria-label": "Formatting", children: [_jsx(ToggleGroupItem, { value: "bold", children: "Bold" }), _jsxs(ToggleGroupItem, { value: "italic", children: [_jsx(ItalicIcon, {}), "Italic"] })] }), _jsxs(ButtonGroup, { children: [_jsx(ButtonGroupText, { children: _jsxs(KbdGroup, { children: [_jsx(Kbd, { children: "\u2318" }), _jsx(Kbd, { children: "K" })] }) }), _jsx(Button, { variant: "outline", disabled: interaction === 'disabled', children: "Commands" })] })] })),
|
|
85
88
|
},
|
|
86
89
|
{
|
|
87
90
|
id: 'value-fields',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-error-boundary.d.ts","sourceRoot":"","sources":["../../src/components/app-error-boundary.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"app-error-boundary.d.ts","sourceRoot":"","sources":["../../src/components/app-error-boundary.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAIjE,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAA;AAWzE,UAAU,qBAAqB;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,SAAS,CAAA;IACnB,YAAY,CAAC,EAAE,KAAK,GAAG,IAAI,CAAA;IAC3B,aAAa,CAAC,EAAE,cAAc,CAAA;CAC/B;AAED,UAAU,qBAAqB;IAC7B,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;IACnB,MAAM,EAAE,cAAc,CAAA;IACtB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B;AAaD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAWhE;AA0CD,qBAAa,gBAAiB,SAAQ,SAAS,CAC7C,qBAAqB,EACrB,qBAAqB,CACtB;IACC,KAAK,EAAE,qBAAqB,CAAA;IAE5B,MAAM,CAAC,wBAAwB,CAC7B,KAAK,EAAE,KAAK,GACX,OAAO,CAAC,qBAAqB,CAAC;gBAIrB,KAAK,EAAE,qBAAqB;IASxC,iBAAiB,IAAI,IAAI;IAgBzB,oBAAoB,IAAI,IAAI;IAU5B,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI;IAWtD,OAAO,CAAC,iBAAiB,CAMxB;IAED,OAAO,CAAC,wBAAwB,CAa/B;IAED,OAAO,CAAC,MAAM,CAEb;IAED,OAAO,CAAC,WAAW,CAYlB;IAED,MAAM;CAoCP"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxs as _jsxs,
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { MessageSquareWarning, RefreshCw } from 'lucide-react';
|
|
4
4
|
import { Component } from 'react';
|
|
5
5
|
import { Button } from './ui/button';
|
|
6
|
+
import { ErrorBoundaryView } from './ui/error-boundary-view';
|
|
6
7
|
function toError(value) {
|
|
7
8
|
if (value instanceof Error)
|
|
8
9
|
return value;
|
|
@@ -117,6 +118,6 @@ export class AppErrorBoundary extends Component {
|
|
|
117
118
|
if (!error)
|
|
118
119
|
return this.props.children;
|
|
119
120
|
const errorSummary = formatError(error, source, componentStack);
|
|
120
|
-
return (_jsx(
|
|
121
|
+
return (_jsx(ErrorBoundaryView, { className: "min-h-screen", title: `${this.props.appName} hit a UI error`, message: "Reload to recover, or send the captured client error to Moldable so it can inspect the crash.", details: errorSummary, actions: _jsxs(_Fragment, { children: [_jsxs(Button, { type: "button", className: "cursor-pointer", onClick: this.reload, children: [_jsx(RefreshCw, {}), "Reload"] }), _jsxs(Button, { type: "button", variant: "secondary", className: "cursor-pointer", onClick: this.askMoldable, children: [_jsx(MessageSquareWarning, {}), "Ask Moldable to fix this"] })] }) }));
|
|
121
122
|
}
|
|
122
123
|
}
|
|
@@ -5,7 +5,7 @@ declare function AlertDialog({ ...props }: React.ComponentProps<typeof AlertDial
|
|
|
5
5
|
declare function AlertDialogTrigger({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
declare function AlertDialogPortal({ ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
declare function AlertDialogOverlay({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
declare function AlertDialogContent({ className, size, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {
|
|
8
|
+
declare function AlertDialogContent({ className, onKeyDown, size, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {
|
|
9
9
|
size?: 'sm' | 'default' | 'lg';
|
|
10
10
|
}): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
declare function AlertDialogHeader({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,9 +14,11 @@ declare function AlertDialogBody({ className, ...props }: React.ComponentProps<'
|
|
|
14
14
|
declare function AlertDialogTitle({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
declare function AlertDialogDescription({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Description>): import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
declare function AlertDialogMedia({ className, ...props }: React.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
declare function AlertDialogAction({ className, children, disabled, pending, pendingLabel, variant, size, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Action> & Pick<React.ComponentProps<typeof Button>, 'variant' | 'size'> & {
|
|
17
|
+
declare function AlertDialogAction({ className, children, disabled, loading, pending, pendingLabel, primary, variant, size, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Action> & Pick<React.ComponentProps<typeof Button>, 'variant' | 'size'> & {
|
|
18
|
+
loading?: boolean;
|
|
18
19
|
pending?: boolean;
|
|
19
20
|
pendingLabel?: React.ReactNode;
|
|
21
|
+
primary?: boolean;
|
|
20
22
|
}): import("react/jsx-runtime").JSX.Element;
|
|
21
23
|
declare function AlertDialogCancel({ className, variant, size, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Cancel> & Pick<React.ComponentProps<typeof Button>, 'variant' | 'size'>): import("react/jsx-runtime").JSX.Element;
|
|
22
24
|
export { AlertDialog, AlertDialogAction, AlertDialogBody, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogMedia, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-dialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/alert-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,oBAAoB,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"alert-dialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/alert-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,oBAAoB,MAAM,8BAA8B,CAAA;AACpE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAIjC,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC,2CAExD;AAED,iBAAS,kBAAkB,CAAC,EAC1B,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,OAAO,CAAC,2CAI3D;AAED,iBAAS,iBAAiB,CAAC,EACzB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,MAAM,CAAC,2CAI1D;AAED,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,OAAO,CAAC,2CAW3D;AAED,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,SAAS,EACT,IAAgB,EAChB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,OAAO,CAAC,GAAG;IAC7D,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI,CAAA;CAC/B,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zB,SAAS,EACT,OAAmB,EACnB,IAAgB,EAChB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,MAAM,CAAC,GACzD,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC,2CAU9D;AAED,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,GACnB,CAAA"}
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
4
4
|
import { cn } from '../../lib/utils';
|
|
5
5
|
import { Button } from './button';
|
|
6
|
+
import { handleDialogPrimaryActionKeyDown } from './dialog-primary-action';
|
|
6
7
|
import { Spinner } from './spinner';
|
|
7
8
|
function AlertDialog({ ...props }) {
|
|
8
9
|
return _jsx(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", ...props });
|
|
@@ -16,8 +17,11 @@ function AlertDialogPortal({ ...props }) {
|
|
|
16
17
|
function AlertDialogOverlay({ className, ...props }) {
|
|
17
18
|
return (_jsx(AlertDialogPrimitive.Overlay, { "data-slot": "alert-dialog-overlay", className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50', className), ...props }));
|
|
18
19
|
}
|
|
19
|
-
function AlertDialogContent({ className, size = 'default', ...props }) {
|
|
20
|
-
return (_jsxs(AlertDialogPortal, { children: [_jsx(AlertDialogOverlay, {}), _jsx("div", { "data-slot": "alert-dialog-positioner", className: "pointer-events-none fixed bottom-[max(var(--window-content-inset-bottom),var(--chat-safe-padding),1rem)] left-[max(var(--window-content-inset-inline-start),1rem)] right-[max(var(--window-content-inset-inline-end),1rem)] top-[max(var(--window-content-inset-top),1rem)] z-50 grid place-items-center", children: _jsx(AlertDialogPrimitive.Content, { "data-slot": "alert-dialog-content", "data-size": size, className: cn('bg-background group/alert-dialog-content rounded-overlay border-separator shadow-overlay pointer-events-auto relative grid max-h-full min-h-0 w-full gap-4 overflow-hidden border p-6 outline-none', 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95', 'duration-[var(--motion-duration-normal)]', 'data-[size=default]:max-w-lg data-[size=lg]:max-w-2xl data-[size=sm]:max-w-xs', className),
|
|
20
|
+
function AlertDialogContent({ className, onKeyDown, size = 'default', ...props }) {
|
|
21
|
+
return (_jsxs(AlertDialogPortal, { children: [_jsx(AlertDialogOverlay, {}), _jsx("div", { "data-slot": "alert-dialog-positioner", className: "pointer-events-none fixed bottom-[max(var(--window-content-inset-bottom),var(--chat-safe-padding),1rem)] left-[max(var(--window-content-inset-inline-start),1rem)] right-[max(var(--window-content-inset-inline-end),1rem)] top-[max(var(--window-content-inset-top),1rem)] z-50 grid place-items-center", children: _jsx(AlertDialogPrimitive.Content, { "data-slot": "alert-dialog-content", "data-size": size, className: cn('bg-background group/alert-dialog-content rounded-overlay border-separator shadow-overlay pointer-events-auto relative grid max-h-full min-h-0 w-full gap-4 overflow-hidden border p-6 outline-none', 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95', 'duration-[var(--motion-duration-normal)]', 'data-[size=default]:max-w-lg data-[size=lg]:max-w-2xl data-[size=sm]:max-w-xs', className), onKeyDown: (event) => {
|
|
22
|
+
onKeyDown?.(event);
|
|
23
|
+
handleDialogPrimaryActionKeyDown(event);
|
|
24
|
+
}, ...props }) })] }));
|
|
21
25
|
}
|
|
22
26
|
function AlertDialogHeader({ className, ...props }) {
|
|
23
27
|
return (_jsx("div", { "data-slot": "alert-dialog-header", className: cn('has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr] grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left', className), ...props }));
|
|
@@ -37,8 +41,8 @@ function AlertDialogDescription({ className, ...props }) {
|
|
|
37
41
|
function AlertDialogMedia({ className, ...props }) {
|
|
38
42
|
return (_jsx("div", { "data-slot": "alert-dialog-media", className: cn("bg-muted *:[svg:not([class*='size-'])]:size-8 mb-2 inline-flex size-16 items-center justify-center rounded-md sm:group-data-[size=default]/alert-dialog-content:row-span-2", className), ...props }));
|
|
39
43
|
}
|
|
40
|
-
function AlertDialogAction({ className, children, disabled, pending = false, pendingLabel, variant = 'default', size = 'default', ...props }) {
|
|
41
|
-
return (_jsx(Button, { variant: variant, size: size, disabled: disabled || pending, "aria-busy": pending || undefined, asChild: true, children: _jsxs(AlertDialogPrimitive.Action, { "data-slot": "alert-dialog-action", "data-pending": pending || undefined, className: cn(className), ...props, children: [pending ? _jsx(Spinner, { "aria-hidden": "true" }) : null, pending && pendingLabel !== undefined ? pendingLabel : children] }) }));
|
|
44
|
+
function AlertDialogAction({ className, children, disabled, loading = false, pending = false, pendingLabel, primary = false, variant = 'default', size = 'default', ...props }) {
|
|
45
|
+
return (_jsx(Button, { variant: variant, size: size, disabled: disabled || pending, loading: loading, "aria-busy": pending || undefined, asChild: true, children: _jsxs(AlertDialogPrimitive.Action, { "data-slot": "alert-dialog-action", "data-dialog-primary-action": primary || undefined, "data-pending": pending || undefined, className: cn(className), ...props, children: [pending ? _jsx(Spinner, { "aria-hidden": "true" }) : null, pending && pendingLabel !== undefined ? pendingLabel : children] }) }));
|
|
42
46
|
}
|
|
43
47
|
function AlertDialogCancel({ className, variant = 'outline', size = 'default', ...props }) {
|
|
44
48
|
return (_jsx(Button, { variant: variant, size: size, asChild: true, children: _jsx(AlertDialogPrimitive.Cancel, { "data-slot": "alert-dialog-cancel", className: cn(className), ...props }) }));
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { type IconButtonProps } from './icon-button';
|
|
3
3
|
import { type VariantProps } from 'class-variance-authority';
|
|
4
4
|
declare const alertVariants: (props?: ({
|
|
5
|
-
tone?: "
|
|
5
|
+
tone?: "neutral" | "info" | "success" | "warning" | "danger" | null | undefined;
|
|
6
6
|
density?: "compact" | "default" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
type AlertTone = NonNullable<VariantProps<typeof alertVariants>['tone']>;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "link" | "default" | "
|
|
5
|
-
size?: "default" | "
|
|
4
|
+
variant?: "link" | "default" | "outline" | "destructive" | "secondary" | "ghost" | null | undefined;
|
|
5
|
+
size?: "default" | "sm" | "icon" | "xs" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
-
|
|
7
|
+
type ButtonProps = React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
|
|
8
8
|
asChild?: boolean;
|
|
9
|
-
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
};
|
|
11
|
+
declare function Button({ 'aria-busy': ariaBusy, children, className, disabled, loading, onClick, onKeyDown, variant, size, asChild, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
export { Button, buttonVariants };
|
|
11
13
|
//# sourceMappingURL=button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,KAAK,YAAY,EAAO,MAAM,0BAA0B,CAAA;AAEjE,QAAA,MAAM,cAAc;;;8EAgCnB,CAAA;AAED,KAAK,WAAW,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GAC/C,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG;IACpC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AA4CH,iBAAS,MAAM,CAAC,EACd,WAAW,EAAE,QAAQ,EACrB,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,OAAe,EACf,OAAO,EACP,SAAS,EACT,OAAmB,EACnB,IAAgB,EAChB,OAAe,EACf,GAAG,KAAK,EACT,EAAE,WAAW,2CAqDb;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import * as React from 'react';
|
|
3
4
|
import { cn } from '../../lib/utils';
|
|
5
|
+
import { Spinner } from './spinner';
|
|
4
6
|
import { cva } from 'class-variance-authority';
|
|
5
|
-
const buttonVariants = cva("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
7
|
+
const buttonVariants = cva("relative inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
6
8
|
variants: {
|
|
7
9
|
variant: {
|
|
8
10
|
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
|
|
@@ -13,10 +15,10 @@ const buttonVariants = cva("inline-flex cursor-pointer items-center justify-cent
|
|
|
13
15
|
link: 'text-primary underline-offset-4 hover:underline',
|
|
14
16
|
},
|
|
15
17
|
size: {
|
|
16
|
-
default: 'h-9 px-4 py-2 has-[>svg]:px-3',
|
|
17
|
-
xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
18
|
-
sm: 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5',
|
|
19
|
-
lg: 'h-10 rounded-md px-6 has-[>svg]:px-4',
|
|
18
|
+
default: 'h-9 px-4 py-2 has-[>[data-slot=button-content]>svg]:px-3',
|
|
19
|
+
xs: "h-6 gap-1 rounded-md px-2 text-xs has-[>[data-slot=button-content]>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",
|
|
20
|
+
sm: 'h-8 rounded-md gap-1.5 px-3 has-[>[data-slot=button-content]>svg]:px-2.5',
|
|
21
|
+
lg: 'h-10 rounded-md px-6 has-[>[data-slot=button-content]>svg]:px-4',
|
|
20
22
|
icon: 'size-9',
|
|
21
23
|
'icon-xs': "size-6 rounded-md [&_svg:not([class*='size-'])]:size-3",
|
|
22
24
|
'icon-sm': 'size-8',
|
|
@@ -28,8 +30,38 @@ const buttonVariants = cva("inline-flex cursor-pointer items-center justify-cent
|
|
|
28
30
|
size: 'default',
|
|
29
31
|
},
|
|
30
32
|
});
|
|
31
|
-
function
|
|
33
|
+
function ButtonContent({ children, loading, }) {
|
|
34
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { "data-slot": "button-content", className: cn('inline-flex items-center justify-center [gap:inherit]', loading && 'opacity-0'), children: children }), loading ? (_jsx("span", { "data-slot": "button-loading-indicator", "aria-hidden": "true", className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: _jsx(Spinner, { "aria-hidden": "true" }) })) : null] }));
|
|
35
|
+
}
|
|
36
|
+
function blockLoadingInteraction(event) {
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
event.stopPropagation();
|
|
39
|
+
}
|
|
40
|
+
function Button({ 'aria-busy': ariaBusy, children, className, disabled, loading = false, onClick, onKeyDown, variant = 'default', size = 'default', asChild = false, ...props }) {
|
|
32
41
|
const Comp = asChild ? Slot : 'button';
|
|
33
|
-
|
|
42
|
+
const buttonChildren = (_jsx(ButtonContent, { loading: loading, children: children }));
|
|
43
|
+
const renderedChildren = asChild && React.isValidElement(children)
|
|
44
|
+
? React.cloneElement(React.Children.only(children), loading
|
|
45
|
+
? {
|
|
46
|
+
onClick: blockLoadingInteraction,
|
|
47
|
+
onKeyDown: blockLoadingInteraction,
|
|
48
|
+
}
|
|
49
|
+
: undefined, _jsx(ButtonContent, { loading: loading, children: children.props.children }))
|
|
50
|
+
: buttonChildren;
|
|
51
|
+
const handleClick = (event) => {
|
|
52
|
+
if (loading) {
|
|
53
|
+
blockLoadingInteraction(event);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
onClick?.(event);
|
|
57
|
+
};
|
|
58
|
+
const handleKeyDown = (event) => {
|
|
59
|
+
if (loading) {
|
|
60
|
+
blockLoadingInteraction(event);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
onKeyDown?.(event);
|
|
64
|
+
};
|
|
65
|
+
return (_jsx(Comp, { "data-slot": "button", "data-variant": variant, "data-size": size, "data-loading": loading || undefined, "aria-busy": loading || ariaBusy || undefined, disabled: disabled || loading, className: cn(buttonVariants({ variant, size, className })), onClick: handleClick, onKeyDown: handleKeyDown, ...props, children: renderedChildren }));
|
|
34
66
|
}
|
|
35
67
|
export { Button, buttonVariants };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirm-dialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/confirm-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EACL,WAAW,EASZ,MAAM,gBAAgB,CAAA;AAEvB,UAAU,kBACR,SAAQ,IAAI,CACV,KAAK,CAAC,cAAc,CAAC,OAAO,WAAW,CAAC,EACxC,UAAU,GAAG,cAAc,CAC5B;IACD,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,WAAW,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B,OAAO,CAAC,EAAE,KAAK,CAAC,YAAY,CAAA;IAC5B,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAA;IACnC,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI,CAAA;IAC9B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC,SAAS,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACrC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,OAA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AAe,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,CAAC,SAAS,CAAA;CACtD;AAED,iBAAS,aAAa,CAAC,EACrB,WAAsB,EACtB,YAAwB,EACxB,WAAmB,EACnB,WAAW,EACX,eAAe,EACf,SAAS,EACT,cAAc,EACd,YAAY,EACZ,IAAI,EACJ,YAAyB,EACzB,IAAgB,EAChB,KAAK,EACL,OAAO,EACP,OAAmB,EACnB,GAAG,KAAK,EACT,EAAE,kBAAkB,2CAiFpB;AAED,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,CAAA"}
|
|
@@ -40,6 +40,6 @@ function ConfirmDialog({ cancelLabel = 'Cancel', confirmLabel = 'Confirm', defau
|
|
|
40
40
|
onConfirmError?.(confirmError);
|
|
41
41
|
}
|
|
42
42
|
}, [getErrorMessage, onConfirm, onConfirmError, onOpenChange, open]);
|
|
43
|
-
return (_jsxs(AlertDialog, { open: resolvedOpen, onOpenChange: updateOpen, ...props, children: [trigger ? (_jsx(AlertDialogTrigger, { asChild: true, children: trigger })) : null, _jsxs(AlertDialogContent, { size: size, children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: title }), _jsx(AlertDialogDescription, { children: description })] }), error ? (_jsx("p", { "data-slot": "confirm-dialog-error", role: "alert", className: "text-destructive text-sm", children: error })) : null, _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { disabled: pending, children: cancelLabel }), _jsx(AlertDialogAction, { variant: variant, pending: pending, pendingLabel: pendingLabel, onClick: handleConfirm, children: confirmLabel })] })] })] }));
|
|
43
|
+
return (_jsxs(AlertDialog, { open: resolvedOpen, onOpenChange: updateOpen, ...props, children: [trigger ? (_jsx(AlertDialogTrigger, { asChild: true, children: trigger })) : null, _jsxs(AlertDialogContent, { size: size, children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: title }), _jsx(AlertDialogDescription, { children: description })] }), error ? (_jsx("p", { "data-slot": "confirm-dialog-error", role: "alert", className: "text-destructive text-sm", children: error })) : null, _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { disabled: pending, children: cancelLabel }), _jsx(AlertDialogAction, { primary: true, variant: variant, pending: pending, pendingLabel: pendingLabel, onClick: handleConfirm, children: confirmLabel })] })] })] }));
|
|
44
44
|
}
|
|
45
45
|
export { ConfirmDialog };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog-primary-action.d.ts","sourceRoot":"","sources":["../../../src/components/ui/dialog-primary-action.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,kBAAkB,EAAE,MAAM,OAAO,CAAA;AA6BhE,iBAAS,gCAAgC,CACvC,KAAK,EAAE,kBAAkB,CAAC,WAAW,CAAC,GACrC,IAAI,CAiCN;AAED,OAAO,EAAE,gCAAgC,EAAE,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const DIALOG_CONTENT_SELECTOR = '[data-slot="dialog-content"], [data-slot="alert-dialog-content"]';
|
|
2
|
+
const PRIMARY_ACTION_SELECTOR = '[data-dialog-primary-action="true"]';
|
|
3
|
+
function usesCommandKey() {
|
|
4
|
+
if (typeof navigator === 'undefined')
|
|
5
|
+
return false;
|
|
6
|
+
return /Mac|iPhone|iPad|iPod/i.test(`${navigator.platform} ${navigator.userAgent}`);
|
|
7
|
+
}
|
|
8
|
+
function hasPrimaryActionShortcut(event) {
|
|
9
|
+
const hasPlatformModifier = usesCommandKey()
|
|
10
|
+
? event.metaKey && !event.ctrlKey
|
|
11
|
+
: event.ctrlKey && !event.metaKey;
|
|
12
|
+
return (event.key === 'Enter' &&
|
|
13
|
+
hasPlatformModifier &&
|
|
14
|
+
!event.altKey &&
|
|
15
|
+
!event.shiftKey);
|
|
16
|
+
}
|
|
17
|
+
function handleDialogPrimaryActionKeyDown(event) {
|
|
18
|
+
if (event.defaultPrevented ||
|
|
19
|
+
event.repeat ||
|
|
20
|
+
event.nativeEvent.isComposing ||
|
|
21
|
+
!hasPrimaryActionShortcut(event)) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const eventTarget = event.target;
|
|
25
|
+
if (eventTarget instanceof Element &&
|
|
26
|
+
eventTarget.closest(DIALOG_CONTENT_SELECTOR) !== event.currentTarget) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const action = event.currentTarget.querySelector(PRIMARY_ACTION_SELECTOR);
|
|
30
|
+
if (!action ||
|
|
31
|
+
action.matches(':disabled, [aria-disabled="true"], [aria-busy="true"], [data-loading="true"]')) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
action.click();
|
|
36
|
+
}
|
|
37
|
+
export { handleDialogPrimaryActionKeyDown };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { Button } from './button';
|
|
3
4
|
declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
5
|
declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
5
6
|
declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
declare function DialogContent({ className, children, size, showCloseButton, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
9
|
+
declare function DialogContent({ className, children, onKeyDown, size, showCloseButton, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
9
10
|
size?: 'sm' | 'default' | 'lg' | 'full';
|
|
10
11
|
showCloseButton?: boolean;
|
|
11
12
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,7 +15,10 @@ declare function DialogBody({ className, ...props }: React.ComponentProps<'div'>
|
|
|
14
15
|
declare function DialogFooter({ className, showCloseButton, children, ...props }: React.ComponentProps<'div'> & {
|
|
15
16
|
showCloseButton?: boolean;
|
|
16
17
|
}): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare function DialogAction({ primary, ...props }: React.ComponentProps<typeof Button> & {
|
|
19
|
+
primary?: boolean;
|
|
20
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
17
21
|
declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
|
|
18
22
|
declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogBody, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
23
|
+
export { Dialog, DialogAction, DialogClose, DialogContent, DialogDescription, DialogBody, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
20
24
|
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AAEzD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AAEzD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,MAAM,EAAE,MAA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C,KAAK,CAAC,GAAG;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,2CAkBA;AAED,iBAAS,YAAY,CAAC,EACpB,OAAe,EACf,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,GAAG;IACvC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,2CAQA;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAQpD;AAED,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,WAAW,CAAC,2CAQ1D;AAED,OAAO,EACL,MAAM,EACN,YAAY,EACZ,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAA"}
|
|
@@ -4,6 +4,7 @@ import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
|
4
4
|
import { XIcon } from 'lucide-react';
|
|
5
5
|
import { cn } from '../../lib/utils';
|
|
6
6
|
import { Button } from './button';
|
|
7
|
+
import { handleDialogPrimaryActionKeyDown } from './dialog-primary-action';
|
|
7
8
|
function Dialog({ ...props }) {
|
|
8
9
|
return _jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
9
10
|
}
|
|
@@ -19,8 +20,11 @@ function DialogClose({ ...props }) {
|
|
|
19
20
|
function DialogOverlay({ className, ...props }) {
|
|
20
21
|
return (_jsx(DialogPrimitive.Overlay, { "data-slot": "dialog-overlay", className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50', className), ...props }));
|
|
21
22
|
}
|
|
22
|
-
function DialogContent({ className, children, size = 'default', showCloseButton = true, ...props }) {
|
|
23
|
-
return (_jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [_jsx(DialogOverlay, {}), _jsx("div", { "data-slot": "dialog-positioner", className: "pointer-events-none fixed bottom-[max(var(--window-content-inset-bottom),var(--chat-safe-padding),1rem)] left-[max(var(--window-content-inset-inline-start),1rem)] right-[max(var(--window-content-inset-inline-end),1rem)] top-[max(var(--window-content-inset-top),1rem)] z-50 grid place-items-center", children: _jsxs(DialogPrimitive.Content, { "data-slot": "dialog-content", "data-size": size, className: cn('bg-background rounded-overlay border-separator shadow-overlay pointer-events-auto relative grid max-h-full min-h-0 w-full gap-4 overflow-hidden border p-6 outline-none', 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95', 'duration-[var(--motion-duration-normal)]', 'data-[size=default]:max-w-lg data-[size=lg]:max-w-2xl data-[size=sm]:max-w-sm', 'data-[size=full]:size-full data-[size=full]:max-w-none', className),
|
|
23
|
+
function DialogContent({ className, children, onKeyDown, size = 'default', showCloseButton = true, ...props }) {
|
|
24
|
+
return (_jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [_jsx(DialogOverlay, {}), _jsx("div", { "data-slot": "dialog-positioner", className: "pointer-events-none fixed bottom-[max(var(--window-content-inset-bottom),var(--chat-safe-padding),1rem)] left-[max(var(--window-content-inset-inline-start),1rem)] right-[max(var(--window-content-inset-inline-end),1rem)] top-[max(var(--window-content-inset-top),1rem)] z-50 grid place-items-center", children: _jsxs(DialogPrimitive.Content, { "data-slot": "dialog-content", "data-size": size, className: cn('bg-background rounded-overlay border-separator shadow-overlay pointer-events-auto relative grid max-h-full min-h-0 w-full gap-4 overflow-hidden border p-6 outline-none', 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95', 'duration-[var(--motion-duration-normal)]', 'data-[size=default]:max-w-lg data-[size=lg]:max-w-2xl data-[size=sm]:max-w-sm', 'data-[size=full]:size-full data-[size=full]:max-w-none', className), onKeyDown: (event) => {
|
|
25
|
+
onKeyDown?.(event);
|
|
26
|
+
handleDialogPrimaryActionKeyDown(event);
|
|
27
|
+
}, ...props, children: [children, showCloseButton && (_jsx(DialogPrimitive.Close, { "data-slot": "dialog-close", "aria-label": "Close", className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground rounded-control focus:outline-hidden absolute right-4 top-4 inline-flex size-7 cursor-pointer items-center justify-center opacity-70 transition-opacity duration-[var(--motion-duration-fast)] hover:opacity-100 focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none disabled:cursor-not-allowed [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0", children: _jsx(XIcon, { "aria-hidden": "true" }) }))] }) })] }));
|
|
24
28
|
}
|
|
25
29
|
function DialogHeader({ className, ...props }) {
|
|
26
30
|
return (_jsx("div", { "data-slot": "dialog-header", className: cn('flex shrink-0 flex-col gap-2 pr-8 text-center sm:text-left', className), ...props }));
|
|
@@ -31,10 +35,13 @@ function DialogBody({ className, ...props }) {
|
|
|
31
35
|
function DialogFooter({ className, showCloseButton = false, children, ...props }) {
|
|
32
36
|
return (_jsxs("div", { "data-slot": "dialog-footer", className: cn('flex shrink-0 flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:justify-end', className), ...props, children: [children, showCloseButton && (_jsx(DialogPrimitive.Close, { asChild: true, children: _jsx(Button, { variant: "outline", children: "Close" }) }))] }));
|
|
33
37
|
}
|
|
38
|
+
function DialogAction({ primary = false, ...props }) {
|
|
39
|
+
return (_jsx(Button, { ...props, "data-slot": "dialog-action", "data-dialog-primary-action": primary || undefined }));
|
|
40
|
+
}
|
|
34
41
|
function DialogTitle({ className, ...props }) {
|
|
35
42
|
return (_jsx(DialogPrimitive.Title, { "data-slot": "dialog-title", className: cn('text-lg font-semibold leading-none', className), ...props }));
|
|
36
43
|
}
|
|
37
44
|
function DialogDescription({ className, ...props }) {
|
|
38
45
|
return (_jsx(DialogPrimitive.Description, { "data-slot": "dialog-description", className: cn('text-muted-foreground text-sm', className), ...props }));
|
|
39
46
|
}
|
|
40
|
-
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogBody, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
47
|
+
export { Dialog, DialogAction, DialogClose, DialogContent, DialogDescription, DialogBody, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
interface ErrorBoundaryViewProps {
|
|
3
|
+
title?: ReactNode;
|
|
4
|
+
message?: ReactNode;
|
|
5
|
+
details?: string;
|
|
6
|
+
onRetry?: () => void;
|
|
7
|
+
actions?: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare function ErrorBoundaryView({ actions, className, details, message, onRetry, title, }: ErrorBoundaryViewProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export { ErrorBoundaryView, type ErrorBoundaryViewProps };
|
|
12
|
+
//# sourceMappingURL=error-boundary-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-boundary-view.d.ts","sourceRoot":"","sources":["../../../src/components/ui/error-boundary-view.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,UAAU,sBAAsB;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,iBAAS,iBAAiB,CAAC,EACzB,OAAO,EACP,SAAS,EACT,OAAO,EACP,OAAO,EACP,OAAO,EACP,KAA8B,GAC/B,EAAE,sBAAsB,2CAwCxB;AAED,OAAO,EAAE,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
import { Button } from './button';
|
|
5
|
+
function ErrorBoundaryView({ actions, className, details, message, onRetry, title = 'Something went wrong', }) {
|
|
6
|
+
return (_jsx("main", { className: cn('bg-background text-foreground flex min-h-full w-full items-center justify-center p-4 sm:p-6', className), children: _jsxs("section", { className: "border-border bg-card w-full max-w-xl rounded-lg border p-5 shadow-lg sm:p-6", children: [_jsxs("div", { className: "space-y-2", children: [_jsx("h1", { className: "text-xl font-semibold tracking-tight", children: title }), message ? (_jsx("p", { className: "text-muted-foreground text-sm leading-6", children: message })) : null] }), details ? (_jsxs("details", { className: "mt-5", children: [_jsx("summary", { className: "text-muted-foreground cursor-pointer text-sm font-medium", children: "Error details" }), _jsx("pre", { className: "bg-muted text-muted-foreground mt-2 max-h-44 overflow-auto whitespace-pre-wrap rounded-md border p-3 font-mono text-xs", children: details })] })) : null, onRetry || actions ? (_jsxs("div", { className: "mt-5 flex flex-col gap-2 sm:flex-row", children: [onRetry ? (_jsx(Button, { type: "button", onClick: onRetry, children: "Retry" })) : null, actions] })) : null] }) }));
|
|
7
|
+
}
|
|
8
|
+
export { ErrorBoundaryView };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/icon-button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/icon-button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,KAAK,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAAA;AASpD,UAAU,eACR,SAAQ,IAAI,CACV,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,EACnC,YAAY,GAAG,SAAS,GAAG,MAAM,CAClC;IACD,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,cAAc,CAAA;IACrB,KAAK,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CAC3B;AAED,iBAAS,UAAU,CAAC,EAClB,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,KAAK,EACL,OAAe,EACf,KAAiB,EACjB,IAAgB,EAChB,OAAO,EACP,IAAe,EACf,GAAG,KAAK,EACT,EAAE,eAAe,2CAgBjB;AAED,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { LoaderCircleIcon } from 'lucide-react';
|
|
4
3
|
import { cn } from '../../lib/utils';
|
|
5
4
|
import { Button } from './button';
|
|
6
5
|
const buttonSizeByIconSize = {
|
|
@@ -10,6 +9,6 @@ const buttonSizeByIconSize = {
|
|
|
10
9
|
lg: 'icon-lg',
|
|
11
10
|
};
|
|
12
11
|
function IconButton({ children, className, disabled, label, loading = false, shape = 'rounded', size = 'default', tooltip, type = 'button', ...props }) {
|
|
13
|
-
return (_jsx(Button, { "data-slot": "icon-button", "
|
|
12
|
+
return (_jsx(Button, { "data-slot": "icon-button", "aria-label": label, title: tooltip === true ? label : tooltip || undefined, type: type, size: buttonSizeByIconSize[size], disabled: disabled, loading: loading, className: cn(shape === 'circle' && 'rounded-full', className), ...props, children: children }));
|
|
14
13
|
}
|
|
15
14
|
export { IconButton };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,SAAS,CAAA;AACvB,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,OAAO,CAAA;AAC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c,UAAU,CAAA;AACxB,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAC1B,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA"}
|
|
@@ -7,7 +7,7 @@ declare const inputGroupAddonVariants: (props?: ({
|
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
declare function InputGroupAddon({ className, align, ...props }: React.ComponentProps<'div'> & VariantProps<typeof inputGroupAddonVariants>): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
declare const inputGroupButtonVariants: (props?: ({
|
|
10
|
-
size?: "
|
|
10
|
+
size?: "sm" | "xs" | "icon-xs" | "icon-sm" | null | undefined;
|
|
11
11
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
12
12
|
declare function InputGroupButton({ className, type, variant, size, ...props }: Omit<React.ComponentProps<typeof Button>, 'size'> & VariantProps<typeof inputGroupButtonVariants>): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
declare function InputGroupText({ className, ...props }: React.ComponentProps<'span'>): import("react/jsx-runtime").JSX.Element;
|