@oprt/react 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +105 -2
- package/dist/ActionStatus/ActionStatus.js +104 -0
- package/dist/ActionStatus/ActionStatus.manifest.js +64 -0
- package/dist/ActionStatus/index.js +7 -0
- package/dist/Alert/Alert.js +86 -0
- package/dist/Alert/Alert.manifest.js +36 -0
- package/dist/Alert/index.js +7 -0
- package/dist/AppShell/AppShell.js +103 -0
- package/dist/AppShell/AppShell.manifest.js +66 -0
- package/dist/AppShell/index.js +9 -0
- package/dist/AttachmentPreview/AttachmentPreview.js +145 -0
- package/dist/AttachmentPreview/AttachmentPreview.manifest.js +42 -0
- package/dist/AttachmentPreview/index.js +9 -0
- package/dist/Avatar/Avatar.js +87 -0
- package/dist/Avatar/Avatar.manifest.js +25 -0
- package/dist/Avatar/index.js +7 -0
- package/dist/Badge/Badge.js +124 -0
- package/dist/Badge/Badge.manifest.js +41 -0
- package/dist/Badge/index.js +7 -0
- package/dist/Breadcrumb/Breadcrumb.js +64 -0
- package/dist/Breadcrumb/Breadcrumb.manifest.js +28 -0
- package/dist/Breadcrumb/index.js +7 -0
- package/dist/BulkActionBar/BulkActionBar.js +145 -0
- package/dist/BulkActionBar/BulkActionBar.manifest.js +46 -0
- package/dist/BulkActionBar/index.js +9 -0
- package/dist/BulkActionBar/selection.js +44 -0
- package/dist/BulkResults/BulkResults.js +269 -0
- package/dist/BulkResults/BulkResults.manifest.js +45 -0
- package/dist/BulkResults/index.js +7 -0
- package/dist/Button/Button.js +170 -0
- package/dist/Button/Button.manifest.js +36 -0
- package/dist/Button/index.js +7 -0
- package/dist/ButtonGroup/ButtonGroup.js +60 -0
- package/dist/ButtonGroup/ButtonGroup.manifest.js +22 -0
- package/dist/ButtonGroup/index.js +7 -0
- package/dist/Calendar/Calendar.js +106 -0
- package/dist/Calendar/Calendar.manifest.js +32 -0
- package/dist/Calendar/index.js +7 -0
- package/dist/Card/Card.js +70 -0
- package/dist/Card/Card.manifest.js +57 -0
- package/dist/Card/index.js +16 -0
- package/dist/Chart/Chart.js +1200 -0
- package/dist/Chart/Chart.manifest.js +110 -0
- package/dist/Chart/ChartControls.js +190 -0
- package/dist/Chart/geometry.js +217 -0
- package/dist/Chart/index.js +9 -0
- package/dist/Checkbox/Checkbox.js +166 -0
- package/dist/Checkbox/Checkbox.manifest.js +38 -0
- package/dist/Checkbox/index.js +7 -0
- package/dist/Collapsible/Collapsible.js +177 -0
- package/dist/Collapsible/Collapsible.manifest.js +54 -0
- package/dist/Collapsible/index.js +12 -0
- package/dist/CollectionState/CollectionState.js +68 -0
- package/dist/CollectionState/CollectionState.manifest.js +44 -0
- package/dist/CollectionState/index.js +7 -0
- package/dist/ComboBox/ComboBox.js +221 -0
- package/dist/ComboBox/ComboBox.manifest.js +87 -0
- package/dist/ComboBox/index.js +7 -0
- package/dist/CommandPalette/CommandPalette.js +276 -0
- package/dist/CommandPalette/CommandPalette.manifest.js +24 -0
- package/dist/CommandPalette/index.js +7 -0
- package/dist/ConfirmDialog/ConfirmDialog.js +84 -0
- package/dist/ConfirmDialog/ConfirmDialog.manifest.js +32 -0
- package/dist/ConfirmDialog/index.js +7 -0
- package/dist/ContextMenu/ContextMenu.js +192 -0
- package/dist/ContextMenu/ContextMenu.manifest.js +41 -0
- package/dist/ContextMenu/index.js +7 -0
- package/dist/CoordinateInput/CoordinateInput.js +141 -0
- package/dist/CoordinateInput/CoordinateInput.manifest.js +36 -0
- package/dist/CoordinateInput/index.js +9 -0
- package/dist/CopyButton/CopyButton.js +110 -0
- package/dist/CopyButton/CopyButton.manifest.js +35 -0
- package/dist/CopyButton/index.js +7 -0
- package/dist/DataGrid/DataGrid.js +459 -0
- package/dist/DataGrid/DataGrid.manifest.js +135 -0
- package/dist/DataGrid/PageControls.js +41 -0
- package/dist/DataGrid/index.js +9 -0
- package/dist/DataTable/DataTable.js +375 -0
- package/dist/DataTable/DataTable.manifest.js +86 -0
- package/dist/DataTable/index.js +9 -0
- package/dist/DataTable/sort.js +45 -0
- package/dist/DataTable/useScrollsSideways.js +61 -0
- package/dist/DataTable/useTableWindow.js +185 -0
- package/dist/DatePicker/DatePicker.js +187 -0
- package/dist/DatePicker/DatePicker.manifest.js +40 -0
- package/dist/DatePicker/index.js +7 -0
- package/dist/DateRangePicker/DateRangePicker.js +156 -0
- package/dist/DateRangePicker/DateRangePicker.manifest.js +41 -0
- package/dist/DateRangePicker/index.js +7 -0
- package/dist/DateTimePicker/DateTimePicker.js +213 -0
- package/dist/DateTimePicker/DateTimePicker.manifest.js +44 -0
- package/dist/DateTimePicker/index.js +7 -0
- package/dist/DescriptionList/DescriptionList.js +93 -0
- package/dist/DescriptionList/DescriptionList.manifest.js +40 -0
- package/dist/DescriptionList/index.js +9 -0
- package/dist/Dialog/Dialog.js +214 -0
- package/dist/Dialog/Dialog.manifest.js +31 -0
- package/dist/Dialog/index.js +7 -0
- package/dist/Divider/Divider.js +64 -0
- package/dist/Divider/Divider.manifest.js +21 -0
- package/dist/Divider/index.js +7 -0
- package/dist/DropdownMenu/DropdownMenu.js +170 -0
- package/dist/DropdownMenu/DropdownMenu.manifest.js +82 -0
- package/dist/DropdownMenu/index.js +16 -0
- package/dist/EntityPreview/EntityPreview.js +82 -0
- package/dist/EntityPreview/EntityPreview.manifest.js +43 -0
- package/dist/EntityPreview/index.js +7 -0
- package/dist/EventTimeline/EventTimeline.js +249 -0
- package/dist/EventTimeline/EventTimeline.manifest.js +57 -0
- package/dist/EventTimeline/index.js +7 -0
- package/dist/Field/Field.js +81 -0
- package/dist/Field/Field.manifest.js +32 -0
- package/dist/Field/index.js +9 -0
- package/dist/FileUpload/FileUpload.js +215 -0
- package/dist/FileUpload/FileUpload.manifest.js +48 -0
- package/dist/FileUpload/index.js +7 -0
- package/dist/FilterBar/FilterBar.js +173 -0
- package/dist/FilterBar/FilterBar.manifest.js +49 -0
- package/dist/FilterBar/index.js +7 -0
- package/dist/FormErrorSummary/FormErrorSummary.js +70 -0
- package/dist/FormErrorSummary/FormErrorSummary.manifest.js +29 -0
- package/dist/FormErrorSummary/index.js +9 -0
- package/dist/FormSection/FormSection.js +51 -0
- package/dist/FormSection/FormSection.manifest.js +30 -0
- package/dist/FormSection/index.js +7 -0
- package/dist/InlineEdit/InlineEdit.js +261 -0
- package/dist/InlineEdit/InlineEdit.manifest.js +40 -0
- package/dist/InlineEdit/index.js +7 -0
- package/dist/Input/Input.js +126 -0
- package/dist/Input/Input.manifest.js +49 -0
- package/dist/Input/index.js +7 -0
- package/dist/Inspector/Inspector.js +63 -0
- package/dist/Inspector/Inspector.manifest.js +35 -0
- package/dist/Inspector/index.js +7 -0
- package/dist/JobStatus/JobStatus.js +118 -0
- package/dist/JobStatus/JobStatus.manifest.js +53 -0
- package/dist/JobStatus/index.js +7 -0
- package/dist/LayerControl/LayerControl.js +199 -0
- package/dist/LayerControl/LayerControl.manifest.js +34 -0
- package/dist/LayerControl/index.js +7 -0
- package/dist/Link/Link.js +83 -0
- package/dist/Link/Link.manifest.js +37 -0
- package/dist/Link/index.js +7 -0
- package/dist/MapControls/MapControls.js +122 -0
- package/dist/MapControls/MapControls.manifest.js +31 -0
- package/dist/MapControls/index.js +7 -0
- package/dist/MapLegend/MapLegend.js +89 -0
- package/dist/MapLegend/MapLegend.manifest.js +29 -0
- package/dist/MapLegend/index.js +7 -0
- package/dist/MapScale/MapScale.js +96 -0
- package/dist/MapScale/MapScale.manifest.js +31 -0
- package/dist/MapScale/index.js +7 -0
- package/dist/MediaFrame/MediaFrame.js +113 -0
- package/dist/MediaFrame/MediaFrame.manifest.js +57 -0
- package/dist/MediaFrame/index.js +7 -0
- package/dist/MultiSelect/MultiSelect.js +113 -0
- package/dist/MultiSelect/MultiSelect.manifest.js +51 -0
- package/dist/MultiSelect/index.js +7 -0
- package/dist/NumberInput/NumberInput.js +210 -0
- package/dist/NumberInput/NumberInput.manifest.js +56 -0
- package/dist/NumberInput/index.js +7 -0
- package/dist/OperationalStatus/OperationalStatus.js +89 -0
- package/dist/OperationalStatus/OperationalStatus.manifest.js +39 -0
- package/dist/OperationalStatus/index.js +9 -0
- package/dist/PlaybackControls/PlaybackControls.js +289 -0
- package/dist/PlaybackControls/PlaybackControls.manifest.js +85 -0
- package/dist/PlaybackControls/index.js +7 -0
- package/dist/Popover/Popover.js +302 -0
- package/dist/Popover/Popover.manifest.js +50 -0
- package/dist/Popover/index.js +7 -0
- package/dist/Progress/Progress.js +132 -0
- package/dist/Progress/Progress.manifest.js +30 -0
- package/dist/Progress/index.js +7 -0
- package/dist/PropertyFilter/PropertyFilter.js +306 -0
- package/dist/PropertyFilter/PropertyFilter.manifest.js +32 -0
- package/dist/PropertyFilter/index.js +11 -0
- package/dist/PropertyFilter/tokenError.js +17 -0
- package/dist/RadioGroup/RadioGroup.js +143 -0
- package/dist/RadioGroup/RadioGroup.manifest.js +44 -0
- package/dist/RadioGroup/index.js +9 -0
- package/dist/Select/Select.js +219 -0
- package/dist/Select/Select.manifest.js +77 -0
- package/dist/Select/index.js +9 -0
- package/dist/Sidebar/Sidebar.js +146 -0
- package/dist/Sidebar/Sidebar.manifest.js +72 -0
- package/dist/Sidebar/index.js +18 -0
- package/dist/Skeleton/Skeleton.js +76 -0
- package/dist/Skeleton/Skeleton.manifest.js +30 -0
- package/dist/Skeleton/index.js +7 -0
- package/dist/Slider/Slider.js +246 -0
- package/dist/Slider/Slider.manifest.js +56 -0
- package/dist/Slider/index.js +7 -0
- package/dist/Sparkline/Sparkline.js +135 -0
- package/dist/Sparkline/Sparkline.manifest.js +37 -0
- package/dist/Sparkline/index.js +7 -0
- package/dist/SplitPane/SplitPane.js +316 -0
- package/dist/SplitPane/SplitPane.manifest.js +79 -0
- package/dist/SplitPane/index.js +7 -0
- package/dist/StatCard/StatCard.js +163 -0
- package/dist/StatCard/StatCard.manifest.js +45 -0
- package/dist/StatCard/index.js +7 -0
- package/dist/Tabs/Tabs.js +181 -0
- package/dist/Tabs/Tabs.manifest.js +72 -0
- package/dist/Tabs/index.js +16 -0
- package/dist/Tabs/useTabsIndicator.js +71 -0
- package/dist/Tabs/useTabsScroll.js +123 -0
- package/dist/TagGroup/TagGroup.js +142 -0
- package/dist/TagGroup/TagGroup.manifest.js +35 -0
- package/dist/TagGroup/index.js +7 -0
- package/dist/Textarea/Textarea.js +68 -0
- package/dist/Textarea/Textarea.manifest.js +25 -0
- package/dist/Textarea/index.js +7 -0
- package/dist/TimeField/TimeField.js +118 -0
- package/dist/TimeField/TimeField.manifest.js +42 -0
- package/dist/TimeField/index.js +7 -0
- package/dist/TimeRange/TimeRange.js +184 -0
- package/dist/TimeRange/TimeRange.manifest.js +48 -0
- package/dist/TimeRange/index.js +9 -0
- package/dist/Toast/Toast.js +188 -0
- package/dist/Toast/Toast.manifest.js +77 -0
- package/dist/Toast/index.js +9 -0
- package/dist/Toggle/Toggle.js +154 -0
- package/dist/Toggle/Toggle.manifest.js +54 -0
- package/dist/Toggle/index.js +7 -0
- package/dist/Toolbar/Toolbar.js +86 -0
- package/dist/Toolbar/Toolbar.manifest.js +70 -0
- package/dist/Toolbar/index.js +12 -0
- package/dist/Tooltip/Tooltip.js +122 -0
- package/dist/Tooltip/Tooltip.manifest.js +27 -0
- package/dist/Tooltip/index.js +7 -0
- package/dist/TreeView/TreeView.js +129 -0
- package/dist/TreeView/TreeView.manifest.js +56 -0
- package/dist/TreeView/index.js +7 -0
- package/dist/UploadQueue/UploadQueue.js +296 -0
- package/dist/UploadQueue/UploadQueue.manifest.js +34 -0
- package/dist/UploadQueue/index.js +7 -0
- package/dist/_internal/MotionPopover.js +113 -0
- package/dist/_internal/aria.js +40 -0
- package/dist/_internal/bytes.js +18 -0
- package/dist/_internal/controlStyles.js +26 -0
- package/dist/_internal/date.js +179 -0
- package/dist/_internal/devValidate.js +51 -0
- package/dist/_internal/fieldIds.js +50 -0
- package/dist/_internal/hydration.js +74 -0
- package/dist/_internal/manifest-entry.js +0 -0
- package/dist/_internal/mergeRefs.js +68 -0
- package/dist/_internal/motion.js +138 -0
- package/dist/_internal/navigationLandmark.js +13 -0
- package/dist/_internal/numberText.js +176 -0
- package/dist/_internal/overlay.js +53 -0
- package/dist/_internal/segmentField.js +125 -0
- package/dist/_internal/suggestions.js +20 -0
- package/dist/_internal/timestamp.js +25 -0
- package/dist/_internal/unavailable.js +13 -0
- package/dist/_internal/useActionFocus.js +27 -0
- package/dist/_internal/useElementWidth.js +37 -0
- package/dist/_internal/useIsMounted.js +18 -0
- package/dist/_internal/useIsomorphicLayoutEffect.js +8 -0
- package/dist/_internal/useRestoreFocusOnRemoval.js +57 -0
- package/dist/index.cjs +17811 -0
- package/dist/index.d.cts +2330 -0
- package/dist/index.d.ts +2330 -0
- package/dist/index.js +407 -0
- package/dist/version.js +8 -0
- package/package.json +80 -3
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/Divider/Divider.tsx
|
|
4
|
+
import { Separator } from "react-aria-components";
|
|
5
|
+
import { forwardRef } from "react";
|
|
6
|
+
import clsx from "clsx";
|
|
7
|
+
import { DividerManifest } from "./Divider.manifest.js";
|
|
8
|
+
import { devValidate } from "../_internal/devValidate.js";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
var lineStyles = "bg-oprt-border";
|
|
11
|
+
var Divider = forwardRef((allProps, ref) => {
|
|
12
|
+
const {
|
|
13
|
+
className,
|
|
14
|
+
orientation: requested = "horizontal",
|
|
15
|
+
decorative = true,
|
|
16
|
+
label,
|
|
17
|
+
...props
|
|
18
|
+
} = allProps;
|
|
19
|
+
if (process.env.NODE_ENV !== "production") {
|
|
20
|
+
devValidate("Divider", DividerManifest.Divider.props, { ...allProps });
|
|
21
|
+
}
|
|
22
|
+
const orientation = requested ?? "horizontal";
|
|
23
|
+
if (label && orientation === "horizontal") {
|
|
24
|
+
return /* @__PURE__ */ jsxs(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
ref,
|
|
28
|
+
role: decorative ? "none" : "separator",
|
|
29
|
+
"aria-orientation": decorative ? void 0 : "horizontal",
|
|
30
|
+
...decorative ? {} : { "aria-label": label },
|
|
31
|
+
className: clsx("flex items-center gap-2u", className),
|
|
32
|
+
...props,
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: clsx("flex-1 h-px min-w-2u", lineStyles) }),
|
|
35
|
+
/* @__PURE__ */ jsx("span", { className: "m-0 min-w-0 text-center text-oprt-sm uppercase tracking-oprt-sm text-oprt-text-dim oprt-wrap-anywhere", children: label }),
|
|
36
|
+
/* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: clsx("flex-1 h-px min-w-2u", lineStyles) })
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
const lineClass = clsx(
|
|
42
|
+
lineStyles,
|
|
43
|
+
orientation === "vertical" ? "w-px self-stretch" : "h-px w-full",
|
|
44
|
+
className
|
|
45
|
+
);
|
|
46
|
+
if (decorative) {
|
|
47
|
+
return /* @__PURE__ */ jsx("div", { ref, role: "none", "data-orientation": orientation, className: lineClass, ...props });
|
|
48
|
+
}
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
Separator,
|
|
51
|
+
{
|
|
52
|
+
ref,
|
|
53
|
+
elementType: "div",
|
|
54
|
+
orientation,
|
|
55
|
+
"data-orientation": orientation,
|
|
56
|
+
className: lineClass,
|
|
57
|
+
...props
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
Divider.displayName = "Divider";
|
|
62
|
+
export {
|
|
63
|
+
Divider
|
|
64
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/Divider/Divider.manifest.ts
|
|
2
|
+
var DividerManifest = {
|
|
3
|
+
Divider: {
|
|
4
|
+
description: "Thin rule that separates content, with an optional centered uppercase label (horizontal only). A horizontal rule takes the width of its container and a vertical one the height of its flex row. A long label wraps between its two lines and breaks anywhere. A semantic labeled divider is named by its label.",
|
|
5
|
+
props: {
|
|
6
|
+
orientation: {
|
|
7
|
+
type: "enum",
|
|
8
|
+
values: ["horizontal", "vertical"],
|
|
9
|
+
default: "horizontal",
|
|
10
|
+
description: "The direction of the rule. A vertical rule stretches to the height of its flex row, so put it in a flex row or give it a height."
|
|
11
|
+
},
|
|
12
|
+
decorative: { type: "boolean", default: true },
|
|
13
|
+
label: { type: "string" }
|
|
14
|
+
},
|
|
15
|
+
composable_with: ["Card", "Sidebar"],
|
|
16
|
+
example: "<Divider />"
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
DividerManifest
|
|
21
|
+
};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/DropdownMenu/DropdownMenu.tsx
|
|
4
|
+
import {
|
|
5
|
+
MenuTrigger,
|
|
6
|
+
Menu,
|
|
7
|
+
MenuItem,
|
|
8
|
+
Separator,
|
|
9
|
+
Header,
|
|
10
|
+
Pressable,
|
|
11
|
+
Text,
|
|
12
|
+
Keyboard
|
|
13
|
+
} from "react-aria-components";
|
|
14
|
+
import {
|
|
15
|
+
createContext,
|
|
16
|
+
forwardRef,
|
|
17
|
+
useCallback,
|
|
18
|
+
useContext,
|
|
19
|
+
useRef,
|
|
20
|
+
useState
|
|
21
|
+
} from "react";
|
|
22
|
+
import clsx from "clsx";
|
|
23
|
+
import { Button } from "../Button/Button.js";
|
|
24
|
+
import { DropdownMenuManifest } from "./DropdownMenu.manifest.js";
|
|
25
|
+
import { devValidate } from "../_internal/devValidate.js";
|
|
26
|
+
import { definedOnly } from "../_internal/aria.js";
|
|
27
|
+
import { useHydrationRoot } from "../_internal/hydration.js";
|
|
28
|
+
import { MotionContext, useMotion } from "../_internal/motion.js";
|
|
29
|
+
import { MotionPopover } from "../_internal/MotionPopover.js";
|
|
30
|
+
import {
|
|
31
|
+
DESTRUCTIVE_ACTION,
|
|
32
|
+
MENU_ITEM_DESCRIPTION,
|
|
33
|
+
MENU_ITEM_LABEL,
|
|
34
|
+
MENU_ITEM_SHORTCUT,
|
|
35
|
+
MENU_ITEM_TEXT,
|
|
36
|
+
MENU_OFFSET,
|
|
37
|
+
MENU_SURFACE,
|
|
38
|
+
SCREEN_MARGIN,
|
|
39
|
+
isSingleElement,
|
|
40
|
+
menuItemStyles,
|
|
41
|
+
toPlacement
|
|
42
|
+
} from "../_internal/overlay.js";
|
|
43
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
44
|
+
var KeepOpenContext = createContext(null);
|
|
45
|
+
var DropdownMenu = forwardRef((props, ref) => {
|
|
46
|
+
const {
|
|
47
|
+
motion = "auto",
|
|
48
|
+
trigger,
|
|
49
|
+
open,
|
|
50
|
+
defaultOpen = false,
|
|
51
|
+
onOpenChange,
|
|
52
|
+
align = "start",
|
|
53
|
+
side = "bottom",
|
|
54
|
+
className,
|
|
55
|
+
children
|
|
56
|
+
} = props;
|
|
57
|
+
const motionState = useMotion(motion);
|
|
58
|
+
const [localOpen, setLocalOpen] = useState(defaultOpen);
|
|
59
|
+
const isOpen = open ?? localOpen;
|
|
60
|
+
const keepOpen = useRef(false);
|
|
61
|
+
const requestOpen = useCallback(
|
|
62
|
+
(next) => {
|
|
63
|
+
if (!next && keepOpen.current) {
|
|
64
|
+
keepOpen.current = false;
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (open === void 0) setLocalOpen(next);
|
|
68
|
+
onOpenChange?.(next);
|
|
69
|
+
},
|
|
70
|
+
[open, onOpenChange]
|
|
71
|
+
);
|
|
72
|
+
if (process.env.NODE_ENV !== "production") {
|
|
73
|
+
devValidate("DropdownMenu", DropdownMenuManifest.DropdownMenu.props, {
|
|
74
|
+
...props,
|
|
75
|
+
align,
|
|
76
|
+
side
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const hydration = useHydrationRoot();
|
|
80
|
+
return /* @__PURE__ */ jsx(MotionContext.Provider, { value: motionState.mode, children: /* @__PURE__ */ jsx(KeepOpenContext.Provider, { value: keepOpen, children: /* @__PURE__ */ jsxs(MenuTrigger, { isOpen, onOpenChange: requestOpen, children: [
|
|
81
|
+
/* @__PURE__ */ jsx("span", { className: "contents", ...motionState.props, ...hydration.probeProps, children: /* @__PURE__ */ jsx(Pressable, { children: isSingleElement(trigger) ? trigger : /* @__PURE__ */ jsx(Button, { variant: "secondary", children: trigger }) }) }),
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
MotionPopover,
|
|
84
|
+
{
|
|
85
|
+
motionState,
|
|
86
|
+
offset: MENU_OFFSET,
|
|
87
|
+
containerPadding: SCREEN_MARGIN,
|
|
88
|
+
placement: toPlacement(side, align),
|
|
89
|
+
className: clsx(MENU_SURFACE, className),
|
|
90
|
+
children: /* @__PURE__ */ jsx(Menu, { ref, className: "outline-hidden", children })
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
] }, hydration.key) }) });
|
|
94
|
+
});
|
|
95
|
+
DropdownMenu.displayName = "DropdownMenu";
|
|
96
|
+
var DropdownMenuItem = forwardRef(
|
|
97
|
+
({ className, shortcut, danger = false, disabled, textValue, onSelect, children, ...props }, ref) => {
|
|
98
|
+
const keepOpen = useContext(KeepOpenContext);
|
|
99
|
+
const itemProps = { ...definedOnly(props) };
|
|
100
|
+
if (textValue !== void 0) itemProps["textValue"] = textValue;
|
|
101
|
+
else if (typeof children === "string") itemProps["textValue"] = children;
|
|
102
|
+
if (onSelect) {
|
|
103
|
+
itemProps["onAction"] = () => {
|
|
104
|
+
const event = new CustomEvent("menuitemselect", { cancelable: true });
|
|
105
|
+
onSelect(event);
|
|
106
|
+
if (!event.defaultPrevented || !keepOpen) return;
|
|
107
|
+
keepOpen.current = true;
|
|
108
|
+
queueMicrotask(() => {
|
|
109
|
+
keepOpen.current = false;
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return /* @__PURE__ */ jsxs(
|
|
114
|
+
MenuItem,
|
|
115
|
+
{
|
|
116
|
+
ref,
|
|
117
|
+
isDisabled: disabled ?? false,
|
|
118
|
+
className: clsx(menuItemStyles({ danger }), className),
|
|
119
|
+
...itemProps,
|
|
120
|
+
children: [
|
|
121
|
+
/* @__PURE__ */ jsxs("span", { className: MENU_ITEM_TEXT, children: [
|
|
122
|
+
/* @__PURE__ */ jsx(Text, { slot: "label", className: MENU_ITEM_LABEL, children }),
|
|
123
|
+
danger && /* @__PURE__ */ jsx(Text, { slot: "description", className: MENU_ITEM_DESCRIPTION, children: DESTRUCTIVE_ACTION })
|
|
124
|
+
] }),
|
|
125
|
+
shortcut && /* @__PURE__ */ jsx(Keyboard, { className: MENU_ITEM_SHORTCUT, children: shortcut })
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
DropdownMenuItem.displayName = "DropdownMenuItem";
|
|
132
|
+
var DropdownMenuSeparator = forwardRef(
|
|
133
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
134
|
+
Separator,
|
|
135
|
+
{
|
|
136
|
+
ref,
|
|
137
|
+
elementType: "div",
|
|
138
|
+
className: clsx("h-px bg-oprt-border my-1u", className),
|
|
139
|
+
...definedOnly(props)
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
);
|
|
143
|
+
DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
|
|
144
|
+
var DropdownMenuLabel = forwardRef(
|
|
145
|
+
({ className, ...props }, ref) => (
|
|
146
|
+
// RAC's Header is a valid collection leaf inside a Menu, but a bare
|
|
147
|
+
// <header> element maps to the `banner` landmark role, which is illegal
|
|
148
|
+
// inside role="menu". role="presentation" strips that back to the inert
|
|
149
|
+
// text node Radix's Label rendered.
|
|
150
|
+
/* @__PURE__ */ jsx(
|
|
151
|
+
Header,
|
|
152
|
+
{
|
|
153
|
+
ref,
|
|
154
|
+
role: "presentation",
|
|
155
|
+
className: clsx(
|
|
156
|
+
"m-0 px-3u py-1u text-oprt-sm uppercase tracking-oprt-sm text-oprt-text-dim oprt-wrap-anywhere [&_code]:normal-case [&_code]:tracking-normal [&_kbd]:normal-case [&_kbd]:tracking-normal",
|
|
157
|
+
className
|
|
158
|
+
),
|
|
159
|
+
...definedOnly(props)
|
|
160
|
+
}
|
|
161
|
+
)
|
|
162
|
+
)
|
|
163
|
+
);
|
|
164
|
+
DropdownMenuLabel.displayName = "DropdownMenuLabel";
|
|
165
|
+
export {
|
|
166
|
+
DropdownMenu,
|
|
167
|
+
DropdownMenuItem,
|
|
168
|
+
DropdownMenuLabel,
|
|
169
|
+
DropdownMenuSeparator
|
|
170
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// src/DropdownMenu/DropdownMenu.manifest.ts
|
|
2
|
+
var DropdownMenuManifest = {
|
|
3
|
+
DropdownMenu: {
|
|
4
|
+
description: "Portal'd action menu anchored to a trigger element. Holds DropdownMenuItem, DropdownMenuSeparator, and DropdownMenuLabel children.",
|
|
5
|
+
props: {
|
|
6
|
+
motion: {
|
|
7
|
+
type: "enum",
|
|
8
|
+
values: ["auto", "none"],
|
|
9
|
+
default: "auto",
|
|
10
|
+
description: "Tactile pointer arrival and exit; keyboard, assistive activation, and system reduced motion remain immediate."
|
|
11
|
+
},
|
|
12
|
+
trigger: {
|
|
13
|
+
type: "node",
|
|
14
|
+
required: true,
|
|
15
|
+
description: "One focusable element that forwards its ref and handlers, such as a Button; plain text renders a secondary Button."
|
|
16
|
+
},
|
|
17
|
+
open: { type: "boolean" },
|
|
18
|
+
defaultOpen: { type: "boolean" },
|
|
19
|
+
onOpenChange: { type: "function" },
|
|
20
|
+
align: { type: "enum", values: ["start", "center", "end"], default: "start" },
|
|
21
|
+
side: { type: "enum", values: ["top", "right", "bottom", "left"], default: "bottom" }
|
|
22
|
+
},
|
|
23
|
+
slots: {
|
|
24
|
+
children: {
|
|
25
|
+
type: "DropdownMenuItem | DropdownMenuSeparator | DropdownMenuLabel",
|
|
26
|
+
required: true
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
composable_with: ["Toolbar", "CardHeader"],
|
|
30
|
+
never_inside: ["Button", "Badge"],
|
|
31
|
+
example: '<DropdownMenu trigger={<Button variant="secondary">ACTIONS</Button>}>\n <DropdownMenuLabel>ACTIONS</DropdownMenuLabel>\n <DropdownMenuItem shortcut="\u2318C">COPY</DropdownMenuItem>\n <DropdownMenuSeparator />\n <DropdownMenuItem danger>DELETE</DropdownMenuItem>\n</DropdownMenu>'
|
|
32
|
+
},
|
|
33
|
+
DropdownMenuItem: {
|
|
34
|
+
description: "Selectable uppercase action row inside a DropdownMenu. Keyboard shortcuts, code, and kbd retain their casing. Wrap other case-sensitive names or IDs in a child with normal-case tracking-normal. Supports a danger style.",
|
|
35
|
+
props: {
|
|
36
|
+
shortcut: {
|
|
37
|
+
type: "string",
|
|
38
|
+
description: "Display text for an application-owned shortcut; it describes the item."
|
|
39
|
+
},
|
|
40
|
+
danger: {
|
|
41
|
+
type: "boolean",
|
|
42
|
+
default: false,
|
|
43
|
+
description: "Colors the item and adds a written \u201CDestructive action\u201D description."
|
|
44
|
+
},
|
|
45
|
+
disabled: { type: "boolean", default: false },
|
|
46
|
+
textValue: {
|
|
47
|
+
type: "string",
|
|
48
|
+
description: "Plain text for typeahead when children are not a string (for example a <code> ID)."
|
|
49
|
+
},
|
|
50
|
+
onSelect: {
|
|
51
|
+
type: "function",
|
|
52
|
+
description: "Receives a cancelable event; call event.preventDefault() to keep the menu open."
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
composable_with: ["DropdownMenu"],
|
|
56
|
+
never_inside: ["Button", "Badge"],
|
|
57
|
+
example: '<DropdownMenuItem shortcut="\u2318C">COPY</DropdownMenuItem>'
|
|
58
|
+
},
|
|
59
|
+
DropdownMenuSeparator: {
|
|
60
|
+
description: "Thin horizontal rule grouping items inside a DropdownMenu.",
|
|
61
|
+
props: {},
|
|
62
|
+
composable_with: ["DropdownMenu"],
|
|
63
|
+
never_inside: ["Button", "Badge"],
|
|
64
|
+
example: "<DropdownMenuSeparator />"
|
|
65
|
+
},
|
|
66
|
+
DropdownMenuLabel: {
|
|
67
|
+
description: "Non-interactive uppercase section heading inside a DropdownMenu.",
|
|
68
|
+
props: {},
|
|
69
|
+
composable_with: ["DropdownMenu"],
|
|
70
|
+
never_inside: ["Button", "Badge"],
|
|
71
|
+
example: "<DropdownMenuLabel>ACTIONS</DropdownMenuLabel>"
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var DropdownMenuCompositionRules = {
|
|
75
|
+
DropdownMenu: {
|
|
76
|
+
allowed_children: ["DropdownMenuItem", "DropdownMenuSeparator", "DropdownMenuLabel"]
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
export {
|
|
80
|
+
DropdownMenuCompositionRules,
|
|
81
|
+
DropdownMenuManifest
|
|
82
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/DropdownMenu/index.ts
|
|
2
|
+
import {
|
|
3
|
+
DropdownMenu,
|
|
4
|
+
DropdownMenuItem,
|
|
5
|
+
DropdownMenuSeparator,
|
|
6
|
+
DropdownMenuLabel
|
|
7
|
+
} from "./DropdownMenu.js";
|
|
8
|
+
import { DropdownMenuManifest, DropdownMenuCompositionRules } from "./DropdownMenu.manifest.js";
|
|
9
|
+
export {
|
|
10
|
+
DropdownMenu,
|
|
11
|
+
DropdownMenuCompositionRules,
|
|
12
|
+
DropdownMenuItem,
|
|
13
|
+
DropdownMenuLabel,
|
|
14
|
+
DropdownMenuManifest,
|
|
15
|
+
DropdownMenuSeparator
|
|
16
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/EntityPreview/EntityPreview.tsx
|
|
4
|
+
import { forwardRef, useId } from "react";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import clsx from "clsx";
|
|
7
|
+
import { Badge } from "../Badge/Badge.js";
|
|
8
|
+
import { DescriptionList } from "../DescriptionList/DescriptionList.js";
|
|
9
|
+
import {
|
|
10
|
+
OperationalStatus
|
|
11
|
+
} from "../OperationalStatus/OperationalStatus.js";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
var previewStyles = cva(
|
|
14
|
+
"flex min-w-0 flex-col gap-2u font-sans text-oprt-base normal-case tracking-normal text-oprt-text"
|
|
15
|
+
);
|
|
16
|
+
var EntityPreview = forwardRef(
|
|
17
|
+
({ entity, media, actions, headingLevel = 3, className, ...props }, ref) => {
|
|
18
|
+
const instanceId = useId();
|
|
19
|
+
const headingId = `${instanceId}-name`;
|
|
20
|
+
const conditionId = `${instanceId}-condition`;
|
|
21
|
+
const Heading = `h${headingLevel}`;
|
|
22
|
+
return /* @__PURE__ */ jsxs(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
role: "group",
|
|
26
|
+
"aria-labelledby": headingId,
|
|
27
|
+
...props,
|
|
28
|
+
ref,
|
|
29
|
+
className: clsx(previewStyles(), className),
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-1u", children: [
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
Heading,
|
|
34
|
+
{
|
|
35
|
+
id: headingId,
|
|
36
|
+
className: "m-0 oprt-wrap-anywhere text-oprt-lg font-semibold normal-case tracking-normal",
|
|
37
|
+
children: entity.name
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
(entity.typeLabel || entity.id !== entity.name) && /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-wrap items-baseline justify-between gap-x-2u gap-y-0.5u text-oprt-text-dim", children: [
|
|
41
|
+
entity.typeLabel && /* @__PURE__ */ jsx("p", { className: "m-0 min-w-0 oprt-wrap-anywhere text-oprt-sm font-medium uppercase tracking-oprt-sm", children: entity.typeLabel }),
|
|
42
|
+
entity.id !== entity.name && /* @__PURE__ */ jsx("p", { className: "m-0 min-w-0 oprt-wrap-anywhere font-mono normal-case tracking-normal", children: entity.id })
|
|
43
|
+
] }),
|
|
44
|
+
entity.summary && /* @__PURE__ */ jsx("p", { className: "m-0 mt-1u oprt-wrap-anywhere normal-case tracking-normal text-oprt-text-dim", children: entity.summary })
|
|
45
|
+
] }),
|
|
46
|
+
media != null && /* @__PURE__ */ jsx("div", { className: "min-w-0 [&_img]:max-w-full [&_video]:max-w-full", children: media }),
|
|
47
|
+
(entity.condition || entity.facts.length > 0) && /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex flex-col gap-1u border-t border-oprt-border pt-2u", children: [
|
|
48
|
+
entity.condition && /* @__PURE__ */ jsx("div", { role: "group", "aria-labelledby": conditionId, children: /* @__PURE__ */ jsx(
|
|
49
|
+
DescriptionList,
|
|
50
|
+
{
|
|
51
|
+
layout: "details",
|
|
52
|
+
items: [
|
|
53
|
+
{
|
|
54
|
+
id: "condition",
|
|
55
|
+
label: /* @__PURE__ */ jsx("span", { id: conditionId, children: "Condition" }),
|
|
56
|
+
value: /* @__PURE__ */ jsx(
|
|
57
|
+
Badge,
|
|
58
|
+
{
|
|
59
|
+
variant: entity.condition.variant ?? "neutral",
|
|
60
|
+
appearance: "text",
|
|
61
|
+
size: "md",
|
|
62
|
+
className: "ml-auto tracking-oprt-sm",
|
|
63
|
+
children: entity.condition.label
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
) }),
|
|
70
|
+
entity.facts.length > 0 && /* @__PURE__ */ jsx(DescriptionList, { items: entity.facts, layout: "details" })
|
|
71
|
+
] }),
|
|
72
|
+
/* @__PURE__ */ jsx(OperationalStatus, { ...entity.quality, className: "border-t border-oprt-border pt-2u" }),
|
|
73
|
+
actions != null && /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-wrap items-center gap-1u border-t border-oprt-border pt-2u", children: actions })
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
EntityPreview.displayName = "EntityPreview";
|
|
80
|
+
export {
|
|
81
|
+
EntityPreview
|
|
82
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// src/EntityPreview/EntityPreview.manifest.ts
|
|
2
|
+
var EntityPreviewManifest = {
|
|
3
|
+
EntityPreview: {
|
|
4
|
+
description: "Entity identity with aligned label/value rows for condition, structured facts and report quality in transient or persistent inspection.",
|
|
5
|
+
props: {
|
|
6
|
+
entity: {
|
|
7
|
+
type: "node",
|
|
8
|
+
required: true,
|
|
9
|
+
description: "EntityPreviewRecord: id, name, readonly DescriptionListItem facts, and quality (OperationalStatus state/source/updatedAt/detail); optional typeLabel, summary, and condition { label, variant }. Application identity is never used as a DOM ID. An ID identical to the name appears only in the heading. Pass a complete replacement record on update. Condition and facts use DescriptionList details; report quality uses OperationalStatus. Text-only badges, muted labels and right-aligned values share 40/60 columns with wrapping. No data fetching, health inference, or freshness calculation."
|
|
10
|
+
},
|
|
11
|
+
media: {
|
|
12
|
+
type: "node",
|
|
13
|
+
description: "Optional supplied image, video, or other media content. The caller owns sizing, alternative text, transport, and controls."
|
|
14
|
+
},
|
|
15
|
+
actions: {
|
|
16
|
+
type: "node",
|
|
17
|
+
description: "Optional named controls such as Link and CopyButton. The caller owns actions and selection."
|
|
18
|
+
},
|
|
19
|
+
headingLevel: {
|
|
20
|
+
type: "number",
|
|
21
|
+
default: 3,
|
|
22
|
+
description: "Entity name heading level: 2, 3, 4, 5, or 6. Choose it for the hosting surface's heading hierarchy."
|
|
23
|
+
},
|
|
24
|
+
className: { type: "string" }
|
|
25
|
+
},
|
|
26
|
+
slots: { media: { type: "ReactNode" }, actions: { type: "ReactNode" } },
|
|
27
|
+
composable_with: [
|
|
28
|
+
"Popover",
|
|
29
|
+
"Inspector",
|
|
30
|
+
"DescriptionList",
|
|
31
|
+
"OperationalStatus",
|
|
32
|
+
"Badge",
|
|
33
|
+
"Link",
|
|
34
|
+
"CopyButton",
|
|
35
|
+
"Button"
|
|
36
|
+
],
|
|
37
|
+
never_inside: ["Button", "Badge", "Link", "Tooltip"],
|
|
38
|
+
example: '<EntityPreview entity={{ id: "pump-07", name: "West pump", facts: [{ id: "pressure", label: "Pressure", value: "0 kPa", mono: true }], condition: { label: "Healthy", variant: "success" }, quality: { state: "stale", source: "Maintenance report", updatedAt: null } }} />'
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
EntityPreviewManifest
|
|
43
|
+
};
|