@orcestr/ui 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/README.ru.md +4 -0
- package/dist/components/Alert/Alert.d.ts +5 -4
- package/dist/components/Alert/Alert.d.ts.map +1 -1
- package/dist/components/Alert/Alert.js +5 -2
- package/dist/components/AppShell/AppShell.d.ts +2 -0
- package/dist/components/AppShell/AppShell.d.ts.map +1 -1
- package/dist/components/AppShell/AppShell.js +9 -6
- package/dist/components/AppSidebar/AppSidebar.d.ts +36 -0
- package/dist/components/AppSidebar/AppSidebar.d.ts.map +1 -0
- package/dist/components/AppSidebar/AppSidebar.js +53 -0
- package/dist/components/Badge/Badge.d.ts +8 -6
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Badge/Badge.js +4 -4
- package/dist/components/BadgeSelectMenu/BadgeSelectMenu.d.ts +22 -0
- package/dist/components/BadgeSelectMenu/BadgeSelectMenu.d.ts.map +1 -0
- package/dist/components/BadgeSelectMenu/BadgeSelectMenu.js +50 -0
- package/dist/components/Box/Box.d.ts +2 -0
- package/dist/components/Box/Box.d.ts.map +1 -1
- package/dist/components/Box/Box.js +15 -2
- package/dist/components/Button/Button.d.ts +7 -3
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +23 -3
- package/dist/components/Card/Card.d.ts +26 -0
- package/dist/components/Card/Card.d.ts.map +1 -0
- package/dist/components/Card/Card.js +25 -0
- package/dist/components/Checkbox/Checkbox.d.ts +6 -2
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.js +13 -4
- package/dist/components/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPalette.js +10 -9
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.js +5 -2
- package/dist/components/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +2 -2
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +9 -1
- package/dist/components/Dialog/Dialog.d.ts +69 -1
- package/dist/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.js +48 -1
- package/dist/components/Drawer/Drawer.d.ts.map +1 -1
- package/dist/components/Drawer/Drawer.js +2 -2
- package/dist/components/EntityPicker/EntityPicker.d.ts +2 -1
- package/dist/components/EntityPicker/EntityPicker.d.ts.map +1 -1
- package/dist/components/EntityPicker/EntityPicker.js +2 -2
- package/dist/components/Flex/Flex.d.ts +5 -1
- package/dist/components/Flex/Flex.d.ts.map +1 -1
- package/dist/components/Flex/Flex.js +16 -3
- package/dist/components/Grid/Grid.d.ts +9 -2
- package/dist/components/Grid/Grid.d.ts.map +1 -1
- package/dist/components/Grid/Grid.js +22 -1
- package/dist/components/IconButton/IconButton.d.ts +19 -7
- package/dist/components/IconButton/IconButton.d.ts.map +1 -1
- package/dist/components/IconButton/IconButton.js +40 -5
- package/dist/components/IconTextButton/IconTextButton.d.ts +20 -0
- package/dist/components/IconTextButton/IconTextButton.d.ts.map +1 -0
- package/dist/components/IconTextButton/IconTextButton.js +24 -0
- package/dist/components/InlineEdit/InlineEdit.d.ts +63 -0
- package/dist/components/InlineEdit/InlineEdit.d.ts.map +1 -0
- package/dist/components/InlineEdit/InlineEdit.js +98 -0
- package/dist/components/LinkButton/LinkButton.d.ts +25 -0
- package/dist/components/LinkButton/LinkButton.d.ts.map +1 -0
- package/dist/components/LinkButton/LinkButton.js +12 -0
- package/dist/components/Modal/Modal.d.ts +29 -6
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/Modal.js +37 -13
- package/dist/components/Overlay/OverlayProvider.d.ts +1 -0
- package/dist/components/Overlay/OverlayProvider.d.ts.map +1 -1
- package/dist/components/Overlay/OverlayProvider.js +18 -1
- package/dist/components/PaginatedCombobox/PaginatedCombobox.d.ts +2 -1
- package/dist/components/PaginatedCombobox/PaginatedCombobox.d.ts.map +1 -1
- package/dist/components/PaginatedCombobox/PaginatedCombobox.js +3 -3
- package/dist/components/Popover/Popover.d.ts +37 -3
- package/dist/components/Popover/Popover.d.ts.map +1 -1
- package/dist/components/Popover/Popover.js +56 -9
- package/dist/components/ScrollArea/ScrollArea.d.ts +4 -0
- package/dist/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/components/ScrollArea/ScrollArea.js +30 -4
- package/dist/components/Section/Section.d.ts +2 -0
- package/dist/components/Section/Section.d.ts.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +24 -1
- package/dist/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.js +28 -2
- package/dist/components/Select/Select.d.ts +36 -4
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.js +70 -3
- package/dist/components/Separator/Separator.d.ts +3 -1
- package/dist/components/Separator/Separator.d.ts.map +1 -1
- package/dist/components/Separator/Separator.js +4 -2
- package/dist/components/SpecialModal/SpecialModal.d.ts +43 -0
- package/dist/components/SpecialModal/SpecialModal.d.ts.map +1 -0
- package/dist/components/SpecialModal/SpecialModal.js +34 -0
- package/dist/components/Spinner/Spinner.d.ts +3 -1
- package/dist/components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/components/Spinner/Spinner.js +2 -2
- package/dist/components/State/State.d.ts +8 -1
- package/dist/components/State/State.d.ts.map +1 -1
- package/dist/components/State/State.js +2 -2
- package/dist/components/Switch/Switch.d.ts +2 -0
- package/dist/components/Switch/Switch.d.ts.map +1 -1
- package/dist/components/Switch/Switch.js +2 -1
- package/dist/components/Table/Table.d.ts +64 -0
- package/dist/components/Table/Table.d.ts.map +1 -0
- package/dist/components/Table/Table.js +38 -0
- package/dist/components/Tabs/Tabs.d.ts +33 -2
- package/dist/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.js +189 -4
- package/dist/components/Text/Text.d.ts +13 -3
- package/dist/components/Text/Text.d.ts.map +1 -1
- package/dist/components/Text/Text.js +16 -3
- package/dist/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/components/TextArea/TextArea.js +1 -1
- package/dist/components/TextField/TextField.d.ts.map +1 -1
- package/dist/components/TextField/TextField.js +1 -1
- package/dist/components/Toast/Toast.d.ts +1 -0
- package/dist/components/Toast/Toast.d.ts.map +1 -1
- package/dist/components/Toast/Toast.js +19 -8
- package/dist/components/Tooltip/Tooltip.d.ts +11 -3
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +58 -9
- package/dist/example/CodePreview.d.ts.map +1 -1
- package/dist/example/CodePreview.js +3 -3
- package/dist/example/ExampleActionsSection.d.ts.map +1 -1
- package/dist/example/ExampleActionsSection.js +3 -3
- package/dist/example/ExampleApplicationSection.d.ts +7 -0
- package/dist/example/ExampleApplicationSection.d.ts.map +1 -0
- package/dist/example/ExampleApplicationSection.js +68 -0
- package/dist/example/ExampleBasicsSections.d.ts.map +1 -1
- package/dist/example/ExampleBasicsSections.js +5 -9
- package/dist/example/ExampleDataSection.d.ts.map +1 -1
- package/dist/example/ExampleDataSection.js +31 -30
- package/dist/example/ExampleFieldsSection.d.ts.map +1 -1
- package/dist/example/ExampleFieldsSection.js +51 -3
- package/dist/example/ExampleFoundationsSection.js +1 -1
- package/dist/example/ExampleOverlays.d.ts.map +1 -1
- package/dist/example/ExampleOverlays.js +7 -2
- package/dist/example/ExampleOverlaysSection.d.ts.map +1 -1
- package/dist/example/ExampleOverlaysSection.js +5 -2
- package/dist/example/ExampleSelectionSection.d.ts +3 -1
- package/dist/example/ExampleSelectionSection.d.ts.map +1 -1
- package/dist/example/ExampleSelectionSection.js +10 -3
- package/dist/example/ExampleStateSection.d.ts +3 -0
- package/dist/example/ExampleStateSection.d.ts.map +1 -1
- package/dist/example/ExampleStateSection.js +58 -3
- package/dist/example/ExampleThemePlayground.d.ts +101 -71
- package/dist/example/ExampleThemePlayground.d.ts.map +1 -1
- package/dist/example/ExampleThemePlayground.js +137 -74
- package/dist/example/UiExamplePage.d.ts +7 -1
- package/dist/example/UiExamplePage.d.ts.map +1 -1
- package/dist/example/UiExamplePage.js +72 -27
- package/dist/example/codeSamples.d.ts +7 -0
- package/dist/example/codeSamples.d.ts.map +1 -1
- package/dist/example/codeSamples.js +429 -60
- package/dist/example/exampleData.d.ts.map +1 -1
- package/dist/example/exampleData.js +16 -2
- package/dist/example/styles.css +245 -74
- package/dist/hooks/useFloatingPosition.js +1 -1
- package/dist/hooks/usePresence.d.ts.map +1 -1
- package/dist/hooks/usePresence.js +9 -7
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/styles/orcestr-ui.css +2545 -672
- package/dist/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/theme/ThemeProvider.js +90 -36
- package/dist/theme/defaultTheme.d.ts.map +1 -1
- package/dist/theme/defaultTheme.js +322 -194
- package/dist/theme/systemProps.d.ts +48 -28
- package/dist/theme/systemProps.d.ts.map +1 -1
- package/dist/theme/systemProps.js +103 -1
- package/dist/theme/themeTypes.d.ts +21 -17
- package/dist/theme/themeTypes.d.ts.map +1 -1
- package/dist/utils/slot.d.ts +11 -0
- package/dist/utils/slot.d.ts.map +1 -0
- package/dist/utils/slot.js +18 -0
- package/package.json +2 -2
- package/dist/components/Workflow/Workflow.d.ts +0 -82
- package/dist/components/Workflow/Workflow.d.ts.map +0 -1
- package/dist/components/Workflow/Workflow.js +0 -73
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ButtonProps } from '../Button/Button';
|
|
3
|
+
import { type LinkButtonProps } from '../LinkButton/LinkButton';
|
|
4
|
+
type IconTextButtonOwnProps = {
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
endIcon?: ReactNode;
|
|
7
|
+
iconSide?: 'start' | 'end';
|
|
8
|
+
iconClassName?: string;
|
|
9
|
+
labelClassName?: string;
|
|
10
|
+
};
|
|
11
|
+
type IconTextButtonButtonProps = Omit<ButtonProps, 'leftIcon' | 'rightIcon'> & {
|
|
12
|
+
href?: never;
|
|
13
|
+
};
|
|
14
|
+
type IconTextButtonLinkProps = Omit<LinkButtonProps, 'leftIcon' | 'rightIcon'> & {
|
|
15
|
+
href: string;
|
|
16
|
+
};
|
|
17
|
+
export type IconTextButtonProps = IconTextButtonOwnProps & (IconTextButtonButtonProps | IconTextButtonLinkProps);
|
|
18
|
+
export declare const IconTextButton: import("react").ForwardRefExoticComponent<IconTextButtonProps & import("react").RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=IconTextButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconTextButton.d.ts","sourceRoot":"","sources":["../../../src/components/IconTextButton/IconTextButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAS,KAAK,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAa,KAAK,eAAe,EAAC,MAAM,0BAA0B,CAAC;AAE1E,KAAK,sBAAsB,GAAG;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,KAAK,yBAAyB,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,WAAW,CAAC,GAAG;IAC3E,IAAI,CAAC,EAAE,KAAK,CAAC;CAChB,CAAC;AAEF,KAAK,uBAAuB,GAAG,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,WAAW,CAAC,GAAG;IAC7E,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,sBAAsB,GACpD,CAAC,yBAAyB,GAAG,uBAAuB,CAAC,CAAC;AAO1D,eAAO,MAAM,cAAc,uIAyDzB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { cn } from '../../utils/cn';
|
|
5
|
+
import { Button } from '../Button/Button';
|
|
6
|
+
import { LinkButton } from '../LinkButton/LinkButton';
|
|
7
|
+
function iconNode(icon, className) {
|
|
8
|
+
if (!icon)
|
|
9
|
+
return undefined;
|
|
10
|
+
return _jsx("span", { className: cn('oui-icon-text-button-icon', className), children: icon });
|
|
11
|
+
}
|
|
12
|
+
export const IconTextButton = forwardRef(function IconTextButton({ className, icon, endIcon, iconSide = 'start', iconClassName, labelClassName, children, href, ...props }, ref) {
|
|
13
|
+
const startIcon = iconSide === 'start' ? iconNode(icon, iconClassName) : undefined;
|
|
14
|
+
const finishIcon = endIcon !== undefined
|
|
15
|
+
? iconNode(endIcon, iconClassName)
|
|
16
|
+
: iconSide === 'end'
|
|
17
|
+
? iconNode(icon, iconClassName)
|
|
18
|
+
: undefined;
|
|
19
|
+
const label = (_jsx("span", { className: cn('oui-icon-text-button-label', labelClassName), children: children }));
|
|
20
|
+
if (href !== undefined) {
|
|
21
|
+
return (_jsx(LinkButton, { ref: ref, href: href, className: cn('oui-icon-text-button', className), leftIcon: startIcon, rightIcon: finishIcon, ...props, children: label }));
|
|
22
|
+
}
|
|
23
|
+
return (_jsx(Button, { ref: ref, className: cn('oui-icon-text-button', className), leftIcon: startIcon, rightIcon: finishIcon, ...props, children: label }));
|
|
24
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
import { type SystemProps } from '../../theme/systemProps';
|
|
3
|
+
export type InlineEditFieldProps = SystemProps & {
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
meta?: ReactNode;
|
|
6
|
+
action?: ReactNode;
|
|
7
|
+
editable?: boolean;
|
|
8
|
+
busy?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
clearable?: boolean;
|
|
11
|
+
onClear?: () => void;
|
|
12
|
+
onOpen?: () => void;
|
|
13
|
+
clearLabel?: string;
|
|
14
|
+
flash?: number;
|
|
15
|
+
className?: string;
|
|
16
|
+
style?: CSSProperties;
|
|
17
|
+
testId?: string;
|
|
18
|
+
};
|
|
19
|
+
export declare const InlineEditField: import("react").ForwardRefExoticComponent<SystemProps & {
|
|
20
|
+
label: ReactNode;
|
|
21
|
+
meta?: ReactNode;
|
|
22
|
+
action?: ReactNode;
|
|
23
|
+
editable?: boolean;
|
|
24
|
+
busy?: boolean;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
clearable?: boolean;
|
|
27
|
+
onClear?: () => void;
|
|
28
|
+
onOpen?: () => void;
|
|
29
|
+
clearLabel?: string;
|
|
30
|
+
flash?: number;
|
|
31
|
+
className?: string;
|
|
32
|
+
style?: CSSProperties;
|
|
33
|
+
testId?: string;
|
|
34
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
35
|
+
export type InlineEditMultiFieldProps = SystemProps & {
|
|
36
|
+
children?: ReactNode;
|
|
37
|
+
empty?: ReactNode;
|
|
38
|
+
action?: ReactNode;
|
|
39
|
+
col?: boolean;
|
|
40
|
+
editable?: boolean;
|
|
41
|
+
busy?: boolean;
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
onOpen?: () => void;
|
|
44
|
+
flash?: number;
|
|
45
|
+
className?: string;
|
|
46
|
+
style?: CSSProperties;
|
|
47
|
+
testId?: string;
|
|
48
|
+
};
|
|
49
|
+
export declare const InlineEditMultiField: import("react").ForwardRefExoticComponent<SystemProps & {
|
|
50
|
+
children?: ReactNode;
|
|
51
|
+
empty?: ReactNode;
|
|
52
|
+
action?: ReactNode;
|
|
53
|
+
col?: boolean;
|
|
54
|
+
editable?: boolean;
|
|
55
|
+
busy?: boolean;
|
|
56
|
+
disabled?: boolean;
|
|
57
|
+
onOpen?: () => void;
|
|
58
|
+
flash?: number;
|
|
59
|
+
className?: string;
|
|
60
|
+
style?: CSSProperties;
|
|
61
|
+
testId?: string;
|
|
62
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
63
|
+
//# sourceMappingURL=InlineEdit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlineEdit.d.ts","sourceRoot":"","sources":["../../../src/components/InlineEdit/InlineEdit.tsx"],"names":[],"mappings":"AAEA,OAAO,EAMH,KAAK,aAAa,EAClB,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAKf,OAAO,EAAmB,KAAK,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAI3E,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG;IAC7C,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,eAAe;WAhBjB,SAAS;WACT,SAAS;aACP,SAAS;eACP,OAAO;WACX,OAAO;eACH,OAAO;gBACN,OAAO;cACT,MAAM,IAAI;aACX,MAAM,IAAI;iBACN,MAAM;YACX,MAAM;gBACF,MAAM;YACV,aAAa;aACZ,MAAM;kDA2IlB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,WAAW,GAAG;IAClD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,oBAAoB;eAdlB,SAAS;YACZ,SAAS;aACR,SAAS;UACZ,OAAO;eACF,OAAO;WACX,OAAO;eACH,OAAO;aACT,MAAM,IAAI;YACX,MAAM;gBACF,MAAM;YACV,aAAa;aACZ,MAAM;kDAiFjB,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useEffect, useLayoutEffect, useRef, useState, } from 'react';
|
|
4
|
+
import { LuX } from 'react-icons/lu';
|
|
5
|
+
import { cn } from '../../utils/cn';
|
|
6
|
+
import { composeRefs } from '../../utils/composeRefs';
|
|
7
|
+
import { splitSystemProps } from '../../theme/systemProps';
|
|
8
|
+
import { IconButton } from '../IconButton/IconButton';
|
|
9
|
+
import { Spinner } from '../Spinner/Spinner';
|
|
10
|
+
export const InlineEditField = forwardRef(function InlineEditField({ label, meta, action, editable = true, busy = false, disabled = false, clearable = false, onClear, onOpen, clearLabel = 'Clear', flash = 0, className, style, testId, ...props }, ref) {
|
|
11
|
+
const innerRef = useRef(null);
|
|
12
|
+
const labelRef = useRef(null);
|
|
13
|
+
const extraRef = useRef(null);
|
|
14
|
+
const actionsRef = useRef(null);
|
|
15
|
+
const [compact, setCompact] = useState(false);
|
|
16
|
+
const { systemStyle, restProps } = splitSystemProps(props);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!flash)
|
|
19
|
+
return;
|
|
20
|
+
const element = innerRef.current;
|
|
21
|
+
if (!element)
|
|
22
|
+
return;
|
|
23
|
+
element.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
24
|
+
element.animate([
|
|
25
|
+
{ backgroundColor: 'transparent', boxShadow: '0 0 0 0 var(--oui-primary-surface)' },
|
|
26
|
+
{
|
|
27
|
+
backgroundColor: 'var(--oui-primary-surface)',
|
|
28
|
+
boxShadow: '0 0 0 4px var(--oui-primary-surface)',
|
|
29
|
+
},
|
|
30
|
+
{ backgroundColor: 'transparent', boxShadow: '0 0 0 0 var(--oui-primary-surface)' },
|
|
31
|
+
{
|
|
32
|
+
backgroundColor: 'var(--oui-primary-surface)',
|
|
33
|
+
boxShadow: '0 0 0 4px var(--oui-primary-surface)',
|
|
34
|
+
},
|
|
35
|
+
{ backgroundColor: 'transparent', boxShadow: '0 0 0 0 var(--oui-primary-surface)' },
|
|
36
|
+
], { duration: 1400, easing: 'ease-in-out' });
|
|
37
|
+
}, [flash]);
|
|
38
|
+
const showActions = editable && (!disabled || busy);
|
|
39
|
+
useLayoutEffect(() => {
|
|
40
|
+
const wrapper = innerRef.current;
|
|
41
|
+
if (!wrapper)
|
|
42
|
+
return;
|
|
43
|
+
const updateLayout = () => {
|
|
44
|
+
const availableWidth = wrapper.parentElement?.clientWidth || wrapper.clientWidth;
|
|
45
|
+
const labelWidth = labelRef.current?.scrollWidth ?? 0;
|
|
46
|
+
const extraWidth = extraRef.current?.offsetWidth ?? 0;
|
|
47
|
+
const actionsWidth = actionsRef.current?.offsetWidth ?? 0;
|
|
48
|
+
const visibleGaps = (extraWidth > 0 ? 6 : 0) + (actionsWidth > 0 ? 6 : 0);
|
|
49
|
+
const wideWidth = labelWidth + extraWidth + actionsWidth + visibleGaps + 8;
|
|
50
|
+
setCompact(wideWidth > availableWidth);
|
|
51
|
+
};
|
|
52
|
+
updateLayout();
|
|
53
|
+
const observer = new ResizeObserver(updateLayout);
|
|
54
|
+
observer.observe(wrapper);
|
|
55
|
+
if (wrapper.parentElement)
|
|
56
|
+
observer.observe(wrapper.parentElement);
|
|
57
|
+
if (labelRef.current)
|
|
58
|
+
observer.observe(labelRef.current);
|
|
59
|
+
if (extraRef.current)
|
|
60
|
+
observer.observe(extraRef.current);
|
|
61
|
+
if (actionsRef.current)
|
|
62
|
+
observer.observe(actionsRef.current);
|
|
63
|
+
return () => observer.disconnect();
|
|
64
|
+
}, [label, meta, action, clearable, editable, disabled, busy]);
|
|
65
|
+
return (_jsxs("div", { ref: composeRefs(innerRef, ref), className: cn('oui-inline-edit', compact && 'oui-inline-edit-compact', className), "data-busy": busy ? 'true' : undefined, "data-disabled": disabled ? 'true' : undefined, "data-testid": testId, style: { ...systemStyle, ...style }, ...restProps, children: [_jsx("button", { ref: labelRef, type: 'button', className: 'oui-inline-edit-label', disabled: !onOpen || disabled, onClick: onOpen, children: label }), meta || showActions ? (_jsxs("div", { className: 'oui-inline-edit-meta', children: [meta ? (_jsx("span", { ref: extraRef, className: 'oui-inline-edit-extra', children: meta })) : null, showActions ? (_jsxs("span", { ref: actionsRef, className: 'oui-inline-edit-actions', children: [busy ? _jsx(Spinner, { size: 1 }) : action, clearable && !busy ? (_jsx(IconButton, { type: 'button', v: 'ghost', tone: 'neutral', size: 1, "aria-label": clearLabel, className: 'oui-inline-edit-action', onClick: onClear, children: _jsx(LuX, {}) })) : null] })) : null] })) : null] }));
|
|
66
|
+
});
|
|
67
|
+
export const InlineEditMultiField = forwardRef(function InlineEditMultiField({ children, empty, action, col = false, editable = true, busy = false, disabled = false, onOpen, flash = 0, className, style, testId, ...props }, ref) {
|
|
68
|
+
const innerRef = useRef(null);
|
|
69
|
+
const { systemStyle, restProps } = splitSystemProps(props);
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (!flash)
|
|
72
|
+
return;
|
|
73
|
+
const element = innerRef.current;
|
|
74
|
+
if (!element)
|
|
75
|
+
return;
|
|
76
|
+
element.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
77
|
+
element.animate([
|
|
78
|
+
{ backgroundColor: 'transparent', boxShadow: '0 0 0 0 var(--oui-primary-surface)' },
|
|
79
|
+
{
|
|
80
|
+
backgroundColor: 'var(--oui-primary-surface)',
|
|
81
|
+
boxShadow: '0 0 0 4px var(--oui-primary-surface)',
|
|
82
|
+
},
|
|
83
|
+
{ backgroundColor: 'transparent', boxShadow: '0 0 0 0 var(--oui-primary-surface)' },
|
|
84
|
+
], { duration: 1000, easing: 'ease-in-out' });
|
|
85
|
+
}, [flash]);
|
|
86
|
+
const showActions = editable && (!disabled || busy);
|
|
87
|
+
return (_jsxs("div", { ref: composeRefs(innerRef, ref), className: cn('oui-inline-edit-multi', className), "data-col": col ? 'true' : undefined, "data-busy": busy ? 'true' : undefined, "data-disabled": disabled ? 'true' : undefined, "data-clickable": onOpen && !disabled ? 'true' : undefined, "data-testid": testId, role: onOpen && !disabled ? 'button' : undefined, tabIndex: onOpen && !disabled ? 0 : undefined, style: { ...systemStyle, ...style }, onClick: () => {
|
|
88
|
+
if (!disabled)
|
|
89
|
+
onOpen?.();
|
|
90
|
+
}, onKeyDown: (event) => {
|
|
91
|
+
if (disabled || !onOpen)
|
|
92
|
+
return;
|
|
93
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
onOpen();
|
|
96
|
+
}
|
|
97
|
+
}, ...restProps, children: [_jsx("div", { className: 'oui-inline-edit-multi-items', children: children ?? _jsx("span", { className: 'oui-inline-edit-empty', children: empty }) }), showActions ? (_jsx("div", { className: 'oui-inline-edit-multi-actions', children: busy ? _jsx(Spinner, { size: 1 }) : action })) : null] }));
|
|
98
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type AnchorHTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { type SystemProps, type ToneInput, type UiSize } from '../../theme/systemProps';
|
|
3
|
+
import type { ButtonPressAnimation } from '../../theme/themeTypes';
|
|
4
|
+
import type { ButtonVariant } from '../Button/Button';
|
|
5
|
+
export type LinkButtonProps = AnchorHTMLAttributes<HTMLAnchorElement> & SystemProps & {
|
|
6
|
+
size?: UiSize;
|
|
7
|
+
v?: ButtonVariant;
|
|
8
|
+
tone?: ToneInput;
|
|
9
|
+
fullWidth?: boolean;
|
|
10
|
+
leftIcon?: ReactNode;
|
|
11
|
+
rightIcon?: ReactNode;
|
|
12
|
+
pressAnimation?: ButtonPressAnimation;
|
|
13
|
+
testId?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const LinkButton: import("react").ForwardRefExoticComponent<AnchorHTMLAttributes<HTMLAnchorElement> & SystemProps & {
|
|
16
|
+
size?: UiSize;
|
|
17
|
+
v?: ButtonVariant;
|
|
18
|
+
tone?: ToneInput;
|
|
19
|
+
fullWidth?: boolean;
|
|
20
|
+
leftIcon?: ReactNode;
|
|
21
|
+
rightIcon?: ReactNode;
|
|
22
|
+
pressAnimation?: ButtonPressAnimation;
|
|
23
|
+
testId?: string;
|
|
24
|
+
} & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
25
|
+
//# sourceMappingURL=LinkButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LinkButton.d.ts","sourceRoot":"","sources":["../../../src/components/LinkButton/LinkButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGH,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,EAEH,KAAK,WAAW,EAEhB,KAAK,SAAS,EACd,KAAK,MAAM,EAEd,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAGjE,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAEpD,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GACjE,WAAW,GAAG;IACV,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,CAAC,EAAE,aAAa,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEN,eAAO,MAAM,UAAU;WAVR,MAAM;QACT,aAAa;WACV,SAAS;gBACJ,OAAO;eACR,SAAS;gBACR,SAAS;qBACJ,oBAAoB;aAC5B,MAAM;qDA4CtB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useContext, } from 'react';
|
|
4
|
+
import { splitSystemProps, normalizeTone, } from '../../theme/systemProps';
|
|
5
|
+
import { OrcestrThemeContext } from '../../theme/useTheme';
|
|
6
|
+
import { cn } from '../../utils/cn';
|
|
7
|
+
export const LinkButton = forwardRef(function LinkButton({ className, style, size = 3, v = 'solid', tone = 'neutral', fullWidth = false, leftIcon, rightIcon, pressAnimation, testId, children, ...props }, ref) {
|
|
8
|
+
const themeContext = useContext(OrcestrThemeContext);
|
|
9
|
+
const actualPressAnimation = pressAnimation ?? themeContext?.theme.motion.pressAnimation ?? 'soft';
|
|
10
|
+
const { systemStyle, restProps } = splitSystemProps(props);
|
|
11
|
+
return (_jsxs("a", { ref: ref, className: cn('oui-button', fullWidth && 'oui-button-full', className), "data-size": size, "data-variant": v, "data-tone": normalizeTone(tone), "data-press-animation": actualPressAnimation, "data-testid": testId, style: { ...systemStyle, ...style }, ...restProps, children: [leftIcon, _jsx("span", { className: 'oui-button-label', children: children }), rightIcon] }));
|
|
12
|
+
});
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { type CSSProperties, type ReactNode } from 'react';
|
|
1
|
+
import { type ButtonHTMLAttributes, type CSSProperties, type KeyboardEventHandler, type ReactNode } from 'react';
|
|
2
2
|
import type { ModalAnimation } from '../../theme/themeTypes';
|
|
3
3
|
export type ModalProps = {
|
|
4
4
|
open: boolean;
|
|
5
5
|
onOpenChange: (open: boolean) => void;
|
|
6
|
-
title?: ReactNode;
|
|
7
|
-
description?: ReactNode;
|
|
8
6
|
children: ReactNode;
|
|
9
|
-
footer?: ReactNode;
|
|
10
7
|
maxWidth?: number | string;
|
|
11
8
|
minHeight?: number | string;
|
|
12
9
|
overlayColor?: string;
|
|
@@ -21,9 +18,35 @@ export type ModalProps = {
|
|
|
21
18
|
overlayStyle?: CSSProperties;
|
|
22
19
|
className?: string;
|
|
23
20
|
contentClassName?: string;
|
|
24
|
-
|
|
21
|
+
contentStyle?: CSSProperties;
|
|
22
|
+
onKeyDown?: KeyboardEventHandler<HTMLDivElement>;
|
|
23
|
+
onOpenAutoFocus?: (event: {
|
|
24
|
+
preventDefault: () => void;
|
|
25
|
+
}) => void;
|
|
25
26
|
closeOnOverlayClick?: boolean;
|
|
27
|
+
ariaLabel?: string;
|
|
28
|
+
ariaLabelledBy?: string;
|
|
29
|
+
ariaDescribedBy?: string;
|
|
26
30
|
testId?: string;
|
|
27
31
|
};
|
|
28
|
-
|
|
32
|
+
declare function ModalRoot({ open, onOpenChange, children, maxWidth, minHeight, overlayColor, overlayOpacity, overlayBlur, borderColor, radius, shadow, animationDuration, animation, overlayClassName, overlayStyle, className, contentClassName, contentStyle, onKeyDown, onOpenAutoFocus, closeOnOverlayClick, ariaLabel, ariaLabelledBy, ariaDescribedBy, testId, }: ModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
33
|
+
type ModalPartProps = {
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
className?: string;
|
|
36
|
+
style?: CSSProperties;
|
|
37
|
+
};
|
|
38
|
+
declare function ModalHeader({ children, className, style }: ModalPartProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
declare function ModalBody({ children, className, style }: ModalPartProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
declare function ModalFooter({ children, className, style }: ModalPartProps): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
type ModalCloseProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
42
|
+
asChild?: false;
|
|
43
|
+
};
|
|
44
|
+
declare function ModalClose({ onClick, ...props }: ModalCloseProps): import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export declare const Modal: typeof ModalRoot & {
|
|
46
|
+
Header: typeof ModalHeader;
|
|
47
|
+
Body: typeof ModalBody;
|
|
48
|
+
Footer: typeof ModalFooter;
|
|
49
|
+
Close: typeof ModalClose;
|
|
50
|
+
};
|
|
51
|
+
export {};
|
|
29
52
|
//# sourceMappingURL=Modal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAMH,KAAK,aAAa,EAClB,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAMH,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAKf,OAAO,KAA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,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,cAAc,EACd,WAAW,EACX,WAAW,EACX,MAAM,EACN,MAAM,EACN,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,eAAe,EACf,mBAA0B,EAC1B,SAAS,EACT,cAAc,EACd,eAAe,EACf,MAAM,GACT,EAAE,UAAU,kDA8IZ;AA4DD,KAAK,cAAc,GAAG;IAClB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACzB,CAAC;AAEF,iBAAS,WAAW,CAAC,EAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAC,EAAE,cAAc,2CAMhE;AAED,iBAAS,SAAS,CAAC,EAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAC,EAAE,cAAc,2CAM9D;AAED,iBAAS,WAAW,CAAC,EAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAC,EAAE,cAAc,2CAMhE;AAED,KAAK,eAAe,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IAC7D,OAAO,CAAC,EAAE,KAAK,CAAC;CACnB,CAAC;AAEF,iBAAS,UAAU,CAAC,EAAC,OAAO,EAAE,GAAG,KAAK,EAAC,EAAE,eAAe,2CAYvD;AAED,eAAO,MAAM,KAAK;;;;;CAKhB,CAAC"}
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx
|
|
3
|
-
import { useContext, useEffect,
|
|
4
|
-
import { LuX } from 'react-icons/lu';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useEffect, useLayoutEffect, useRef, } from 'react';
|
|
5
4
|
import { useFocusTrap } from '../../hooks/useFocusTrap';
|
|
6
5
|
import { usePresence } from '../../hooks/usePresence';
|
|
7
|
-
import { useOrcestrUiLocale } from '../../locale/LocaleProvider';
|
|
8
6
|
import { OrcestrThemeContext } from '../../theme/useTheme';
|
|
9
7
|
import { cn } from '../../utils/cn';
|
|
10
|
-
import {
|
|
11
|
-
import { lockOverlayScroll, useOverlayContext, useOverlayLayerIndex, } from '../Overlay/OverlayProvider';
|
|
8
|
+
import { lockOverlayScroll, overlayLayerZIndex, useOverlayContext, useOverlayLayerIndex, } from '../Overlay/OverlayProvider';
|
|
12
9
|
import { Portal } from '../Portal/Portal';
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
const ModalContext = createContext(null);
|
|
11
|
+
function ModalRoot({ open, onOpenChange, children, maxWidth, minHeight, overlayColor, overlayOpacity, overlayBlur, borderColor, radius, shadow, animationDuration, animation, overlayClassName, overlayStyle, className, contentClassName, contentStyle, onKeyDown, onOpenAutoFocus, closeOnOverlayClick = true, ariaLabel, ariaLabelledBy, ariaDescribedBy, testId, }) {
|
|
15
12
|
const themeContext = useContext(OrcestrThemeContext);
|
|
16
13
|
const overlayContext = useOverlayContext();
|
|
17
14
|
const layerRef = useRef(null);
|
|
18
15
|
const contentRef = useRef(null);
|
|
19
|
-
const titleId = useId();
|
|
20
|
-
const descriptionId = useId();
|
|
21
16
|
const actualAnimationDuration = animationDuration ?? themeContext?.theme.motion.modalDuration ?? '380ms';
|
|
22
17
|
const actualAnimation = animation ?? themeContext?.theme.motion.modalAnimation ?? 'zoom-blur';
|
|
23
18
|
const actualMaxWidth = maxWidth ?? themeContext?.theme.components.modalMaxWidth ?? 680;
|
|
@@ -28,7 +23,7 @@ export function Modal({ open, onOpenChange, title, description, children, footer
|
|
|
28
23
|
const actualAnimationEase = themeContext?.theme.motion.ease ?? 'cubic-bezier(0.22, 1, 0.36, 1)';
|
|
29
24
|
const { present, state } = usePresence(open, actualAnimationMs);
|
|
30
25
|
const layerIndex = useOverlayLayerIndex(present);
|
|
31
|
-
const zIndex = overlayContext.zIndex
|
|
26
|
+
const zIndex = overlayLayerZIndex(overlayContext.zIndex, 'modal', layerIndex);
|
|
32
27
|
const overlayBlurValue = cssLength(actualOverlayBlur) ?? '10px';
|
|
33
28
|
const overlayBackdropFilter = `blur(${overlayBlurValue})`;
|
|
34
29
|
const overlayBackground = modalOverlayBackground(actualOverlayColor, actualOverlayOpacity);
|
|
@@ -38,6 +33,11 @@ export function Modal({ open, onOpenChange, title, description, children, footer
|
|
|
38
33
|
return;
|
|
39
34
|
return lockOverlayScroll();
|
|
40
35
|
}, [open]);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (!open || !onOpenAutoFocus)
|
|
38
|
+
return;
|
|
39
|
+
onOpenAutoFocus({ preventDefault: () => undefined });
|
|
40
|
+
}, [onOpenAutoFocus, open]);
|
|
41
41
|
useLayoutEffect(() => {
|
|
42
42
|
const layer = layerRef.current;
|
|
43
43
|
if (!present || !layer || !layer.animate)
|
|
@@ -89,7 +89,7 @@ export function Modal({ open, onOpenChange, title, description, children, footer
|
|
|
89
89
|
if (closeOnOverlayClick)
|
|
90
90
|
onOpenChange(false);
|
|
91
91
|
}
|
|
92
|
-
}, children:
|
|
92
|
+
}, children: _jsx("div", { ref: contentRef, role: 'dialog', "aria-modal": 'true', "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, className: cn('oui-modal-content', contentClassName), "data-state": state, "data-animation": actualAnimation, "data-testid": testId ? `${testId}-content` : undefined, style: {
|
|
93
93
|
width: typeof actualMaxWidth === 'number'
|
|
94
94
|
? `min(calc(100vw - 24px), ${actualMaxWidth}px)`
|
|
95
95
|
: `min(calc(100vw - 24px), ${actualMaxWidth})`,
|
|
@@ -99,7 +99,8 @@ export function Modal({ open, onOpenChange, title, description, children, footer
|
|
|
99
99
|
'--oui-modal-border-color': borderColor,
|
|
100
100
|
'--oui-modal-radius': cssLength(radius),
|
|
101
101
|
'--oui-modal-shadow': shadow,
|
|
102
|
-
|
|
102
|
+
...contentStyle,
|
|
103
|
+
}, onKeyDown: onKeyDown, children: _jsx(ModalContext.Provider, { value: { onOpenChange }, children: children }) }) }) }));
|
|
103
104
|
}
|
|
104
105
|
function cssLength(value) {
|
|
105
106
|
if (value === undefined)
|
|
@@ -153,3 +154,26 @@ function hexToRgb(value) {
|
|
|
153
154
|
}
|
|
154
155
|
return null;
|
|
155
156
|
}
|
|
157
|
+
function ModalHeader({ children, className, style }) {
|
|
158
|
+
return (_jsx("div", { className: cn('oui-modal-header', className), style: style, children: children }));
|
|
159
|
+
}
|
|
160
|
+
function ModalBody({ children, className, style }) {
|
|
161
|
+
return (_jsx("div", { className: cn('oui-modal-body', className), style: style, children: children }));
|
|
162
|
+
}
|
|
163
|
+
function ModalFooter({ children, className, style }) {
|
|
164
|
+
return (_jsx("div", { className: cn('oui-modal-footer', className), style: style, children: children }));
|
|
165
|
+
}
|
|
166
|
+
function ModalClose({ onClick, ...props }) {
|
|
167
|
+
const context = useContext(ModalContext);
|
|
168
|
+
return (_jsx("button", { type: 'button', ...props, onClick: (event) => {
|
|
169
|
+
onClick?.(event);
|
|
170
|
+
if (!event.defaultPrevented)
|
|
171
|
+
context?.onOpenChange(false);
|
|
172
|
+
} }));
|
|
173
|
+
}
|
|
174
|
+
export const Modal = Object.assign(ModalRoot, {
|
|
175
|
+
Header: ModalHeader,
|
|
176
|
+
Body: ModalBody,
|
|
177
|
+
Footer: ModalFooter,
|
|
178
|
+
Close: ModalClose,
|
|
179
|
+
});
|
|
@@ -14,6 +14,7 @@ export type OverlayProviderProps = {
|
|
|
14
14
|
export declare function OverlayProvider({ children, container, zIndex, testId, }: OverlayProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
export declare function useOverlayContext(): OverlayContextValue;
|
|
16
16
|
export declare function useOverlayLayerIndex(active: boolean): number;
|
|
17
|
+
export declare function overlayLayerZIndex(zIndex: OverlayZIndex, kind: OverlayLayerKind, layerIndex: number): number;
|
|
17
18
|
export declare function lockOverlayScroll(): () => void;
|
|
18
19
|
export {};
|
|
19
20
|
//# sourceMappingURL=OverlayProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayProvider.d.ts","sourceRoot":"","sources":["../../../src/components/Overlay/OverlayProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAOH,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAEf,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAE1E,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAE7D,KAAK,mBAAmB,GAAG;IACvB,eAAe,EAAE,WAAW,GAAG,IAAI,CAAC;IACpC,MAAM,EAAE,aAAa,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAC/B,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"OverlayProvider.d.ts","sourceRoot":"","sources":["../../../src/components/Overlay/OverlayProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAOH,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAEf,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAE1E,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAE7D,KAAK,mBAAmB,GAAG;IACvB,eAAe,EAAE,WAAW,GAAG,IAAI,CAAC;IACpC,MAAM,EAAE,aAAa,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAC/B,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAwBF,wBAAgB,eAAe,CAAC,EAC5B,QAAQ,EACR,SAAS,EACT,MAAM,EACN,MAAM,GACT,EAAE,oBAAoB,2CAiCtB;AAED,wBAAgB,iBAAiB,wBAEhC;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,UA4BnD;AAED,wBAAgB,kBAAkB,CAC9B,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,gBAAgB,EACtB,UAAU,EAAE,MAAM,UAQrB;AAKD,wBAAgB,iBAAiB,eAYhC"}
|
|
@@ -7,6 +7,8 @@ const defaultZIndex = {
|
|
|
7
7
|
modal: 1000,
|
|
8
8
|
toast: 2147483000,
|
|
9
9
|
};
|
|
10
|
+
const OVERLAY_LAYER_STEP = 20;
|
|
11
|
+
const DROPDOWN_LAYER_OFFSET = 10;
|
|
10
12
|
const OverlayContext = createContext({
|
|
11
13
|
portalContainer: null,
|
|
12
14
|
zIndex: defaultZIndex,
|
|
@@ -36,6 +38,12 @@ export function useOverlayContext() {
|
|
|
36
38
|
export function useOverlayLayerIndex(active) {
|
|
37
39
|
const [id] = useState(() => Symbol('oui-layer'));
|
|
38
40
|
const [index, setIndex] = useState(0);
|
|
41
|
+
const currentIndex = layerIds.indexOf(id);
|
|
42
|
+
const optimisticIndex = active
|
|
43
|
+
? currentIndex === -1
|
|
44
|
+
? layerIds.length
|
|
45
|
+
: currentIndex
|
|
46
|
+
: index;
|
|
39
47
|
useEffect(() => {
|
|
40
48
|
if (!active)
|
|
41
49
|
return;
|
|
@@ -54,7 +62,16 @@ export function useOverlayLayerIndex(active) {
|
|
|
54
62
|
emitLayerChange();
|
|
55
63
|
};
|
|
56
64
|
}, [active, id]);
|
|
57
|
-
return
|
|
65
|
+
return optimisticIndex;
|
|
66
|
+
}
|
|
67
|
+
export function overlayLayerZIndex(zIndex, kind, layerIndex) {
|
|
68
|
+
if (kind === 'toast')
|
|
69
|
+
return zIndex.toast;
|
|
70
|
+
if (kind === 'dropdown') {
|
|
71
|
+
const base = Math.max(zIndex.dropdown, zIndex.modal, zIndex.overlay);
|
|
72
|
+
return base + layerIndex * OVERLAY_LAYER_STEP + DROPDOWN_LAYER_OFFSET;
|
|
73
|
+
}
|
|
74
|
+
return zIndex[kind] + layerIndex * OVERLAY_LAYER_STEP;
|
|
58
75
|
}
|
|
59
76
|
let scrollLockCount = 0;
|
|
60
77
|
let previousBodyOverflow = '';
|
|
@@ -29,6 +29,7 @@ export type PaginatedComboboxProps<T> = {
|
|
|
29
29
|
disabled?: boolean;
|
|
30
30
|
clearable?: boolean;
|
|
31
31
|
showChevron?: boolean;
|
|
32
|
+
trigger?: ReactNode;
|
|
32
33
|
size?: UiSize;
|
|
33
34
|
maxHeight?: number;
|
|
34
35
|
closeOnSelect?: boolean;
|
|
@@ -44,5 +45,5 @@ export type PaginatedComboboxProps<T> = {
|
|
|
44
45
|
debounceMs?: number;
|
|
45
46
|
testId?: string;
|
|
46
47
|
};
|
|
47
|
-
export declare function PaginatedCombobox<T>({ loadPage, getItemId, renderOption, renderSelectedLabel, value, onChange, placeholder, emptyText, loadingText, errorText, retryLabel, searchPlaceholder, clearLabel, disabled, clearable, showChevron, size, maxHeight, closeOnSelect, isItemSelected, searchAction, optionAction, resetKey, debounceMs, testId, }: PaginatedComboboxProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export declare function PaginatedCombobox<T>({ loadPage, getItemId, renderOption, renderSelectedLabel, value, onChange, placeholder, emptyText, loadingText, errorText, retryLabel, searchPlaceholder, clearLabel, disabled, clearable, showChevron, trigger, size, maxHeight, closeOnSelect, isItemSelected, searchAction, optionAction, resetKey, debounceMs, testId, }: PaginatedComboboxProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
48
49
|
//# sourceMappingURL=PaginatedCombobox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":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,EACR,SAAe,EACf,aAAoB,EACpB,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,UAAgC,EAChC,MAAM,GACT,EAAE,sBAAsB,CAAC,CAAC,CAAC,2CAqX3B"}
|
|
@@ -11,7 +11,7 @@ import { Spinner } from '../Spinner/Spinner';
|
|
|
11
11
|
import { TextField } from '../TextField/TextField';
|
|
12
12
|
import { Tooltip } from '../Tooltip/Tooltip';
|
|
13
13
|
const DEFAULT_DEBOUNCE_MS = 200;
|
|
14
|
-
export function PaginatedCombobox({ loadPage, getItemId, renderOption, renderSelectedLabel, value, onChange, placeholder, emptyText, loadingText, errorText, retryLabel, searchPlaceholder, clearLabel, disabled = false, clearable = false, showChevron = true, size = 3, maxHeight = 280, closeOnSelect = true, isItemSelected, searchAction, optionAction, resetKey, debounceMs = DEFAULT_DEBOUNCE_MS, testId, }) {
|
|
14
|
+
export function PaginatedCombobox({ loadPage, getItemId, renderOption, renderSelectedLabel, value, onChange, placeholder, emptyText, loadingText, errorText, retryLabel, searchPlaceholder, clearLabel, disabled = false, clearable = false, showChevron = true, trigger, size = 3, maxHeight = 280, closeOnSelect = true, isItemSelected, searchAction, optionAction, resetKey, debounceMs = DEFAULT_DEBOUNCE_MS, testId, }) {
|
|
15
15
|
const { copy } = useOrcestrUiLocale();
|
|
16
16
|
const actualPlaceholder = placeholder ?? copy.common.selectValue;
|
|
17
17
|
const actualEmptyText = emptyText ?? copy.common.noOptions;
|
|
@@ -191,14 +191,14 @@ export function PaginatedCombobox({ loadPage, getItemId, renderOption, renderSel
|
|
|
191
191
|
if (!next) {
|
|
192
192
|
navigation.reset();
|
|
193
193
|
}
|
|
194
|
-
}, trigger: _jsx(Button, { type: 'button', v: 'surface', size: size, disabled: disabled, fullWidth: true, pressAnimation: 'none', className: 'oui-combobox-trigger', "data-testid": testId, "data-state": open ? 'open' : 'closed', onKeyDown: handleKeyDown, rightIcon: _jsxs("span", { className: 'oui-combobox-trigger-actions', children: [canClear ? (_jsx("span", { "aria-label": clearLabel ?? copy.common.clear, className: 'oui-combobox-clear', onPointerDown: (event) => {
|
|
194
|
+
}, trigger: trigger ?? (_jsx(Button, { type: 'button', v: 'surface', size: size, disabled: disabled, fullWidth: true, pressAnimation: 'none', className: 'oui-combobox-trigger', "data-testid": testId, "data-state": open ? 'open' : 'closed', onKeyDown: handleKeyDown, rightIcon: _jsxs("span", { className: 'oui-combobox-trigger-actions', children: [canClear ? (_jsx("span", { "aria-label": clearLabel ?? copy.common.clear, className: 'oui-combobox-clear', onPointerDown: (event) => {
|
|
195
195
|
event.preventDefault();
|
|
196
196
|
event.stopPropagation();
|
|
197
197
|
}, onClick: (event) => {
|
|
198
198
|
event.preventDefault();
|
|
199
199
|
event.stopPropagation();
|
|
200
200
|
clear();
|
|
201
|
-
}, children: _jsx(LuX, { size: 14 }) })) : null, showChevron ? _jsx(LuChevronsUpDown, { size: 15 }) : null] }), children: _jsx("span", { className: triggerLabel ? 'oui-combobox-trigger-label' : 'oui-combobox-placeholder', children: triggerLabel ?? actualPlaceholder }) }), className: 'oui-combobox-content', align: 'start', sideOffset: 4, matchTriggerWidth: true, disabled: disabled, children: [_jsxs("div", { className: 'oui-combobox-search-wrap', children: [_jsx(TextField, { autoFocus: true, size: 2, placeholder: actualSearchPlaceholder, value: searchInput, onChange: (event) => setSearchInput(event.target.value), onKeyDown: handleKeyDown }), searchAction ? (_jsx(Tooltip, { content: actualSearchActionLabel, children: _jsx(IconButton, { size: 2, v: 'soft', icon: _jsx(LuPlus, { size: 14 }), className: 'oui-combobox-search-action', "aria-label": actualSearchActionLabel, disabled: searchAction.disabled, onClick: () => {
|
|
201
|
+
}, children: _jsx(LuX, { size: 14 }) })) : null, showChevron ? _jsx(LuChevronsUpDown, { size: 15 }) : null] }), children: _jsx("span", { className: triggerLabel ? 'oui-combobox-trigger-label' : 'oui-combobox-placeholder', children: triggerLabel ?? actualPlaceholder }) })), className: 'oui-combobox-content', align: 'start', sideOffset: 4, matchTriggerWidth: true, disabled: disabled, children: [_jsxs("div", { className: 'oui-combobox-search-wrap', children: [_jsx(TextField, { autoFocus: true, size: 2, placeholder: actualSearchPlaceholder, value: searchInput, onChange: (event) => setSearchInput(event.target.value), onKeyDown: handleKeyDown }), searchAction ? (_jsx(Tooltip, { content: actualSearchActionLabel, children: _jsx(IconButton, { size: 2, v: 'soft', icon: _jsx(LuPlus, { size: 14 }), className: 'oui-combobox-search-action', "aria-label": actualSearchActionLabel, disabled: searchAction.disabled, onClick: () => {
|
|
202
202
|
setOpen(false);
|
|
203
203
|
searchAction.onClick(searchInput);
|
|
204
204
|
} }) })) : null] }), _jsx("div", { ref: scrollRef, className: 'oui-combobox-scroll', style: { maxHeight }, tabIndex: -1, onKeyDown: handleKeyDown, children: isInitialLoading ? (_jsxs("div", { className: 'oui-combobox-state', children: [_jsx(Spinner, {}), _jsx("span", { className: 'oui-visually-hidden', children: actualLoadingText })] })) : error ? (_jsxs("div", { className: 'oui-combobox-state', children: [_jsx("span", { children: actualErrorText }), _jsx(Button, { size: 1, v: 'surface', onClick: () => void fetchPage(1, debouncedSearch), children: actualRetryLabel })] })) : items.length === 0 ? (_jsx("div", { className: 'oui-combobox-empty', children: actualEmptyText })) : (_jsxs("div", { className: 'oui-combobox-options', children: [items.map((item) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
1
|
+
import { type CSSProperties, type HTMLAttributes, type ReactNode, type Ref } from 'react';
|
|
2
2
|
import { type FloatingAlign, type FloatingSide } from '../../hooks/useFloatingPosition';
|
|
3
|
-
|
|
3
|
+
import { type SystemProps } from '../../theme/systemProps';
|
|
4
|
+
export type PopoverProps = SystemProps & Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
4
5
|
trigger: ReactNode;
|
|
5
6
|
children: ReactNode;
|
|
6
7
|
open?: boolean;
|
|
@@ -13,7 +14,40 @@ export type PopoverProps = {
|
|
|
13
14
|
matchTriggerWidth?: boolean;
|
|
14
15
|
disabled?: boolean;
|
|
15
16
|
className?: string;
|
|
17
|
+
contentStyle?: CSSProperties;
|
|
18
|
+
contentRef?: Ref<HTMLDivElement>;
|
|
19
|
+
onOpenAutoFocus?: (event: {
|
|
20
|
+
preventDefault: () => void;
|
|
21
|
+
}) => void;
|
|
22
|
+
onInteractOutside?: (event: Event) => void;
|
|
16
23
|
testId?: string;
|
|
17
24
|
};
|
|
18
|
-
export declare function Popover({ trigger, children, open, defaultOpen, onOpenChange, side, align, sideOffset, collisionPadding, matchTriggerWidth, disabled, className, testId, }: PopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare function Popover({ trigger, children, open, defaultOpen, onOpenChange, side, align, sideOffset, collisionPadding, matchTriggerWidth, disabled, className, contentStyle, contentRef: externalContentRef, style: contentStyleProp, onOpenAutoFocus, onInteractOutside, testId, ...props }: PopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
type PopoverRootProps = Pick<PopoverProps, 'open' | 'defaultOpen' | 'onOpenChange'> & {
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
};
|
|
29
|
+
type PopoverTriggerProps = {
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
};
|
|
32
|
+
declare function PopoverRoot({ children, ...props }: PopoverRootProps): import("react/jsx-runtime").JSX.Element | null;
|
|
33
|
+
declare function PopoverTrigger(_props: PopoverTriggerProps): null;
|
|
34
|
+
export declare namespace Popover {
|
|
35
|
+
const Root: typeof PopoverRoot;
|
|
36
|
+
const Trigger: typeof PopoverTrigger;
|
|
37
|
+
const Content: import("react").ForwardRefExoticComponent<SystemProps & Omit<HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
width?: number | string;
|
|
40
|
+
size?: number | string;
|
|
41
|
+
align?: FloatingAlign;
|
|
42
|
+
side?: FloatingSide;
|
|
43
|
+
sideOffset?: number;
|
|
44
|
+
matchTriggerWidth?: boolean;
|
|
45
|
+
className?: string;
|
|
46
|
+
onOpenAutoFocus?: (event: {
|
|
47
|
+
preventDefault: () => void;
|
|
48
|
+
}) => void;
|
|
49
|
+
onInteractOutside?: (event: Event) => void;
|
|
50
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
19
53
|
//# sourceMappingURL=Popover.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":"AAEA,OAAO,EAWH,KAAK,aAAa,EAClB,KAAK,cAAc,EAEnB,KAAK,SAAS,EACd,KAAK,GAAG,EACX,MAAM,OAAO,CAAC;AAGf,OAAO,EAAC,KAAK,aAAa,EAAE,KAAK,YAAY,EAAC,MAAM,iCAAiC,CAAC;AAGtF,OAAO,EAAmB,KAAK,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAqB3E,MAAM,MAAM,YAAY,GAAG,WAAW,GAClC,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,GAAG;IACnD,OAAO,EAAE,SAAS,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,Y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