@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
|
|
4
|
-
import { LuX } from 'react-icons/lu';
|
|
4
|
+
import { LuCircleAlert, LuCircleCheck, LuCircleX, LuInfo, LuX } from 'react-icons/lu';
|
|
5
5
|
import { useOrcestrUiLocale } from '../../locale/LocaleProvider';
|
|
6
6
|
import { Button } from '../Button/Button';
|
|
7
7
|
import { IconButton } from '../IconButton/IconButton';
|
|
@@ -148,6 +148,7 @@ function ToastCard({ item, onDismiss, onExited, testId, }) {
|
|
|
148
148
|
const { copy } = useOrcestrUiLocale();
|
|
149
149
|
const duration = toastDuration(item);
|
|
150
150
|
const hasProgress = item.duration !== null && duration > 0;
|
|
151
|
+
const icon = item.icon === false ? null : item.icon ?? toastIcon(item.tone);
|
|
151
152
|
const effectiveBlur = item.blur !== undefined ? cssLength(item.blur) : 'var(--oui-toast-blur, 14px)';
|
|
152
153
|
const style = {
|
|
153
154
|
...(item.background ? { '--oui-toast-bg': item.background } : null),
|
|
@@ -167,13 +168,13 @@ function ToastCard({ item, onDismiss, onExited, testId, }) {
|
|
|
167
168
|
}, children: [_jsx("span", { className: 'oui-toast-backdrop', "aria-hidden": 'true', style: blurStyle }), _jsxs("div", { className: 'oui-toast', "data-tone": item.tone, "data-state": item.state, "data-position": item.position, "data-clickable": item.dismissible === false ? undefined : 'true', "data-testid": testId, role: item.tone === 'danger' ? 'alert' : 'status', style: blurStyle, onClick: () => {
|
|
168
169
|
if (item.dismissible !== false)
|
|
169
170
|
onDismiss(item.id);
|
|
170
|
-
}, children: [_jsxs("div", { className: 'oui-toast-main', children: [_jsx("div", { className: 'oui-toast-title', children: item.title }), item.message ? (_jsx("div", { className: 'oui-toast-message', children: item.message })) : null, item.action ? (_jsx(Button, { className: 'oui-toast-action', size: 1, v: 'surface', tone: item.tone, onClick: (event) => {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
171
|
+
}, children: [_jsxs("div", { className: 'oui-toast-content', children: [icon ? (_jsx("span", { className: 'oui-toast-icon', "data-tone": item.tone, children: icon })) : null, _jsxs("div", { className: 'oui-toast-main', children: [_jsx("div", { className: 'oui-toast-title', children: item.title }), item.message ? (_jsx("div", { className: 'oui-toast-message', children: item.message })) : null, item.action ? (_jsx(Button, { className: 'oui-toast-action', size: 1, v: 'surface', tone: item.tone, onClick: (event) => {
|
|
172
|
+
event.stopPropagation();
|
|
173
|
+
item.action?.onClick();
|
|
174
|
+
if (item.action?.closeOnClick !== false) {
|
|
175
|
+
onDismiss(item.id);
|
|
176
|
+
}
|
|
177
|
+
}, children: item.action.label })) : null] })] }), item.closeButton ? (_jsx(IconButton, { className: 'oui-toast-close', size: 1, v: 'ghost', icon: _jsx(LuX, { size: 14 }), "aria-label": copy.common.dismissNotification, onClick: (event) => {
|
|
177
178
|
event.stopPropagation();
|
|
178
179
|
onDismiss(item.id);
|
|
179
180
|
} })) : null, hasProgress ? (_jsx("span", { className: 'oui-toast-progress', style: { '--oui-toast-duration': `${duration}ms` } }, item.createdAt)) : null] })] }));
|
|
@@ -186,6 +187,16 @@ function cssLength(value) {
|
|
|
186
187
|
function toastDuration(item) {
|
|
187
188
|
return item.duration ?? DEFAULT_TOAST_DURATION;
|
|
188
189
|
}
|
|
190
|
+
function toastIcon(tone) {
|
|
191
|
+
const size = 26;
|
|
192
|
+
if (tone === 'success')
|
|
193
|
+
return _jsx(LuCircleCheck, { size: size });
|
|
194
|
+
if (tone === 'warning')
|
|
195
|
+
return _jsx(LuCircleAlert, { size: size });
|
|
196
|
+
if (tone === 'danger')
|
|
197
|
+
return _jsx(LuCircleX, { size: size });
|
|
198
|
+
return _jsx(LuInfo, { size: size });
|
|
199
|
+
}
|
|
189
200
|
function limitToastItems(items, maxVisible) {
|
|
190
201
|
if (maxVisible <= 0)
|
|
191
202
|
return items;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import { type FloatingSide } from '../../hooks/useFloatingPosition';
|
|
3
|
-
export
|
|
2
|
+
import { type FloatingAlign, type FloatingSide } from '../../hooks/useFloatingPosition';
|
|
3
|
+
export type TooltipProps = {
|
|
4
4
|
content: ReactNode;
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
side?: FloatingSide;
|
|
7
|
+
align?: FloatingAlign;
|
|
8
|
+
sideOffset?: number;
|
|
9
|
+
avoidCollisions?: boolean;
|
|
10
|
+
collisionPadding?: number;
|
|
11
|
+
open?: boolean;
|
|
12
|
+
defaultOpen?: boolean;
|
|
13
|
+
onOpenChange?: (open: boolean) => void;
|
|
7
14
|
className?: string;
|
|
8
15
|
testId?: string;
|
|
9
|
-
}
|
|
16
|
+
};
|
|
17
|
+
export declare const Tooltip: import("react").ForwardRefExoticComponent<TooltipProps & import("react").RefAttributes<HTMLElement>>;
|
|
10
18
|
//# sourceMappingURL=Tooltip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,EAQH,KAAK,SAAS,EAEjB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAC,KAAK,aAAa,EAAE,KAAK,YAAY,EAAC,MAAM,iCAAiC,CAAC;AAqBtF,MAAM,MAAM,YAAY,GAAG;IACvB,OAAO,EAAE,SAAS,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,OAAO,sGA0FlB,CAAC"}
|
|
@@ -1,24 +1,73 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from 'react';
|
|
3
|
+
import { cloneElement, forwardRef, isValidElement, useState, } from 'react';
|
|
4
4
|
import {} from '../../hooks/useFloatingPosition';
|
|
5
5
|
import { useFloatingLayer } from '../../hooks/useFloatingLayer';
|
|
6
|
+
import { composeRefs } from '../../utils/composeRefs';
|
|
6
7
|
import { cn } from '../../utils/cn';
|
|
7
|
-
import { useOverlayContext, useOverlayLayerIndex } from '../Overlay/OverlayProvider';
|
|
8
|
+
import { overlayLayerZIndex, useOverlayContext, useOverlayLayerIndex, } from '../Overlay/OverlayProvider';
|
|
8
9
|
import { Portal } from '../Portal/Portal';
|
|
9
|
-
export function Tooltip({ content, children, side = 'top', className, testId, }) {
|
|
10
|
+
export const Tooltip = forwardRef(function Tooltip({ content, children, side = 'top', align = 'center', sideOffset = 8, avoidCollisions: _avoidCollisions, collisionPadding: _collisionPadding, open, defaultOpen = false, onOpenChange, className, testId, }, ref) {
|
|
10
11
|
const overlay = useOverlayContext();
|
|
11
|
-
const [
|
|
12
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
13
|
+
const actualOpen = open ?? internalOpen;
|
|
14
|
+
const setOpen = (nextOpen) => {
|
|
15
|
+
if (open === undefined)
|
|
16
|
+
setInternalOpen(nextOpen);
|
|
17
|
+
onOpenChange?.(nextOpen);
|
|
18
|
+
};
|
|
12
19
|
const { triggerRef, contentRef, present, state, style, } = useFloatingLayer({
|
|
13
|
-
open,
|
|
20
|
+
open: actualOpen,
|
|
14
21
|
presenceDuration: 140,
|
|
15
22
|
side,
|
|
16
|
-
align
|
|
17
|
-
sideOffset
|
|
23
|
+
align,
|
|
24
|
+
sideOffset,
|
|
18
25
|
});
|
|
19
26
|
const layerIndex = useOverlayLayerIndex(present);
|
|
20
|
-
|
|
27
|
+
const triggerHandlers = {
|
|
28
|
+
onMouseEnter: () => setOpen(true),
|
|
29
|
+
onMouseLeave: () => setOpen(false),
|
|
30
|
+
onFocus: (event) => {
|
|
31
|
+
if (isKeyboardFocus(event.currentTarget))
|
|
32
|
+
setOpen(true);
|
|
33
|
+
},
|
|
34
|
+
onBlur: () => setOpen(false),
|
|
35
|
+
};
|
|
36
|
+
const trigger = isValidElement(children)
|
|
37
|
+
? cloneTooltipTrigger(children, {
|
|
38
|
+
ref: composeRefs(triggerRef, ref),
|
|
39
|
+
testId,
|
|
40
|
+
...triggerHandlers,
|
|
41
|
+
})
|
|
42
|
+
: (_jsx("span", { ref: composeRefs(triggerRef, ref), className: 'oui-tooltip-trigger', "data-testid": testId, ...triggerHandlers, children: children }));
|
|
43
|
+
return (_jsxs(_Fragment, { children: [trigger, present ? (_jsx(Portal, { children: _jsx("div", { ref: contentRef, role: 'tooltip', className: cn('oui-tooltip-content', className), "data-state": state, "data-layer": 'dropdown', "data-testid": testId ? `${testId}-content` : undefined, style: {
|
|
21
44
|
...style,
|
|
22
|
-
zIndex: overlay.zIndex
|
|
45
|
+
zIndex: overlayLayerZIndex(overlay.zIndex, 'dropdown', layerIndex),
|
|
23
46
|
}, children: content }) })) : null] }));
|
|
47
|
+
});
|
|
48
|
+
function cloneTooltipTrigger(trigger, { ref, testId, onMouseEnter, onMouseLeave, onFocus, onBlur, }) {
|
|
49
|
+
return cloneElement(trigger, {
|
|
50
|
+
ref: composeRefs(trigger.props.ref, ref),
|
|
51
|
+
className: cn('oui-tooltip-trigger', trigger.props.className),
|
|
52
|
+
'data-testid': testId,
|
|
53
|
+
onMouseEnter: (event) => {
|
|
54
|
+
trigger.props.onMouseEnter?.(event);
|
|
55
|
+
onMouseEnter?.(event);
|
|
56
|
+
},
|
|
57
|
+
onMouseLeave: (event) => {
|
|
58
|
+
trigger.props.onMouseLeave?.(event);
|
|
59
|
+
onMouseLeave?.(event);
|
|
60
|
+
},
|
|
61
|
+
onFocus: (event) => {
|
|
62
|
+
trigger.props.onFocus?.(event);
|
|
63
|
+
onFocus?.(event);
|
|
64
|
+
},
|
|
65
|
+
onBlur: (event) => {
|
|
66
|
+
trigger.props.onBlur?.(event);
|
|
67
|
+
onBlur?.(event);
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function isKeyboardFocus(element) {
|
|
72
|
+
return element.matches(':focus-visible');
|
|
24
73
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodePreview.d.ts","sourceRoot":"","sources":["../../src/example/CodePreview.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKH,KAAK,SAAS,EAEjB,MAAM,OAAO,CAAC;AAKf,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,eAAe,CAAC;AA+B/C,wBAAgB,cAAc,CAAC,EAC3B,KAAK,EACL,IAAI,EACJ,MAAM,GACT,EAAE,WAAW,GAAG;IACb,MAAM,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC1C,2CAYA;AAED,wBAAgB,iBAAiB,CAAC,EAC9B,KAAK,EACL,IAAI,EACJ,MAAM,GACT,EAAE,WAAW,GAAG;IACb,MAAM,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC1C,2CAMA;AAED,wBAAgB,WAAW,CAAC,EACxB,EAAE,EACF,KAAK,EACL,IAAI,EACJ,MAAM,EACN,SAAS,EACT,QAAQ,GACX,EAAE,WAAW,GAAG;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACvB,2CAUA;AAED,wBAAgB,eAAe,CAAC,EAAC,IAAI,EAAC,EAAE;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,2CA+DrD;AAQD,wBAAgB,SAAS,CAAC,EAAC,IAAI,EAAC,EAAE;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,2CAQ/C;AAED,wBAAgB,gBAAgB,CAAC,EAC7B,OAAO,EACP,OAAO,GACV,EAAE;IACC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB,
|
|
1
|
+
{"version":3,"file":"CodePreview.d.ts","sourceRoot":"","sources":["../../src/example/CodePreview.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKH,KAAK,SAAS,EAEjB,MAAM,OAAO,CAAC;AAKf,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,eAAe,CAAC;AA+B/C,wBAAgB,cAAc,CAAC,EAC3B,KAAK,EACL,IAAI,EACJ,MAAM,GACT,EAAE,WAAW,GAAG;IACb,MAAM,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC1C,2CAYA;AAED,wBAAgB,iBAAiB,CAAC,EAC9B,KAAK,EACL,IAAI,EACJ,MAAM,GACT,EAAE,WAAW,GAAG;IACb,MAAM,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC1C,2CAMA;AAED,wBAAgB,WAAW,CAAC,EACxB,EAAE,EACF,KAAK,EACL,IAAI,EACJ,MAAM,EACN,SAAS,EACT,QAAQ,GACX,EAAE,WAAW,GAAG;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACvB,2CAUA;AAED,wBAAgB,eAAe,CAAC,EAAC,IAAI,EAAC,EAAE;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,2CA+DrD;AAQD,wBAAgB,SAAS,CAAC,EAAC,IAAI,EAAC,EAAE;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,2CAQ/C;AAED,wBAAgB,gBAAgB,CAAC,EAC7B,OAAO,EACP,OAAO,GACV,EAAE;IACC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB,2CA8BA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useLayoutEffect, useRef, useState, } from 'react';
|
|
4
|
-
import { LuInfo } from 'react-icons/lu';
|
|
4
|
+
import { LuInfo, LuX } from 'react-icons/lu';
|
|
5
5
|
import { Flex, IconButton, Modal, ScrollArea } from '..';
|
|
6
6
|
import { cn } from '../utils/cn';
|
|
7
7
|
import {} from './codeSamples';
|
|
@@ -86,8 +86,8 @@ export function CodeBlock({ code }) {
|
|
|
86
86
|
return (_jsx(ScrollArea, { className: 'oui-code-preview-scroll', children: _jsx("pre", { className: 'oui-code-preview', children: _jsx("code", { children: highlightedCode(code) }) }) }));
|
|
87
87
|
}
|
|
88
88
|
export function CodePreviewModal({ example, onClose, }) {
|
|
89
|
-
return (
|
|
89
|
+
return (_jsxs(Modal, { open: example !== null, onOpenChange: (open) => {
|
|
90
90
|
if (!open)
|
|
91
91
|
onClose();
|
|
92
|
-
}, title: example?.title ?? 'Component code', description:
|
|
92
|
+
}, maxWidth: 760, children: [_jsxs(Modal.Header, { children: [_jsxs("div", { className: 'oui-modal-title-wrap', children: [_jsx("h2", { className: 'oui-modal-title', children: example?.title ?? 'Component code' }), _jsx("p", { className: 'oui-modal-description', children: "Import and usage example." })] }), _jsx(IconButton, { v: 'ghost', icon: _jsx(LuX, { size: 18 }), "aria-label": 'Close', onClick: onClose })] }), _jsx(Modal.Body, { children: example ? _jsx(CodeBlock, { code: example.code }) : null })] }));
|
|
93
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleActionsSection.d.ts","sourceRoot":"","sources":["../../src/example/ExampleActionsSection.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExampleActionsSection.d.ts","sourceRoot":"","sources":["../../src/example/ExampleActionsSection.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAUH,KAAK,QAAQ,EAChB,MAAM,IAAI,CAAC;AAEZ,OAAO,EAAc,KAAK,WAAW,EAAC,MAAM,eAAe,CAAC;AAG5D,KAAK,mBAAmB,GAAG;IACvB,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACnC,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAC3C,aAAa,EAAE,MAAM,IAAI,CAAC;CAC7B,CAAC;AAEF,wBAAgB,cAAc,CAAC,EAC3B,SAAS,EACT,UAAU,EACV,aAAa,GAChB,EAAE,mBAAmB,2CA6KrB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { LuBell, LuCheck, LuCommand, LuEllipsis, LuInfo, LuTrash2, LuTriangleAlert, } from 'react-icons/lu';
|
|
4
|
-
import { Button, Flex, IconButton, Menu, Spinner, Tooltip } from '..';
|
|
3
|
+
import { LuBell, LuCheck, LuCommand, LuCopy, LuDownload, LuEllipsis, LuExternalLink, LuInfo, LuMessageSquare, LuPackagePlus, LuRefreshCw, LuSearch, LuSettings, LuShield, LuTrash2, LuTriangleAlert, LuUpload, } from 'react-icons/lu';
|
|
4
|
+
import { Button, ContextMenu, Flex, IconButton, IconTextButton, Menu, Spinner, Text, Tooltip, } from '..';
|
|
5
5
|
import { ExampleTile } from './CodePreview';
|
|
6
6
|
import { codeSamples } from './codeSamples';
|
|
7
7
|
import { UiExampleSection } from './UiExampleSection';
|
|
8
8
|
export function ActionsSection({ menuItems, onOpenCode, onOpenPalette, }) {
|
|
9
|
-
return (_jsxs(_Fragment, { children: [_jsx(UiExampleSection, { id: 'buttons-example', title: 'Buttons', description: 'Button variants, tones, sizes, loading states and press animation.', children: _jsxs(ExampleTile, { title: 'Buttons', code: codeSamples.buttons, onOpen: onOpenCode, children: [_jsxs("div", { className: 'oui-ui-row', children: [_jsx(Button, { size: 3, children: "Solid" }), _jsx(Button, { size: 3, v: 'soft', children: "Soft" }), _jsx(Button, { size: 3, v: 'surface', children: "Surface" }), _jsx(Button, { size: 3, v: 'pad', children: "Pad" }), _jsx(Button, { size: 3, v: 'outline', children: "Outline" }), _jsx(Button, { size: 3, v: 'ghost', children: "Ghost" })] }), _jsxs("div", { className: 'oui-ui-row', children: [_jsx(Button, { size: 3, tone: 'success', leftIcon: _jsx(LuCheck, { size: 16 }), children: "Success" }), _jsx(Button, { size: 3, tone: 'warning', v: 'soft', leftIcon: _jsx(LuTriangleAlert, { size: 16 }), children: "Warning" }), _jsx(Button, { size: 3, tone: 'info', v: 'soft', leftIcon: _jsx(LuInfo, { size: 16 }), children: "Info" }), _jsx(Button, { size: 3, tone: 'danger', v: 'soft', leftIcon: _jsx(LuTrash2, { size: 16 }), children: "Delete" }), _jsx(Button, { size: 3, loading: true, children: "Loading" }), _jsx(Button, { size: 3, v: 'surface', loading: true, leftIcon: _jsx(LuCheck, { size: 16 }), children: "Save" }), _jsx(Button, { size: 3, tone: 'success', loading: true, leftIcon: _jsx(LuCheck, { size: 16 }), children: "Success" }), _jsx(Spinner, {})] }), _jsxs("div", { className: 'oui-ui-row', children: [_jsx(Button, { size: 1, v: 'surface', children: "Size 1" }), _jsx(Button, { size: 2, v: 'surface', children: "Size 2" }), _jsx(Button, { size: 3, v: 'surface', children: "Size 3" }), _jsx(Button, { size: 4, v: 'surface', children: "Size 4" })] }), _jsxs("div", { className: 'oui-ui-row', children: [_jsx(Button, { size: 1, children: "Solid 1" }), _jsx(Button, { size: 2, v: 'soft', children: "Soft 2" }), _jsx(Button, { size: 3, v: 'surface', children: "Surface 3" }), _jsx(Button, { size: 3, v: 'pad', children: "Pad 3" }), _jsx(Button, { size: 4, v: 'outline', children: "Outline 4" }), _jsx(Button, { size: 2, v: 'ghost', children: "Ghost 2" })] }), _jsxs("div", { className: 'oui-ui-row', children: [_jsx(Button, { v: 'surface', pressAnimation: 'translate', children: "Press translate" }), _jsx(Button, { v: 'surface', pressAnimation: 'scale', children: "Press scale" }), _jsx(Button, { v: 'surface', pressAnimation: 'soft', children: "Press soft" }), _jsx(Button, { v: 'surface', pressAnimation: 'none', children: "Press none" })] })] }) }), _jsx(UiExampleSection, { id: 'icon-buttons-example', title: 'Icon buttons', description: 'Icon-only actions, loading state, menu trigger and command entry.', children: _jsxs(ExampleTile, { title: 'Icon buttons', code: codeSamples.iconButtons, onOpen: onOpenCode, children: [_jsxs(Flex, { g: 2, a: 'c', wrap: true, children: [_jsx(IconButton, { v: 'solid', icon: _jsx(LuCheck, { size: 17 }), "aria-label": 'Solid icon' }), _jsx(IconButton, { v: 'soft', icon: _jsx(
|
|
9
|
+
return (_jsxs(_Fragment, { children: [_jsx(UiExampleSection, { id: 'buttons-example', title: 'Buttons', description: 'Button variants, tones, sizes, loading states and press animation.', children: _jsxs(ExampleTile, { title: 'Buttons', code: codeSamples.buttons, onOpen: onOpenCode, children: [_jsxs("div", { className: 'oui-ui-row', children: [_jsx(Button, { size: 3, children: "Solid" }), _jsx(Button, { size: 3, v: 'soft', children: "Soft" }), _jsx(Button, { size: 3, v: 'surface', children: "Surface" }), _jsx(Button, { size: 3, v: 'pad', children: "Pad" }), _jsx(Button, { size: 3, v: 'outline', children: "Outline" }), _jsx(Button, { size: 3, v: 'ghost', children: "Ghost" })] }), _jsxs("div", { className: 'oui-ui-row', children: [_jsx(Button, { size: 3, tone: 'success', leftIcon: _jsx(LuCheck, { size: 16 }), children: "Success" }), _jsx(Button, { size: 3, tone: 'warning', v: 'soft', leftIcon: _jsx(LuTriangleAlert, { size: 16 }), children: "Warning" }), _jsx(Button, { size: 3, tone: 'info', v: 'soft', leftIcon: _jsx(LuInfo, { size: 16 }), children: "Info" }), _jsx(Button, { size: 3, tone: 'danger', v: 'soft', leftIcon: _jsx(LuTrash2, { size: 16 }), children: "Delete" }), _jsx(Button, { size: 3, loading: true, children: "Loading" }), _jsx(Button, { size: 3, v: 'surface', loading: true, leftIcon: _jsx(LuCheck, { size: 16 }), children: "Save" }), _jsx(Button, { size: 3, tone: 'success', loading: true, leftIcon: _jsx(LuCheck, { size: 16 }), children: "Success" }), _jsx(Spinner, {})] }), _jsxs("div", { className: 'oui-ui-row', children: [_jsx(Button, { size: 1, v: 'surface', children: "Size 1" }), _jsx(Button, { size: 2, v: 'surface', children: "Size 2" }), _jsx(Button, { size: 3, v: 'surface', children: "Size 3" }), _jsx(Button, { size: 4, v: 'surface', children: "Size 4" })] }), _jsxs("div", { className: 'oui-ui-row', children: [_jsx(Button, { size: 1, children: "Solid 1" }), _jsx(Button, { size: 2, v: 'soft', children: "Soft 2" }), _jsx(Button, { size: 3, v: 'surface', children: "Surface 3" }), _jsx(Button, { size: 3, v: 'pad', children: "Pad 3" }), _jsx(Button, { size: 4, v: 'outline', children: "Outline 4" }), _jsx(Button, { size: 2, v: 'ghost', children: "Ghost 2" })] }), _jsxs("div", { className: 'oui-ui-row', children: [_jsx(Button, { v: 'surface', pressAnimation: 'translate', children: "Press translate" }), _jsx(Button, { v: 'surface', pressAnimation: 'scale', children: "Press scale" }), _jsx(Button, { v: 'surface', pressAnimation: 'soft', children: "Press soft" }), _jsx(Button, { v: 'surface', pressAnimation: 'none', children: "Press none" })] })] }) }), _jsx(UiExampleSection, { id: 'icon-text-buttons-example', title: 'Icon text buttons', description: 'Button and link-button behavior with library-owned icon spacing.', children: _jsx(ExampleTile, { title: 'IconTextButton', code: codeSamples.iconTextButton, onOpen: onOpenCode, children: _jsxs(Flex, { g: 2, a: 'c', wrap: true, children: [_jsx(IconTextButton, { icon: _jsx(LuPackagePlus, { size: 16 }), children: "Create PO" }), _jsx(IconTextButton, { v: 'soft', tone: 'info', icon: _jsx(LuCopy, { size: 16 }), children: "Duplicate" }), _jsx(IconTextButton, { href: '#icon-text-buttons-example', v: 'surface', icon: _jsx(LuExternalLink, { size: 16 }), children: "Link action" }), _jsx(IconTextButton, { v: 'outline', iconSide: 'end', icon: _jsx(LuExternalLink, { size: 16 }), children: "Open details" })] }) }) }), _jsx(UiExampleSection, { id: 'icon-buttons-example', title: 'Icon buttons', description: 'Icon-only actions, loading state, menu trigger and command entry.', children: _jsxs(ExampleTile, { title: 'Icon buttons', code: codeSamples.iconButtons, onOpen: onOpenCode, children: [_jsxs(Flex, { g: 2, a: 'c', wrap: true, children: [_jsx(IconButton, { v: 'solid', icon: _jsx(LuCheck, { size: 17 }), "aria-label": 'Solid icon' }), _jsx(IconButton, { v: 'soft', icon: _jsx(LuSearch, { size: 17 }), "aria-label": 'Search icon' }), _jsx(IconButton, { v: 'surface', icon: _jsx(LuUpload, { size: 17 }), "aria-label": 'Upload icon' }), _jsx(IconButton, { v: 'pad', icon: _jsx(LuShield, { size: 17 }), "aria-label": 'Security icon' }), _jsx(IconButton, { v: 'outline', icon: _jsx(LuInfo, { size: 17 }), "aria-label": 'Outline icon' }), _jsx(IconButton, { v: 'ghost', icon: _jsx(LuEllipsis, { size: 17 }), "aria-label": 'Ghost icon' })] }), _jsxs(Flex, { g: 2, a: 'c', wrap: true, children: [_jsx(IconButton, { size: 1, v: 'surface', icon: _jsx(LuSearch, { size: 13 }), "aria-label": 'Size 1 search' }), _jsx(IconButton, { size: 2, v: 'surface', icon: _jsx(LuDownload, { size: 15 }), "aria-label": 'Size 2 download' }), _jsx(IconButton, { size: 3, v: 'surface', icon: _jsx(LuRefreshCw, { size: 17 }), "aria-label": 'Size 3 refresh' }), _jsx(IconButton, { size: 4, v: 'surface', icon: _jsx(LuSettings, { size: 19 }), "aria-label": 'Size 4 settings' }), _jsx(IconButton, { size: 3, v: 'pad', round: false, r: 3, icon: _jsx(LuCommand, { size: 17 }), "aria-label": 'Square pad icon' }), _jsx(IconButton, { size: 3, v: 'outline', loading: true, icon: _jsx(LuRefreshCw, { size: 17 }), "aria-label": 'Loading icon' })] }), _jsxs(Flex, { g: 2, a: 'c', wrap: true, children: [_jsx(IconButton, { v: 'surface', icon: _jsx(LuBell, { size: 17 }), badge: 64, "aria-label": 'Notifications' }), _jsx(IconButton, { v: 'surface', icon: _jsx(LuMessageSquare, { size: 17 }), badge: 99, "aria-label": 'Unread chats' }), _jsx(IconButton, { v: 'pad', icon: _jsx(LuShield, { size: 17 }), badge: 3, badgeTone: 'warning', "aria-label": 'Security warnings' }), _jsx(IconButton, { v: 'ghost', icon: _jsx(LuDownload, { size: 17 }), badge: 'new', badgeTone: 'info', "aria-label": 'New export' })] }), _jsxs(Flex, { g: 2, a: 'c', wrap: true, children: [_jsx(IconButton, { size: 1, v: 'ghost', icon: _jsx(LuEllipsis, { size: 13 }), "aria-label": 'Ghost size 1' }), _jsx(IconButton, { size: 2, v: 'ghost', icon: _jsx(LuEllipsis, { size: 15 }), "aria-label": 'Ghost size 2' }), _jsx(IconButton, { size: 3, v: 'ghost', icon: _jsx(LuEllipsis, { size: 17 }), "aria-label": 'Ghost size 3' }), _jsx(IconButton, { size: 4, v: 'ghost', icon: _jsx(LuEllipsis, { size: 19 }), "aria-label": 'Ghost size 4' })] }), _jsxs("div", { className: 'oui-ui-row', children: [_jsx(Tooltip, { content: 'Notifications', children: _jsx(IconButton, { v: 'surface', icon: _jsx(LuBell, { size: 17 }), badge: 8, "aria-label": 'Notifications' }) }), _jsx(IconButton, { v: 'surface', loading: true, icon: _jsx(LuRefreshCw, { size: 17 }), "aria-label": 'Loading action' }), _jsx(IconButton, { v: 'pad', icon: _jsx(LuSettings, { size: 17 }), "aria-label": 'Pad action' }), _jsx(Menu, { trigger: _jsx(IconButton, { v: 'surface', icon: _jsx(LuEllipsis, { size: 17 }), "aria-label": 'Actions' }), items: menuItems }), _jsx(Button, { v: 'surface', leftIcon: _jsx(LuCommand, { size: 16 }), onClick: onOpenPalette, children: "Commands" })] })] }) }), _jsx(UiExampleSection, { id: 'context-menu-example', title: 'Context menu', description: 'Right-click menu layer using shared action menu items.', children: _jsx(ExampleTile, { title: 'ContextMenu', code: codeSamples.contextMenu, onOpen: onOpenCode, children: _jsx(ContextMenu, { items: menuItems, children: _jsxs("div", { className: 'oui-ui-context-menu-demo', children: [_jsx(Text, { fs: '13px', fw: 760, children: "Right-click this row" }), _jsx(Text, { fs: '12px', tone: 'muted', children: "ContextMenu reuses Menu item sizing, tones and confirm actions." })] }) }) }) })] }));
|
|
10
10
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type CodeExample } from './codeSamples';
|
|
2
|
+
type ExampleSectionProps = {
|
|
3
|
+
onOpenCode: (example: CodeExample) => void;
|
|
4
|
+
};
|
|
5
|
+
export declare function ApplicationSection({ onOpenCode }: ExampleSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=ExampleApplicationSection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExampleApplicationSection.d.ts","sourceRoot":"","sources":["../../src/example/ExampleApplicationSection.tsx"],"names":[],"mappings":"AA2CA,OAAO,EAAc,KAAK,WAAW,EAAC,MAAM,eAAe,CAAC;AAG5D,KAAK,mBAAmB,GAAG;IACvB,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC9C,CAAC;AAIF,wBAAgB,kBAAkB,CAAC,EAAC,UAAU,EAAC,EAAE,mBAAmB,2CAyOnE"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { LuArrowLeft, LuArrowLeftRight, LuBell, LuBox, LuBraces, LuCalendar, LuClipboardList, LuCog, LuEllipsis, LuFlaskConical, LuHeadphones, LuLanguages, LuLayoutDashboard, LuMessageSquare, LuSearch, LuSettings, LuShield, LuSun, LuTruck, } from 'react-icons/lu';
|
|
5
|
+
import { AppShell, AppShellContent, AppShellHeader, AppSidebar, Badge, Button, Flex, IconButton, IconTextButton, PageTitleBlock, SpecialModal, Stack, Text, } from '..';
|
|
6
|
+
import { ExampleTile } from './CodePreview';
|
|
7
|
+
import { codeSamples } from './codeSamples';
|
|
8
|
+
import { UiExampleSection } from './UiExampleSection';
|
|
9
|
+
export function ApplicationSection({ onOpenCode }) {
|
|
10
|
+
const [appShellOpen, setAppShellOpen] = useState(false);
|
|
11
|
+
const [appShellPreviewMode, setAppShellPreviewMode] = useState('desktop');
|
|
12
|
+
const [specialModalOpen, setSpecialModalOpen] = useState(false);
|
|
13
|
+
const [shellMobileOpen, setShellMobileOpen] = useState(false);
|
|
14
|
+
const [shellActiveKey, setShellActiveKey] = useState('requests');
|
|
15
|
+
const [sidebarActiveKey, setSidebarActiveKey] = useState('requests');
|
|
16
|
+
const shellGroups = [
|
|
17
|
+
{
|
|
18
|
+
key: 'demand',
|
|
19
|
+
items: [
|
|
20
|
+
{ key: 'overview', label: 'Overview', icon: _jsx(LuLayoutDashboard, { size: 17 }), active: shellActiveKey === 'overview' },
|
|
21
|
+
{ key: 'requests', label: 'Requests', icon: _jsx(LuTruck, { size: 17 }), active: shellActiveKey === 'requests' },
|
|
22
|
+
{ key: 'orders', label: 'Supplier orders', icon: _jsx(LuClipboardList, { size: 17 }), active: shellActiveKey === 'orders' },
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
key: 'operations',
|
|
27
|
+
items: [
|
|
28
|
+
{ key: 'products', label: 'Products', icon: _jsx(LuBox, { size: 17 }), active: shellActiveKey === 'products' },
|
|
29
|
+
{ key: 'calendar', label: 'Calendar', icon: _jsx(LuCalendar, { size: 17 }), active: shellActiveKey === 'calendar' },
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
return (_jsxs(_Fragment, { children: [_jsxs(UiExampleSection, { id: 'app-shell-example', title: 'AppShell', description: 'Application shell primitives for module frames.', children: [_jsx(ExampleTile, { title: 'Fullscreen AppShell preview', code: codeSamples.appShell, onOpen: onOpenCode, children: _jsx(IconTextButton, { icon: _jsx(LuLayoutDashboard, { size: 16 }), onClick: () => setAppShellOpen(true), children: "Open AppShell preview" }) }), _jsxs(SpecialModal, { open: appShellOpen, onOpenChange: setAppShellOpen, size: 'full', scroll: 'body', density: 'compact', contentClassName: 'oui-ui-app-shell-modal', children: [_jsxs(SpecialModal.Header, { className: 'oui-ui-app-shell-modal-header', children: [_jsxs(Flex, { a: 'c', g: 2, minW: 0, children: [_jsx(Text, { fw: 760, children: "AppShell preview" }), _jsx(Badge, { tone: 'primary', children: appShellPreviewMode === 'desktop' ? 'Desktop' : 'Phone' })] }), _jsxs(Flex, { a: 'c', g: 1, children: [_jsx(Button, { className: 'oui-ui-app-shell-mode-toggle', size: 2, v: 'surface', onClick: () => {
|
|
34
|
+
setShellMobileOpen(false);
|
|
35
|
+
setAppShellPreviewMode((mode) => mode === 'desktop' ? 'phone' : 'desktop');
|
|
36
|
+
}, children: appShellPreviewMode === 'desktop'
|
|
37
|
+
? 'Phone view'
|
|
38
|
+
: 'Desktop view' }), _jsx(SpecialModal.Close, {})] })] }), _jsx(SpecialModal.Body, { className: 'oui-ui-app-shell-modal-body', children: _jsx("div", { className: 'oui-ui-app-shell-preview-stage', "data-mode": appShellPreviewMode, children: _jsx(DemoAppShellPreview, { mode: appShellPreviewMode, mobileOpen: shellMobileOpen, onMobileOpenChange: setShellMobileOpen, groups: shellGroups, onNavigate: (item) => setShellActiveKey(item.key) }) }) })] })] }), _jsx(UiExampleSection, { id: 'app-sidebar-example', title: 'AppSidebar', description: 'Deliveries-style sidebar with active indicator and footer actions.', children: _jsx(ExampleTile, { title: 'AppSidebar', code: codeSamples.appSidebar, onOpen: onOpenCode, children: _jsx("div", { className: 'oui-ui-app-sidebar-demo', children: _jsx(AppSidebar, { header: (_jsxs(_Fragment, { children: [_jsxs("div", { className: 'oui-app-sidebar-brand', children: [_jsx("span", { className: 'oui-app-sidebar-logo', children: _jsx("span", { className: 'oui-ui-demo-logo', children: "O" }) }), _jsx("span", { className: 'oui-app-sidebar-title', children: "Deliveries" })] }), _jsx("div", { className: 'oui-app-sidebar-actions', children: _jsx(IconButton, { size: 2, v: 'ghost', icon: _jsx(LuEllipsis, { size: 16 }), "aria-label": 'Sidebar actions' }) })] })), itemH: 38, onNavigate: (item) => setSidebarActiveKey(item.key), groups: [
|
|
39
|
+
{
|
|
40
|
+
key: 'main',
|
|
41
|
+
items: [
|
|
42
|
+
{ key: 'overview', label: 'Overview', icon: _jsx(LuLayoutDashboard, { size: 17 }), active: sidebarActiveKey === 'overview' },
|
|
43
|
+
{ key: 'requests', label: 'Requests', icon: _jsx(LuTruck, { size: 17 }), active: sidebarActiveKey === 'requests' },
|
|
44
|
+
{ key: 'orders', label: 'Supplier orders', icon: _jsx(LuClipboardList, { size: 17 }), active: sidebarActiveKey === 'orders' },
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
key: 'inventory',
|
|
49
|
+
items: [
|
|
50
|
+
{ key: 'products', label: 'Products', icon: _jsx(LuBox, { size: 17 }), active: sidebarActiveKey === 'products' },
|
|
51
|
+
{ key: 'calendar', label: 'Calendar', icon: _jsx(LuCalendar, { size: 17 }), disabled: true },
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
], footer: (_jsxs(Flex, { col: true, g: 2, children: [_jsxs(Flex, { g: 1, a: 'c', children: [_jsx(IconButton, { size: 2, v: 'ghost', icon: _jsx(LuBell, { size: 15 }), badge: 64, "aria-label": 'Notifications' }), _jsx(IconButton, { size: 2, v: 'ghost', icon: _jsx(LuSettings, { size: 15 }), "aria-label": 'Settings' }), _jsx(IconButton, { size: 2, v: 'ghost', icon: _jsx(LuCog, { size: 15 }), "aria-label": 'Developer tools' })] }), _jsx(Text, { fs: '12px', tone: 'muted', children: "Admin workspace" })] })) }) }) }) }), _jsxs(UiExampleSection, { id: 'special-modal-example', title: 'SpecialModal', description: 'Large entity modal shell for rich operational dialogs.', children: [_jsx(ExampleTile, { title: 'SpecialModal', code: codeSamples.specialModal, onOpen: onOpenCode, children: _jsx(Button, { onClick: () => setSpecialModalOpen(true), children: "Open special modal" }) }), _jsxs(SpecialModal, { open: specialModalOpen, onOpenChange: setSpecialModalOpen, size: 'lg', scroll: 'body', children: [_jsx(SpecialModal.Header, { title: 'Request PR-2026-0900', meta: (_jsxs(Flex, { g: 2, a: 'c', wrap: true, children: [_jsx(Badge, { tone: 'success', children: "Closed" }), _jsx(Badge, { tone: 'neutral', children: "RUB" })] })), actions: _jsx(SpecialModal.Close, {}) }), _jsx(SpecialModal.Body, { children: _jsxs(Stack, { g: 3, children: [_jsxs(Flex, { g: 4, wrap: true, children: [_jsxs(Stack, { g: 0, w: 'min(100%, 220px)', children: [_jsx(Text, { fs: '12px', tone: 'muted', children: "Supplier" }), _jsx(Text, { fw: 760, children: "Northwind Trading LLC" })] }), _jsxs(Stack, { g: 0, w: 'min(100%, 180px)', children: [_jsx(Text, { fs: '12px', tone: 'muted', children: "Plan arrival" }), _jsx(Text, { fw: 760, children: "25.06.2026" })] })] }), _jsx(TableLikePreview, {})] }) }), _jsx(SpecialModal.Footer, { children: _jsxs(Flex, { g: 2, j: 'e', w: '100%', children: [_jsx(Button, { v: 'surface', onClick: () => setSpecialModalOpen(false), children: "Close" }), _jsx(Button, { children: "Save" })] }) })] })] })] }));
|
|
55
|
+
}
|
|
56
|
+
function DemoAppShellPreview({ mode, mobileOpen, onMobileOpenChange, groups, onNavigate, }) {
|
|
57
|
+
const isPhone = mode === 'phone';
|
|
58
|
+
return (_jsx(AppShell, { className: 'oui-ui-app-shell-preview', sidebarMode: isPhone ? 'mobile' : 'desktop', sidebarWidth: 300, maxWidth: '100%', contentInset: 0, sidebarOpen: mobileOpen, onSidebarOpenChange: onMobileOpenChange, header: (_jsx(AppShellHeader, { visibility: 'always', sidebarOpen: mobileOpen, onSidebarOpenChange: isPhone ? onMobileOpenChange : undefined, actions: _jsx(DemoHeaderActions, {}), children: _jsxs(Flex, { className: 'oui-ui-app-shell-header-main', a: 'c', g: 2, children: [!isPhone ? (_jsxs(_Fragment, { children: [_jsx(IconButton, { size: 2, v: 'ghost', icon: _jsx(LuArrowLeft, { size: 17 }), "aria-label": 'Back' }), _jsx(IconButton, { size: 2, v: 'ghost', icon: _jsx(LuArrowLeftRight, { size: 17 }), "aria-label": 'Move sidebar' })] })) : null, _jsx(Text, { fw: 760, children: "Deliveries" })] }) })), sidebar: (_jsx(AppSidebar, { header: (_jsxs(_Fragment, { children: [_jsxs("div", { className: 'oui-app-sidebar-brand', children: [_jsx("span", { className: 'oui-app-sidebar-logo', children: _jsx("span", { className: 'oui-ui-demo-logo', children: "O" }) }), _jsx("span", { className: 'oui-app-sidebar-title', children: "Deliveries" })] }), _jsx("div", { className: 'oui-app-sidebar-actions', children: _jsx(IconButton, { size: 2, v: 'ghost', icon: _jsx(LuEllipsis, { size: 16 }), "aria-label": 'Sidebar actions' }) })] })), itemH: 38, onNavigate: onNavigate, groups: groups, footer: _jsx(DemoSidebarFooter, {}) })), children: _jsxs(AppShellContent, { scroll: false, children: [_jsx(PageTitleBlock, { title: 'Requests', caption: 'Module workspace with responsive header and AppSidebar navigation.', badge: 'shell', action: (_jsx(IconButton, { size: 2, v: 'pad', icon: _jsx(LuEllipsis, { size: 16 }), "aria-label": 'More actions' })) }), _jsx(TableLikePreview, {})] }) }));
|
|
59
|
+
}
|
|
60
|
+
function DemoHeaderActions() {
|
|
61
|
+
return (_jsxs(Flex, { className: 'oui-ui-app-shell-header-actions-demo', a: 'c', g: 1, children: [_jsx(IconTextButton, { className: 'oui-ui-app-shell-quick-jump', size: 2, v: 'soft', tone: 'neutral', icon: _jsx(LuSearch, { size: 14 }), children: "Quick jump" }), _jsx(IconButton, { size: 2, v: 'ghost', icon: _jsx(LuBell, { size: 18 }), badge: 64, "aria-label": 'Notifications' }), _jsx(IconButton, { size: 2, v: 'ghost', icon: _jsx(LuMessageSquare, { size: 18 }), badge: 99, "aria-label": 'Messages' }), _jsx(IconButton, { size: 2, v: 'ghost', icon: _jsx(LuLanguages, { size: 18 }), "aria-label": 'Language' }), _jsx(IconButton, { size: 2, v: 'ghost', icon: _jsx(LuSun, { size: 18 }), "aria-label": 'Theme' }), _jsx(IconButton, { size: 2, v: 'ghost', icon: _jsx(LuShield, { size: 18 }), "aria-label": 'Admin' })] }));
|
|
62
|
+
}
|
|
63
|
+
function DemoSidebarFooter() {
|
|
64
|
+
return (_jsxs(Flex, { col: true, g: 2, children: [_jsxs(Flex, { g: 1, a: 'c', children: [_jsx(IconButton, { size: 2, v: 'ghost', icon: _jsx(LuHeadphones, { size: 15 }), "aria-label": 'Support' }), _jsx(IconButton, { size: 2, v: 'ghost', icon: _jsx(LuBell, { size: 15 }), badge: 64, "aria-label": 'Notifications' }), _jsx(IconButton, { size: 2, v: 'ghost', icon: _jsx(LuSettings, { size: 15 }), "aria-label": 'Settings' }), _jsx(IconButton, { size: 2, v: 'ghost', icon: _jsx(LuFlaskConical, { size: 15 }), "aria-label": 'Demo data' }), _jsx(IconButton, { size: 2, v: 'ghost', icon: _jsx(LuBraces, { size: 15 }), "aria-label": 'API' })] }), _jsx(Text, { fs: '12px', tone: 'muted', children: "Admin workspace" })] }));
|
|
65
|
+
}
|
|
66
|
+
function TableLikePreview() {
|
|
67
|
+
return (_jsxs("div", { className: 'oui-ui-application-table-preview', children: [['Brand', 'Name', 'Article', 'Qty', 'Price'].map((item) => (_jsx(Text, { fs: '12px', fw: 760, children: item }, item))), ['Stalex', 'Lathe machine', 'LATHE-8191', '22', '1250'].map((item) => (_jsx(Text, { fs: '13px', children: item }, item)))] }));
|
|
68
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleBasicsSections.d.ts","sourceRoot":"","sources":["../../src/example/ExampleBasicsSections.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExampleBasicsSections.d.ts","sourceRoot":"","sources":["../../src/example/ExampleBasicsSections.tsx"],"names":[],"mappings":"AAuBA,OAAO,EAAc,KAAK,WAAW,EAAC,MAAM,eAAe,CAAC;AAG5D,KAAK,mBAAmB,GAAG;IACvB,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC9C,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAAC,UAAU,EAAC,EAAE,mBAAmB,2CAwElE;AAED,wBAAgB,aAAa,CAAC,EAAC,UAAU,EAAC,EAAE,mBAAmB,2CAyV9D"}
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { Alert, Badge, Box, Button, Card, Collapse, Flex, Grid, ScrollArea, Section, Separator, Skeleton, Stack, Text, TopHighlight, BottomHighlight, } from '..';
|
|
5
5
|
import { ExampleTile } from './CodePreview';
|
|
6
6
|
import { codeSamples } from './codeSamples';
|
|
7
7
|
import { UiExampleSection } from './UiExampleSection';
|
|
8
8
|
export function TypographySection({ onOpenCode }) {
|
|
9
|
-
return (_jsxs(_Fragment, { children: [_jsx(UiExampleSection, { id: 'typography', title: 'Typography', description: 'Text and shared system props.', children: _jsx(ExampleTile, { title: 'Typography', code: codeSamples.typography, onOpen: onOpenCode, children: _jsxs(Stack, { g: 3, children: [_jsxs(Stack, { g: 1, children: [_jsx(Text, { as: 'h1', fs: '28px', fw: 780, lh: 1.1, children: "
|
|
9
|
+
return (_jsxs(_Fragment, { children: [_jsx(UiExampleSection, { id: 'typography', title: 'Typography', description: 'Text and shared system props.', children: _jsx(ExampleTile, { title: 'Typography', code: codeSamples.typography, onOpen: onOpenCode, children: _jsxs(Stack, { g: 3, children: [_jsxs(Stack, { g: 1, children: [_jsx(Text, { as: 'h1', fs: '28px', fw: 780, lh: 1.1, children: "Operations review" }), _jsx(Text, { as: 'h2', fs: '20px', fw: 720, lh: 1.2, children: "Review window and status" }), _jsx(Text, { tone: 'muted', fs: '13px', lh: 1.5, children: "Compact operational text with muted metadata and predictable line height." })] }), _jsxs(Stack, { g: 1, children: [_jsx(Text, { fs: '15px', fw: 700, children: "Body strong text" }), _jsx(Text, { fs: '14px', lh: 1.55, children: "Body regular text for dense forms and tables." }), _jsx(Text, { fs: '12px', tone: 'muted', lh: 1.4, children: "Caption text, helper text and quiet labels." })] }), _jsxs(Flex, { g: 2, wrap: true, children: [_jsx(Text, { tone: 'primary', fw: 700, children: "Primary" }), _jsx(Text, { tone: 'success', fw: 700, children: "Success" }), _jsx(Text, { tone: 'warning', fw: 700, children: "Warning" }), _jsx(Text, { tone: 'danger', fw: 700, children: "Danger" }), _jsx(Text, { tone: 'info', fw: 700, children: "Info" })] }), _jsx(Box, { w: '100%', p: 2, r: 3, style: { background: 'var(--oui-gray-a3)' }, children: _jsx(Text, { display: 'block', truncate: true, children: "This is a long single line value that truncates cleanly inside a constrained row." }) }), _jsxs(Flex, { g: 2, wrap: true, children: [_jsx(Badge, { children: "Neutral" }), _jsx(Badge, { tone: 'primary', children: "Primary" }), _jsx(Badge, { tone: 'success', children: "Success" }), _jsx(Badge, { tone: 'warning', children: "Warning" }), _jsx(Badge, { tone: 'danger', children: "Danger" }), _jsx(Badge, { tone: 'info', children: "Info" })] })] }) }) }), _jsx(UiExampleSection, { id: 'skeleton-example', title: 'Skeleton', description: 'Loading placeholder primitives.', children: _jsx(ExampleTile, { title: 'Skeleton', code: codeSamples.skeleton, onOpen: onOpenCode, children: _jsxs(Stack, { g: 2, children: [_jsx(Skeleton, { h: 16, w: '80%' }), _jsx(Skeleton, { h: 16, w: '64%' }), _jsx(Skeleton, { h: 36 })] }) }) })] }));
|
|
10
10
|
}
|
|
11
11
|
export function LayoutSection({ onOpenCode }) {
|
|
12
12
|
const [detailsOpen, setDetailsOpen] = useState(true);
|
|
13
|
-
return (_jsxs(_Fragment, { children: [_jsx(UiExampleSection, { id: '
|
|
14
|
-
{ key: 'queue', label: 'Queue', caption: 'Daily operations', active: true },
|
|
15
|
-
{ key: 'status', label: 'Status', caption: 'Inventory control', badge: 12 },
|
|
16
|
-
{ key: 'reports', label: 'Reports', caption: 'Exports and analytics' },
|
|
17
|
-
] })] }) }) }), _jsx(UiExampleSection, { id: 'flex-example', title: 'Flex', description: 'Row and column alignment primitive.', children: _jsx(ExampleTile, { title: 'Flex', code: codeSamples.layoutFlex, onOpen: onOpenCode, children: _jsxs(Flex, { col: true, g: 3, children: [_jsxs(Flex, { row: true, g: 2, a: 'c', j: 'sb', wrap: true, children: [_jsxs(Flex, { row: true, g: 2, a: 'c', wrap: true, children: [_jsx(Badge, { tone: 'brand', children: "status" }), _jsx(Text, { fw: 700, children: "Task TASK-2048" })] }), _jsxs(Flex, { row: true, g: 1, a: 'c', children: [_jsx(Button, { size: 1, v: 'surface', children: "Cancel" }), _jsx(Button, { size: 1, children: "Apply" })] })] }), _jsx(Flex, { row: true, g: 2, wrap: true, children: ['Intake', 'Review', 'Complete'].map((item, index) => (_jsxs(Flex, { col: true, g: 1, p: 2, r: 3, flex: '1 1 150px', style: { background: 'var(--oui-gray-a3)' }, children: [_jsxs(Text, { fs: '12px', tone: 'muted', children: ["Step ", index + 1] }), _jsx(Text, { fw: 700, children: item })] }, item))) })] }) }) }), _jsx(UiExampleSection, { id: 'stack-example', title: 'Stack', description: 'Vertical spacing primitive.', children: _jsx(ExampleTile, { title: 'Stack', code: codeSamples.layoutStack, onOpen: onOpenCode, children: _jsx(Stack, { g: 2, children: [
|
|
13
|
+
return (_jsxs(_Fragment, { children: [_jsx(UiExampleSection, { id: 'flex-example', title: 'Flex', description: 'Row and column alignment primitive.', children: _jsx(ExampleTile, { title: 'Flex', code: codeSamples.layoutFlex, onOpen: onOpenCode, children: _jsxs(Flex, { col: true, g: 3, children: [_jsxs(Flex, { row: true, g: 2, a: 'c', j: 'sb', wrap: true, children: [_jsxs(Flex, { row: true, g: 2, a: 'c', wrap: true, children: [_jsx(Badge, { tone: 'primary', children: "status" }), _jsx(Text, { fw: 700, children: "Task TASK-2048" })] }), _jsxs(Flex, { row: true, g: 1, a: 'c', children: [_jsx(Button, { size: 1, v: 'surface', children: "Cancel" }), _jsx(Button, { size: 1, children: "Apply" })] })] }), _jsx(Flex, { row: true, g: 2, wrap: true, children: ['Intake', 'Review', 'Complete'].map((item, index) => (_jsxs(Flex, { col: true, g: 1, p: 2, r: 3, flex: '1 1 150px', style: { background: 'var(--oui-gray-a3)' }, children: [_jsxs(Text, { fs: '12px', tone: 'muted', children: ["Step ", index + 1] }), _jsx(Text, { fw: 700, children: item })] }, item))) })] }) }) }), _jsx(UiExampleSection, { id: 'stack-example', title: 'Stack', description: 'Vertical spacing primitive.', children: _jsx(ExampleTile, { title: 'Stack', code: codeSamples.layoutStack, onOpen: onOpenCode, children: _jsx(Stack, { g: 2, children: [
|
|
18
14
|
['Created', 'Draft created from intake'],
|
|
19
15
|
['Reserved', 'Capacity is reserved for review'],
|
|
20
16
|
['Scheduled', 'Review window is confirmed'],
|
|
21
|
-
].map(([title, description]) => (_jsxs(Flex, { row: true, g: 2, p: 2, r: 3, a: 's', style: { background: 'var(--oui-gray-a3)' }, children: [_jsx(Box, { size: 8, r: 7, mt: 1, style: { background: 'var(--oui-
|
|
17
|
+
].map(([title, description]) => (_jsxs(Flex, { row: true, g: 2, p: 2, r: 3, a: 's', style: { background: 'var(--oui-gray-a3)' }, children: [_jsx(Box, { size: 8, r: 7, mt: 1, style: { background: 'var(--oui-primary-base)' } }), _jsxs(Stack, { g: 0, children: [_jsx(Text, { fs: '13px', fw: 700, children: title }), _jsx(Text, { fs: '12px', tone: 'muted', lh: 1.45, children: description })] })] }, title))) }) }) }), _jsx(UiExampleSection, { id: 'collapse-example', title: 'Collapse', description: 'Expandable content primitive.', children: _jsx(ExampleTile, { title: 'Collapse', code: codeSamples.layoutCollapse, onOpen: onOpenCode, children: _jsxs(Stack, { g: 2, children: [_jsxs(Flex, { row: true, g: 2, a: 'c', j: 'sb', children: [_jsx(Text, { fw: 700, children: "Item details" }), _jsx(Button, { size: 1, v: 'surface', onClick: () => setDetailsOpen((open) => !open), children: detailsOpen ? 'Hide' : 'Show' })] }), _jsx(Collapse, { open: detailsOpen, children: _jsxs(Stack, { g: 2, p: 2, r: 3, style: { background: 'var(--oui-gray-a3)' }, children: [_jsxs(Flex, { row: true, g: 2, j: 'sb', children: [_jsx(Text, { tone: 'muted', children: "Owner" }), _jsx(Text, { fw: 700, children: "Core team" })] }), _jsxs(Flex, { row: true, g: 2, j: 'sb', children: [_jsx(Text, { tone: 'muted', children: "Window" }), _jsx(Text, { fw: 700, children: "09:00 - 12:00" })] }), _jsxs(Flex, { row: true, g: 2, j: 'sb', children: [_jsx(Text, { tone: 'muted', children: "Priority" }), _jsx(Badge, { tone: 'warning', children: "High" })] })] }) })] }) }) }), _jsx(UiExampleSection, { id: 'surfaces-example', title: 'Surfaces', description: 'Card, Section, Separator and Alert primitives.', children: _jsx(ExampleTile, { title: 'Surfaces', code: codeSamples.surfaces, onOpen: onOpenCode, children: _jsxs(Section, { g: 3, children: [_jsxs(Grid, { columns: 'repeat(auto-fit, minmax(min(100%, 180px), 1fr))', g: 2, children: [_jsx(Card, { v: 'surface', interactive: true, children: _jsxs(Stack, { g: 1, children: [_jsx(Text, { fw: 760, children: "Surface card" }), _jsx(Text, { fs: '12px', tone: 'muted', children: "Default operational surface." })] }) }), _jsx(Card, { v: 'soft', children: _jsxs(Stack, { g: 1, children: [_jsx(Text, { fw: 760, children: "Soft card" }), _jsx(Text, { fs: '12px', tone: 'muted', children: "Quiet grouped content." })] }) }), _jsx(Card, { v: 'classic', children: _jsxs(Stack, { g: 1, children: [_jsx(Text, { fw: 760, children: "Classic card" }), _jsx(Text, { fs: '12px', tone: 'muted', children: "More explicit border and background." })] }) })] }), _jsx(Separator, {}), _jsx(Alert, { title: 'Inventory sync delayed', action: _jsx(Button, { size: 1, v: 'surface', children: "Retry" }), children: "Check this status before creating the next shipment." })] }) }) }), _jsx(UiExampleSection, { id: 'grid-example', title: 'Grid', description: 'Grid layout primitive.', children: _jsx(ExampleTile, { title: 'Grid', code: codeSamples.layoutGrid, onOpen: onOpenCode, children: _jsx(Grid, { columns: 'repeat(3, minmax(0, 1fr))', g: 2, children: ['A', 'B', 'C', 'D', 'E', 'F'].map((item) => (_jsx(Box, { p: 2, r: 3, ta: 'center', style: { background: 'var(--oui-gray-a3)' }, children: _jsx(Text, { fs: '13px', fw: 700, children: item }) }, item))) }) }) }), _jsx(UiExampleSection, { id: 'highlight-primitives-example', title: 'Highlight primitives', description: 'Standalone edge mask primitives.', children: _jsx(ExampleTile, { title: 'Highlight primitives', code: codeSamples.highlights, onOpen: onOpenCode, children: _jsxs("div", { className: 'oui-highlight-demo-surface', style: { background: 'var(--oui-section-nested-solid-bg)' }, children: [_jsx(TopHighlight, { h: 32, color: 'var(--oui-section-nested-solid-bg)', position: 'absolute' }), _jsx(Text, { fs: '13px', fw: 700, children: "Top and bottom highlights" }), _jsx(Text, { fs: '12px', tone: 'muted', children: "One surface shows both edge masks at the same time." }), _jsx(BottomHighlight, { h: 32, color: 'var(--oui-section-nested-solid-bg)', position: 'absolute' })] }) }) }), _jsx(UiExampleSection, { id: 'scroll-area-example', title: 'ScrollArea', description: 'Themed scroll container with optional edge highlights.', children: _jsx(ExampleTile, { title: 'ScrollArea', code: codeSamples.scrollArea, onOpen: onOpenCode, children: _jsxs(Stack, { g: 2, children: [_jsx(ScrollArea, { h: 116, pr: 1, children: _jsx(Stack, { g: 1, children: Array.from({ length: 10 }, (_, index) => (_jsx(Box, { p: 2, r: 3, style: { background: 'var(--oui-gray-a3)' }, children: _jsxs(Text, { fs: '13px', children: ["Scroll row ", index + 1] }) }, index))) }) }), _jsx(ScrollArea, { h: 112, pr: 1, highlights: true, highlightColor: 'var(--oui-section-nested-solid-bg)', highlightTop: { h: 28, mode: 'static', maxOpacity: 0.96 }, highlightBottom: { h: 28, mode: 'static', maxOpacity: 0.96 }, children: _jsx(Stack, { g: 1, children: Array.from({ length: 8 }, (_, index) => (_jsx(Box, { p: 2, r: 3, style: { background: 'var(--oui-gray-a3)' }, children: _jsxs(Text, { fs: '13px', children: ["Both edges row ", index + 1] }) }, index))) }) }), _jsx(ScrollArea, { h: 176, pr: 1, highlights: true, highlightColor: 'var(--oui-section-nested-solid-bg)', highlightTop: {
|
|
22
18
|
h: 42,
|
|
23
19
|
mode: 'scroll',
|
|
24
20
|
start: 50,
|
|
@@ -39,5 +35,5 @@ export function LayoutSection({ onOpenCode }) {
|
|
|
39
35
|
['Delivered', 'The gradient uses the solid surface color.'],
|
|
40
36
|
['Checked', 'Content remains readable under the fade.'],
|
|
41
37
|
['Archived', 'The bottom edge disappears at the end.'],
|
|
42
|
-
].map(([title, description], index) => (_jsxs(Flex, { row: true, g: 2, p: 2, r: 3, a: 'c', style: { background: 'var(--oui-gray-a3)' }, children: [_jsx(Badge, { tone: index < 3 ? '
|
|
38
|
+
].map(([title, description], index) => (_jsxs(Flex, { row: true, g: 2, p: 2, r: 3, a: 'c', style: { background: 'var(--oui-gray-a3)' }, children: [_jsx(Badge, { tone: index < 3 ? 'primary' : 'info', children: index + 1 }), _jsxs(Stack, { g: 0, children: [_jsx(Text, { fs: '13px', fw: 700, children: title }), _jsx(Text, { fs: '12px', tone: 'muted', children: description })] })] }, title))) }) })] }) }) }), _jsx(UiExampleSection, { id: 'system-radius-example', title: 'System radius', description: 'Radius system prop scale.', children: _jsxs(ExampleTile, { title: 'System radius', code: codeSamples.systemRadius, onOpen: onOpenCode, children: [_jsx(Flex, { g: 2, a: 'c', wrap: true, children: [0, 2, 4, 6, 7].map((radius) => (_jsx(Box, { size: 32, r: radius, display: 'flex', a: 'c', j: 'c', style: { background: 'var(--oui-gray-a3)' }, children: _jsx(Text, { fs: '12px', fw: 700, children: radius }) }, radius))) }), _jsx(Button, { mt: 2, v: 'pad', r: 7, children: "Button r=7" })] }) })] }));
|
|
43
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleDataSection.d.ts","sourceRoot":"","sources":["../../src/example/ExampleDataSection.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExampleDataSection.d.ts","sourceRoot":"","sources":["../../src/example/ExampleDataSection.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAc,KAAK,WAAW,EAAC,MAAM,eAAe,CAAC;AAG5D,KAAK,gBAAgB,GAAG;IACpB,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC9C,CAAC;AA2DF,wBAAgB,WAAW,CAAC,EAAC,UAAU,EAAC,EAAE,gBAAgB,2CA0KzD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo, useState } from 'react';
|
|
4
|
-
import { Badge, Button, DataTable, Text, TextField, } from '..';
|
|
4
|
+
import { Badge, Button, DataTable, Flex, Pagination, Stack, Table, Text, TextField, } from '..';
|
|
5
5
|
import { ExampleTile } from './CodePreview';
|
|
6
6
|
import { codeSamples } from './codeSamples';
|
|
7
7
|
import { UiExampleSection } from './UiExampleSection';
|
|
@@ -62,39 +62,40 @@ export function DataSection({ onOpenCode }) {
|
|
|
62
62
|
const [visibleColumnKeys, setVisibleColumnKeys] = useState(defaultVisibleColumnKeys);
|
|
63
63
|
const [columnOrder, setColumnOrder] = useState(defaultColumnOrder);
|
|
64
64
|
const [columnWidths, setColumnWidths] = useState({});
|
|
65
|
+
const [page, setPage] = useState(2);
|
|
65
66
|
const filteredRows = useMemo(() => sortRows(rows.filter((row) => rowMatches(row, query)), sort), [query, sort]);
|
|
66
|
-
return (_jsx(UiExampleSection, { id: 'data-table-example', title: 'DataTable', description: 'Reusable DataTable without CRUD or page-level entity logic.', children: _jsx(ExampleTile, { className: 'oui-ui-table-tile', title: 'DataTable', code: codeSamples.data, onOpen: onOpenCode, children: _jsxs("div", { className: 'oui-ui-table-demo', children: [_jsx(DataTable, { toolbar: (_jsxs(_Fragment, { children: [_jsx(TextField, { value: query, placeholder: 'Filter rows', clearable: true, onChange: (event) => setQuery(event.target.value), onClear: () => setQuery('') }), _jsx(Button, { size: 3, v: 'surface', onClick: () => {
|
|
67
|
+
return (_jsxs(_Fragment, { children: [_jsx(UiExampleSection, { id: 'data-table-example', title: 'DataTable', description: 'Reusable DataTable without CRUD or page-level entity logic.', children: _jsx(ExampleTile, { className: 'oui-ui-table-tile', title: 'DataTable', code: codeSamples.data, onOpen: onOpenCode, children: _jsxs("div", { className: 'oui-ui-table-demo', children: [_jsx(DataTable, { toolbar: (_jsxs(_Fragment, { children: [_jsx(TextField, { value: query, placeholder: 'Filter rows', clearable: true, onChange: (event) => setQuery(event.target.value), onClear: () => setQuery('') }), _jsx(Button, { size: 3, v: 'surface', onClick: () => {
|
|
68
|
+
setVisibleColumnKeys(defaultVisibleColumnKeys);
|
|
69
|
+
setColumnOrder(defaultColumnOrder);
|
|
70
|
+
setColumnWidths({});
|
|
71
|
+
}, children: "Reset" })] })), rowKey: (row) => row.name, rows: filteredRows, columns: columns, sort: sort, onSortChange: (nextSort) => setSort(Array.isArray(nextSort) ? nextSort[0] ?? null : nextSort), selectable: true, selectedRowKeys: selectedRowKeys, onSelectedRowKeysChange: setSelectedRowKeys, total: rows.length, emptyText: 'No rows match the filter.', columnSettings: {
|
|
72
|
+
columns,
|
|
73
|
+
visibleColumnKeys,
|
|
74
|
+
onVisibleColumnKeysChange: setVisibleColumnKeys,
|
|
75
|
+
columnOrder,
|
|
76
|
+
onColumnOrderChange: setColumnOrder,
|
|
77
|
+
columnWidths,
|
|
78
|
+
onColumnWidthsChange: setColumnWidths,
|
|
79
|
+
onReset: () => {
|
|
67
80
|
setVisibleColumnKeys(defaultVisibleColumnKeys);
|
|
68
81
|
setColumnOrder(defaultColumnOrder);
|
|
69
82
|
setColumnWidths({});
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
label: `Open ${row.name}`,
|
|
87
|
-
onSelect: () => undefined,
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
key: 'archive',
|
|
91
|
-
label: 'Archive',
|
|
92
|
-
tone: 'danger',
|
|
93
|
-
onSelect: () => undefined,
|
|
94
|
-
},
|
|
95
|
-
] }), _jsx("div", { className: 'oui-ui-table-variants', children: _jsxs("div", { className: 'oui-ui-table-variant', children: [_jsx(Text, { fs: '13px', fw: 760, children: "Plain table" }), _jsx(DataTable, { rowKey: (row) => row.name, rows: rows.slice(0, 4), columns: columns, sort: sort, onSortChange: (nextSort) => setSort(Array.isArray(nextSort)
|
|
96
|
-
? nextSort[0] ?? null
|
|
97
|
-
: nextSort), total: rows.length, emptyText: 'No rows.' })] }) })] }) }) }));
|
|
83
|
+
},
|
|
84
|
+
}, rowContextMenuActions: (row) => [
|
|
85
|
+
{
|
|
86
|
+
key: 'open',
|
|
87
|
+
label: `Open ${row.name}`,
|
|
88
|
+
onSelect: () => undefined,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
key: 'archive',
|
|
92
|
+
label: 'Archive',
|
|
93
|
+
tone: 'danger',
|
|
94
|
+
onSelect: () => undefined,
|
|
95
|
+
},
|
|
96
|
+
] }), _jsx("div", { className: 'oui-ui-table-variants', children: _jsxs("div", { className: 'oui-ui-table-variant', children: [_jsx(Text, { fs: '13px', fw: 760, children: "Plain table" }), _jsx(DataTable, { rowKey: (row) => row.name, rows: rows.slice(0, 4), columns: columns, sort: sort, onSortChange: (nextSort) => setSort(Array.isArray(nextSort)
|
|
97
|
+
? nextSort[0] ?? null
|
|
98
|
+
: nextSort), total: rows.length, emptyText: 'No rows.' })] }) })] }) }) }), _jsx(UiExampleSection, { id: 'table-primitives-example', title: 'Table and pagination', description: 'Low-level Table primitive and page navigation.', children: _jsx(ExampleTile, { title: 'Table and pagination', code: codeSamples.tablePagination, onOpen: onOpenCode, children: _jsxs(Stack, { g: 3, children: [_jsxs(Table, { v: 'surface', w: '100%', children: [_jsx(Table.Header, { children: _jsxs(Table.Row, { children: [_jsx(Table.ColumnHeaderCell, { children: "Document" }), _jsx(Table.ColumnHeaderCell, { children: "Status" }), _jsx(Table.ColumnHeaderCell, { align: 'right', children: "Qty" })] }) }), _jsx(Table.Body, { children: rows.slice(0, 3).map((row) => (_jsxs(Table.Row, { children: [_jsx(Table.RowHeaderCell, { children: row.name }), _jsx(Table.Cell, { children: _jsx(Badge, { tone: statusTone(row.status), children: row.status }) }), _jsx(Table.Cell, { align: 'right', children: row.quantity })] }, row.name))) })] }), _jsxs(Flex, { j: 'sb', a: 'c', wrap: true, g: 2, children: [_jsx(Text, { fs: '13px', tone: 'muted', children: "Showing 25 items per page" }), _jsx(Pagination, { page: page, pageCount: 4, onPageChange: setPage })] })] }) }) })] }));
|
|
98
99
|
}
|
|
99
100
|
function sortRows(rows, sort) {
|
|
100
101
|
if (!sort)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleFieldsSection.d.ts","sourceRoot":"","sources":["../../src/example/ExampleFieldsSection.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExampleFieldsSection.d.ts","sourceRoot":"","sources":["../../src/example/ExampleFieldsSection.tsx"],"names":[],"mappings":"AA4BA,OAAO,EAAc,KAAK,WAAW,EAAC,MAAM,eAAe,CAAC;AAG5D,KAAK,cAAc,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,SAAS,EAAE,cAAc,CAAC;IAC1B,iBAAiB,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IACnD,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC9C,CAAC;AAqBF,wBAAgB,aAAa,CAAC,EAC1B,YAAY,EACZ,oBAAoB,EACpB,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,UAAU,GACb,EAAE,kBAAkB,2CA4SpB"}
|