@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,38 @@
|
|
|
1
|
+
// src/Checkbox/Checkbox.manifest.ts
|
|
2
|
+
var CheckboxManifest = {
|
|
3
|
+
Checkbox: {
|
|
4
|
+
description: "Binary or tri-state checkbox. Shared OPERATOR Check icon when checked and Minus icon when indeterminate, inside an accent outline.",
|
|
5
|
+
props: {
|
|
6
|
+
motion: {
|
|
7
|
+
type: "enum",
|
|
8
|
+
values: ["auto", "none"],
|
|
9
|
+
default: "auto",
|
|
10
|
+
description: "Tactile pointer/touch feedback. None disables motion; keyboard and system reduced motion are always immediate."
|
|
11
|
+
},
|
|
12
|
+
checked: {
|
|
13
|
+
type: "enum",
|
|
14
|
+
values: ["true", "false", "indeterminate"],
|
|
15
|
+
description: "Pass boolean for binary state, or 'indeterminate' for tri-state."
|
|
16
|
+
},
|
|
17
|
+
defaultChecked: {
|
|
18
|
+
type: "enum",
|
|
19
|
+
values: ["true", "false", "indeterminate"]
|
|
20
|
+
},
|
|
21
|
+
onCheckedChange: {
|
|
22
|
+
type: "function",
|
|
23
|
+
description: "(checked: boolean | 'indeterminate') => void. Called when the operator checks or clears the box; the only way to observe a change."
|
|
24
|
+
},
|
|
25
|
+
disabled: { type: "boolean", default: false },
|
|
26
|
+
required: { type: "boolean", default: false },
|
|
27
|
+
size: { type: "enum", values: ["sm", "md", "lg"], default: "md" },
|
|
28
|
+
name: { type: "string" },
|
|
29
|
+
value: { type: "string" }
|
|
30
|
+
},
|
|
31
|
+
composable_with: ["Field"],
|
|
32
|
+
never_inside: ["Button", "Badge"],
|
|
33
|
+
example: '<Field label="ACKNOWLEDGE" required>\n <Checkbox />\n</Field>'
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
CheckboxManifest
|
|
38
|
+
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/Collapsible/Collapsible.tsx
|
|
4
|
+
import {
|
|
5
|
+
DisclosureGroup,
|
|
6
|
+
Disclosure,
|
|
7
|
+
DisclosurePanel,
|
|
8
|
+
Button as AriaButton,
|
|
9
|
+
Heading
|
|
10
|
+
} from "react-aria-components";
|
|
11
|
+
import { mergeProps } from "react-aria";
|
|
12
|
+
import { forwardRef, useRef, useState } from "react";
|
|
13
|
+
import clsx from "clsx";
|
|
14
|
+
import { ChevronDown } from "@oprt/icons";
|
|
15
|
+
import { CollapsibleManifest } from "./Collapsible.manifest.js";
|
|
16
|
+
import { devValidate } from "../_internal/devValidate.js";
|
|
17
|
+
import {
|
|
18
|
+
useMotion,
|
|
19
|
+
composeMotionHandlers,
|
|
20
|
+
MotionContext
|
|
21
|
+
} from "../_internal/motion.js";
|
|
22
|
+
import { useIsomorphicLayoutEffect } from "../_internal/useIsomorphicLayoutEffect.js";
|
|
23
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
24
|
+
function CollapsiblePanel({ expanded, children }) {
|
|
25
|
+
const panel = useRef(null);
|
|
26
|
+
const latestExpanded = useRef(expanded);
|
|
27
|
+
latestExpanded.current = expanded;
|
|
28
|
+
useIsomorphicLayoutEffect(() => {
|
|
29
|
+
const node = panel.current;
|
|
30
|
+
if (!node) return;
|
|
31
|
+
node.toggleAttribute("inert", !expanded);
|
|
32
|
+
if (!expanded && node.contains(document.activeElement)) {
|
|
33
|
+
document.getElementById(node.getAttribute("aria-labelledby") ?? "")?.focus();
|
|
34
|
+
}
|
|
35
|
+
const observer = new MutationObserver(() => {
|
|
36
|
+
if (latestExpanded.current && node.hasAttribute("hidden")) node.removeAttribute("hidden");
|
|
37
|
+
});
|
|
38
|
+
observer.observe(node, { attributes: true, attributeFilter: ["hidden"] });
|
|
39
|
+
return () => observer.disconnect();
|
|
40
|
+
}, [expanded]);
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
DisclosurePanel,
|
|
43
|
+
{
|
|
44
|
+
ref: panel,
|
|
45
|
+
role: "region",
|
|
46
|
+
className: "oprt-motion-panel text-oprt-md normal-case text-oprt-text",
|
|
47
|
+
children: /* @__PURE__ */ jsx("div", { className: "min-w-0 break-words px-3u py-2u", children })
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
function withDroppedProps(rendered, accepted) {
|
|
52
|
+
const dropped = {};
|
|
53
|
+
for (const [key, value] of Object.entries(accepted)) {
|
|
54
|
+
if (value === void 0) continue;
|
|
55
|
+
if (!(key in rendered) || rendered[key] === void 0) dropped[key] = value;
|
|
56
|
+
else if (typeof value === "function" && rendered[key] !== value) dropped[key] = value;
|
|
57
|
+
}
|
|
58
|
+
return mergeProps(rendered, dropped);
|
|
59
|
+
}
|
|
60
|
+
function toKeySet(value) {
|
|
61
|
+
if (value === void 0) return /* @__PURE__ */ new Set();
|
|
62
|
+
if (Array.isArray(value)) return new Set(value);
|
|
63
|
+
return new Set(value === "" ? [] : [value]);
|
|
64
|
+
}
|
|
65
|
+
var Collapsible = forwardRef(
|
|
66
|
+
({
|
|
67
|
+
type = "single",
|
|
68
|
+
motion = "auto",
|
|
69
|
+
value,
|
|
70
|
+
defaultValue,
|
|
71
|
+
onValueChange,
|
|
72
|
+
collapsible = true,
|
|
73
|
+
className,
|
|
74
|
+
children,
|
|
75
|
+
...props
|
|
76
|
+
}, ref) => {
|
|
77
|
+
const motionState = useMotion(motion);
|
|
78
|
+
const isControlled = value !== void 0;
|
|
79
|
+
const [uncontrolledKeys, setUncontrolledKeys] = useState(
|
|
80
|
+
() => toKeySet(defaultValue)
|
|
81
|
+
);
|
|
82
|
+
const expandedKeys = isControlled ? toKeySet(value) : uncontrolledKeys;
|
|
83
|
+
const handleExpandedChange = (keys) => {
|
|
84
|
+
if (type === "single" && !collapsible && keys.size === 0) return;
|
|
85
|
+
if (!isControlled) setUncontrolledKeys(keys);
|
|
86
|
+
if (!onValueChange) return;
|
|
87
|
+
const list = [...keys].map(String);
|
|
88
|
+
onValueChange(type === "single" ? list[0] ?? "" : list);
|
|
89
|
+
};
|
|
90
|
+
if (process.env.NODE_ENV !== "production") {
|
|
91
|
+
devValidate("Collapsible", CollapsibleManifest.Collapsible.props, { type });
|
|
92
|
+
}
|
|
93
|
+
const rootProps = {
|
|
94
|
+
...props,
|
|
95
|
+
allowsMultipleExpanded: type === "multiple",
|
|
96
|
+
expandedKeys,
|
|
97
|
+
onExpandedChange: handleExpandedChange,
|
|
98
|
+
// `min-w-0`: as an unsized flex item the group gives way to what its row leaves, instead of
|
|
99
|
+
// holding the width of the widest unbroken token in an open panel (break-words does not
|
|
100
|
+
// lower a minimum size) and widening the page.
|
|
101
|
+
className: clsx("oprt-motion w-full min-w-0 border-t border-oprt-border", className),
|
|
102
|
+
...composeMotionHandlers(motionState.props, props)
|
|
103
|
+
};
|
|
104
|
+
return /* @__PURE__ */ jsx(MotionContext.Provider, { value: motionState.mode, children: /* @__PURE__ */ jsx(
|
|
105
|
+
DisclosureGroup,
|
|
106
|
+
{
|
|
107
|
+
ref,
|
|
108
|
+
...rootProps,
|
|
109
|
+
render: (domProps) => /* @__PURE__ */ jsx(
|
|
110
|
+
"div",
|
|
111
|
+
{
|
|
112
|
+
...withDroppedProps(domProps, props),
|
|
113
|
+
...composeMotionHandlers(motionState.props, props)
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
children
|
|
117
|
+
}
|
|
118
|
+
) });
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
Collapsible.displayName = "Collapsible";
|
|
122
|
+
var CollapsibleItem = forwardRef(
|
|
123
|
+
({ value, title, disabled, className, children, ...props }, ref) => {
|
|
124
|
+
const itemProps = {
|
|
125
|
+
...props,
|
|
126
|
+
id: value,
|
|
127
|
+
isDisabled: disabled ?? false,
|
|
128
|
+
// `group` moves from the trigger to the Disclosure: RAC exposes the open
|
|
129
|
+
// state as data-expanded on the Disclosure, where Radix exposed
|
|
130
|
+
// data-state=open on the trigger itself.
|
|
131
|
+
className: clsx("oprt-motion-disclosure group border-b border-oprt-border", className)
|
|
132
|
+
};
|
|
133
|
+
return /* @__PURE__ */ jsx(
|
|
134
|
+
Disclosure,
|
|
135
|
+
{
|
|
136
|
+
ref,
|
|
137
|
+
...itemProps,
|
|
138
|
+
render: (domProps) => /* @__PURE__ */ jsx("div", { ...withDroppedProps(domProps, props) }),
|
|
139
|
+
children: ({ isExpanded }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
140
|
+
/* @__PURE__ */ jsx(Heading, { className: "m-0", children: /* @__PURE__ */ jsxs(
|
|
141
|
+
AriaButton,
|
|
142
|
+
{
|
|
143
|
+
slot: "trigger",
|
|
144
|
+
className: clsx(
|
|
145
|
+
"flex w-full items-center justify-between gap-2u px-3u text-left text-oprt-base font-medium uppercase tracking-oprt-caps text-oprt-text group-data-[expanded]:text-oprt-accent border border-transparent data-[focus-visible]:border-oprt-border-focus data-[focus-visible]:shadow-oprt-focus outline-hidden disabled:opacity-50 disabled:cursor-not-allowed",
|
|
146
|
+
// A long title wraps and the trigger grows (the DC-8 rule): the height is a
|
|
147
|
+
// minimum, and the padding is what is left of it around one line and the 2 px of
|
|
148
|
+
// border, so a one-line trigger is exactly 40 px.
|
|
149
|
+
"min-h-oprt-lg py-[calc((var(--oprt-height-lg)-2px-var(--oprt-line-base))/2)]",
|
|
150
|
+
// Forced colors drop the focus border color and shadow and would paint the
|
|
151
|
+
// transparent outline on every trigger: only a focused one draws one
|
|
152
|
+
// (Collapsible-R5).
|
|
153
|
+
"forced-colors:outline-0 forced-colors:data-[focus-visible]:outline-solid forced-colors:data-[focus-visible]:outline-2 forced-colors:data-[focus-visible]:-outline-offset-2 forced-colors:data-[focus-visible]:outline-[CanvasText]"
|
|
154
|
+
),
|
|
155
|
+
children: [
|
|
156
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 oprt-wrap-anywhere", children: title }),
|
|
157
|
+
/* @__PURE__ */ jsx(
|
|
158
|
+
ChevronDown,
|
|
159
|
+
{
|
|
160
|
+
size: 12,
|
|
161
|
+
className: "oprt-motion-chevron shrink-0 group-data-[expanded]:rotate-180"
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
) }),
|
|
167
|
+
/* @__PURE__ */ jsx(CollapsiblePanel, { expanded: isExpanded, children })
|
|
168
|
+
] })
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
CollapsibleItem.displayName = "CollapsibleItem";
|
|
174
|
+
export {
|
|
175
|
+
Collapsible,
|
|
176
|
+
CollapsibleItem
|
|
177
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// src/Collapsible/Collapsible.manifest.ts
|
|
2
|
+
var CollapsibleManifest = {
|
|
3
|
+
Collapsible: {
|
|
4
|
+
description: "Accordion container whose CollapsibleItem children expand and collapse; single or multiple open at a time.",
|
|
5
|
+
props: {
|
|
6
|
+
motion: {
|
|
7
|
+
type: "enum",
|
|
8
|
+
values: ["auto", "none"],
|
|
9
|
+
default: "auto",
|
|
10
|
+
description: "Tactile pointer/touch feedback. None disables motion; keyboard and system reduced motion are always immediate."
|
|
11
|
+
},
|
|
12
|
+
type: { type: "enum", values: ["single", "multiple"], default: "single" },
|
|
13
|
+
defaultValue: {
|
|
14
|
+
type: "union",
|
|
15
|
+
types: ["string", "array"],
|
|
16
|
+
description: "Initial open item: a string (type=single, empty for none) or a string[] (type=multiple)."
|
|
17
|
+
},
|
|
18
|
+
value: {
|
|
19
|
+
type: "union",
|
|
20
|
+
types: ["string", "array"],
|
|
21
|
+
description: "Controlled open item: a string (type=single, empty for none) or a string[] (type=multiple)."
|
|
22
|
+
},
|
|
23
|
+
onValueChange: { type: "function" },
|
|
24
|
+
collapsible: { type: "boolean", default: true }
|
|
25
|
+
},
|
|
26
|
+
slots: {
|
|
27
|
+
children: { type: "CollapsibleItem", required: true }
|
|
28
|
+
},
|
|
29
|
+
composable_with: ["Card"],
|
|
30
|
+
example: '<Collapsible type="single">\n <CollapsibleItem value="net" title="NETWORK">All links nominal.</CollapsibleItem>\n <CollapsibleItem value="pwr" title="POWER">Battery 98%.</CollapsibleItem>\n</Collapsible>'
|
|
31
|
+
},
|
|
32
|
+
CollapsibleItem: {
|
|
33
|
+
description: "A single expandable section with an uppercase trigger title and collapsible content body.",
|
|
34
|
+
props: {
|
|
35
|
+
value: { type: "string", required: true },
|
|
36
|
+
title: { type: "string", required: true },
|
|
37
|
+
disabled: { type: "boolean", default: false }
|
|
38
|
+
},
|
|
39
|
+
slots: {
|
|
40
|
+
children: { type: "any", required: true }
|
|
41
|
+
},
|
|
42
|
+
composable_with: ["Collapsible"],
|
|
43
|
+
example: '<CollapsibleItem value="net" title="NETWORK">All links nominal.</CollapsibleItem>'
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
var CollapsibleCompositionRules = {
|
|
47
|
+
Collapsible: {
|
|
48
|
+
allowed_children: ["CollapsibleItem"]
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
CollapsibleCompositionRules,
|
|
53
|
+
CollapsibleManifest
|
|
54
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/Collapsible/index.ts
|
|
2
|
+
import {
|
|
3
|
+
Collapsible,
|
|
4
|
+
CollapsibleItem
|
|
5
|
+
} from "./Collapsible.js";
|
|
6
|
+
import { CollapsibleManifest, CollapsibleCompositionRules } from "./Collapsible.manifest.js";
|
|
7
|
+
export {
|
|
8
|
+
Collapsible,
|
|
9
|
+
CollapsibleCompositionRules,
|
|
10
|
+
CollapsibleItem,
|
|
11
|
+
CollapsibleManifest
|
|
12
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/CollectionState/CollectionState.tsx
|
|
4
|
+
import { forwardRef, useId } from "react";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import clsx from "clsx";
|
|
7
|
+
import { CollectionStateManifest } from "./CollectionState.manifest.js";
|
|
8
|
+
import { devValidate } from "../_internal/devValidate.js";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
var headingStyles = cva(
|
|
11
|
+
"m-0 min-w-0 oprt-wrap-anywhere text-oprt-base font-medium uppercase tracking-oprt-sm",
|
|
12
|
+
{
|
|
13
|
+
variants: {
|
|
14
|
+
variant: {
|
|
15
|
+
empty: "text-oprt-text",
|
|
16
|
+
"no-results": "text-oprt-text",
|
|
17
|
+
error: "text-oprt-error",
|
|
18
|
+
"access-denied": "text-oprt-text"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
var CollectionState = forwardRef((allProps, ref) => {
|
|
24
|
+
const {
|
|
25
|
+
variant,
|
|
26
|
+
title,
|
|
27
|
+
description,
|
|
28
|
+
actions,
|
|
29
|
+
headingLevel = 2,
|
|
30
|
+
className,
|
|
31
|
+
"aria-labelledby": labelledBy,
|
|
32
|
+
"aria-describedby": describedBy,
|
|
33
|
+
...props
|
|
34
|
+
} = allProps;
|
|
35
|
+
const id = useId();
|
|
36
|
+
const titleId = `${id}-title`;
|
|
37
|
+
const descriptionId = `${id}-description`;
|
|
38
|
+
const Heading = `h${headingLevel}`;
|
|
39
|
+
const hasDescription = description != null && typeof description !== "boolean";
|
|
40
|
+
const hasActions = actions != null && typeof actions !== "boolean";
|
|
41
|
+
if (process.env.NODE_ENV !== "production") {
|
|
42
|
+
devValidate("CollectionState", CollectionStateManifest.CollectionState.props, allProps);
|
|
43
|
+
}
|
|
44
|
+
return /* @__PURE__ */ jsxs(
|
|
45
|
+
"div",
|
|
46
|
+
{
|
|
47
|
+
...props,
|
|
48
|
+
ref,
|
|
49
|
+
role: "region",
|
|
50
|
+
"aria-labelledby": [titleId, labelledBy].filter(Boolean).join(" "),
|
|
51
|
+
"aria-describedby": [hasDescription && descriptionId, describedBy].filter(Boolean).join(" ") || void 0,
|
|
52
|
+
"data-variant": variant,
|
|
53
|
+
className: clsx(
|
|
54
|
+
"flex min-w-0 flex-col gap-2u border border-oprt-border bg-oprt-surface-1 p-3u font-sans text-oprt-base normal-case tracking-normal text-oprt-text",
|
|
55
|
+
className
|
|
56
|
+
),
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsx(Heading, { id: titleId, className: headingStyles({ variant }), children: title }),
|
|
59
|
+
hasDescription && /* @__PURE__ */ jsx("div", { id: descriptionId, className: "min-w-0 oprt-wrap-anywhere text-oprt-text-dim [&_p]:m-0", children: description }),
|
|
60
|
+
hasActions && /* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-wrap items-center gap-1u", children: actions })
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
CollectionState.displayName = "CollectionState";
|
|
66
|
+
export {
|
|
67
|
+
CollectionState
|
|
68
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// src/CollectionState/CollectionState.manifest.ts
|
|
2
|
+
var CollectionStateManifest = {
|
|
3
|
+
CollectionState: {
|
|
4
|
+
description: "Named collection state with supplied explanation and recovery actions.",
|
|
5
|
+
props: {
|
|
6
|
+
variant: {
|
|
7
|
+
type: "enum",
|
|
8
|
+
values: ["empty", "no-results", "error", "access-denied"],
|
|
9
|
+
required: true,
|
|
10
|
+
description: "Supplied collection outcome. Empty means no source records; no-results means no matching records."
|
|
11
|
+
},
|
|
12
|
+
title: {
|
|
13
|
+
type: "string",
|
|
14
|
+
required: true,
|
|
15
|
+
description: "Visible heading that names the region and explains its state."
|
|
16
|
+
},
|
|
17
|
+
description: {
|
|
18
|
+
type: "node",
|
|
19
|
+
description: "Optional supporting content associated with the region."
|
|
20
|
+
},
|
|
21
|
+
actions: {
|
|
22
|
+
type: "node",
|
|
23
|
+
description: "Caller-supplied recovery controls. Activation never changes the supplied collection state."
|
|
24
|
+
},
|
|
25
|
+
headingLevel: {
|
|
26
|
+
type: "number",
|
|
27
|
+
default: 2,
|
|
28
|
+
description: "Native heading level from 2 through 6; match the surrounding document hierarchy."
|
|
29
|
+
},
|
|
30
|
+
"aria-live": {
|
|
31
|
+
type: "enum",
|
|
32
|
+
values: ["off", "polite", "assertive"],
|
|
33
|
+
description: "Optional caller-owned live-region behavior. No announcement is added by default."
|
|
34
|
+
},
|
|
35
|
+
className: { type: "string" }
|
|
36
|
+
},
|
|
37
|
+
composable_with: ["Button", "Link", "DataGrid", "PropertyFilter"],
|
|
38
|
+
never_inside: ["Button"],
|
|
39
|
+
example: '<CollectionState variant="error" title="Equipment unavailable" description="The source did not respond." actions={<Button onClick={retry}>Retry</Button>} />'
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
CollectionStateManifest
|
|
44
|
+
};
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/ComboBox/ComboBox.tsx
|
|
4
|
+
import { forwardRef, useRef } from "react";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
import clsx from "clsx";
|
|
7
|
+
import {
|
|
8
|
+
ComboBox as AriaComboBox,
|
|
9
|
+
Input,
|
|
10
|
+
Button,
|
|
11
|
+
Label,
|
|
12
|
+
ListBox,
|
|
13
|
+
ListBoxItem
|
|
14
|
+
} from "react-aria-components";
|
|
15
|
+
import { ChevronDown, Check } from "@oprt/icons";
|
|
16
|
+
import { ComboBoxManifest } from "./ComboBox.manifest.js";
|
|
17
|
+
import { devValidate } from "../_internal/devValidate.js";
|
|
18
|
+
import { useFieldWiring } from "../_internal/fieldIds.js";
|
|
19
|
+
import { definedOnly, useAriaInvalidRef } from "../_internal/aria.js";
|
|
20
|
+
import { useHydrationRoot } from "../_internal/hydration.js";
|
|
21
|
+
import { MotionContext, useMotion } from "../_internal/motion.js";
|
|
22
|
+
import { MotionPopover } from "../_internal/MotionPopover.js";
|
|
23
|
+
import { MENU_ITEM_TEXT, SCREEN_MARGIN } from "../_internal/overlay.js";
|
|
24
|
+
import {
|
|
25
|
+
FORCED_FOCUS_WITHIN,
|
|
26
|
+
FORCED_NO_RESTING_OUTLINE,
|
|
27
|
+
LISTBOX_EMPTY,
|
|
28
|
+
LISTBOX_ROW,
|
|
29
|
+
LISTBOX_SURFACE
|
|
30
|
+
} from "../_internal/controlStyles.js";
|
|
31
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
32
|
+
var inputStyles = cva(
|
|
33
|
+
"min-w-0 w-full border bg-oprt-surface-2 font-sans text-oprt-md font-medium normal-case text-oprt-text placeholder:text-oprt-text-placeholder disabled:placeholder:text-oprt-text-dim outline-hidden focus-visible:shadow-oprt-focus disabled:cursor-not-allowed disabled:bg-oprt-surface-3 disabled:border-oprt-border-control disabled:text-oprt-text-dim",
|
|
34
|
+
{
|
|
35
|
+
variants: {
|
|
36
|
+
size: { sm: "h-oprt-sm px-2u", md: "h-oprt-md px-2u", lg: "h-oprt-lg px-3u" },
|
|
37
|
+
invalid: {
|
|
38
|
+
// The control outline (design call DC-3).
|
|
39
|
+
false: "border-oprt-border-control focus-visible:border-oprt-border-focus",
|
|
40
|
+
true: "border-oprt-error focus-visible:border-oprt-error"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
defaultVariants: { size: "md", invalid: false }
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
var reportedValues = /* @__PURE__ */ new Set();
|
|
47
|
+
function reportUnknownValue(received, options) {
|
|
48
|
+
if (reportedValues.has(received)) return;
|
|
49
|
+
reportedValues.add(received);
|
|
50
|
+
console.error(
|
|
51
|
+
JSON.stringify(
|
|
52
|
+
{
|
|
53
|
+
component: "ComboBox",
|
|
54
|
+
error: "UNKNOWN_VALUE",
|
|
55
|
+
prop: "value",
|
|
56
|
+
received,
|
|
57
|
+
valid_values: options.map((option) => option.value),
|
|
58
|
+
suggestion: "Keep the selected option in `options` (include it in remote results), or clear the value. Otherwise the field shows nothing while the form still submits the value."
|
|
59
|
+
},
|
|
60
|
+
null,
|
|
61
|
+
2
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
var ComboBox = forwardRef((props, ref) => {
|
|
66
|
+
const {
|
|
67
|
+
motion = "auto",
|
|
68
|
+
options,
|
|
69
|
+
value,
|
|
70
|
+
defaultValue,
|
|
71
|
+
onValueChange,
|
|
72
|
+
inputValue,
|
|
73
|
+
onInputChange,
|
|
74
|
+
label,
|
|
75
|
+
"aria-label": ariaLabel,
|
|
76
|
+
"aria-describedby": ariaDescribedBy,
|
|
77
|
+
placeholder,
|
|
78
|
+
disabled = false,
|
|
79
|
+
required,
|
|
80
|
+
size = "md",
|
|
81
|
+
invalid,
|
|
82
|
+
loading = false,
|
|
83
|
+
filter = true,
|
|
84
|
+
emptyMessage = "No options found.",
|
|
85
|
+
name,
|
|
86
|
+
id,
|
|
87
|
+
className
|
|
88
|
+
} = props;
|
|
89
|
+
const motionState = useMotion(motion);
|
|
90
|
+
const editing = useRef(false);
|
|
91
|
+
const {
|
|
92
|
+
id: inputId,
|
|
93
|
+
labelledBy,
|
|
94
|
+
describedBy,
|
|
95
|
+
invalid: isInvalid,
|
|
96
|
+
required: isRequired
|
|
97
|
+
} = useFieldWiring(
|
|
98
|
+
{ id, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, invalid, required },
|
|
99
|
+
{ label: "labelledby", ownLabel: Boolean(label) }
|
|
100
|
+
);
|
|
101
|
+
const hiddenLabel = !label && ariaLabel ? ariaLabel : void 0;
|
|
102
|
+
if (process.env.NODE_ENV !== "production") {
|
|
103
|
+
devValidate("ComboBox", ComboBoxManifest.ComboBox.props, { ...props });
|
|
104
|
+
const selected = value ?? defaultValue;
|
|
105
|
+
if (typeof selected === "string" && (filter || inputValue === void 0) && !options.some((option) => option.value === selected))
|
|
106
|
+
reportUnknownValue(selected, options);
|
|
107
|
+
}
|
|
108
|
+
const inputRef = useAriaInvalidRef(ref, isInvalid);
|
|
109
|
+
const hydration = useHydrationRoot(inputId, labelledBy);
|
|
110
|
+
const rootProps = definedOnly({
|
|
111
|
+
selectedKey: value,
|
|
112
|
+
defaultSelectedKey: defaultValue,
|
|
113
|
+
inputValue,
|
|
114
|
+
onInputChange: (text) => {
|
|
115
|
+
if (editing.current) {
|
|
116
|
+
editing.current = false;
|
|
117
|
+
motionState.settleInput();
|
|
118
|
+
}
|
|
119
|
+
onInputChange?.(text);
|
|
120
|
+
},
|
|
121
|
+
name,
|
|
122
|
+
"aria-label": hiddenLabel ? void 0 : ariaLabel,
|
|
123
|
+
"aria-labelledby": labelledBy,
|
|
124
|
+
"aria-describedby": describedBy
|
|
125
|
+
});
|
|
126
|
+
return /* @__PURE__ */ jsx(MotionContext.Provider, { value: motionState.mode, children: /* @__PURE__ */ jsxs(
|
|
127
|
+
AriaComboBox,
|
|
128
|
+
{
|
|
129
|
+
...hydration.probeProps,
|
|
130
|
+
...rootProps,
|
|
131
|
+
isDisabled: disabled,
|
|
132
|
+
isRequired,
|
|
133
|
+
isInvalid,
|
|
134
|
+
allowsEmptyCollection: true,
|
|
135
|
+
...!filter ? { defaultFilter: () => true } : {},
|
|
136
|
+
onSelectionChange: (key) => onValueChange?.(key === null ? null : String(key)),
|
|
137
|
+
render: (domProps) => /* @__PURE__ */ jsx(
|
|
138
|
+
"div",
|
|
139
|
+
{
|
|
140
|
+
...domProps,
|
|
141
|
+
...motionState.props,
|
|
142
|
+
onInputCapture: (event) => {
|
|
143
|
+
if (event.target.getAttribute("role") === "combobox") {
|
|
144
|
+
editing.current = true;
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
onInput: () => {
|
|
148
|
+
queueMicrotask(() => {
|
|
149
|
+
editing.current = false;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
className: clsx(
|
|
155
|
+
"oprt-motion flex min-w-0 flex-col gap-1u font-sans text-oprt-base normal-case text-oprt-text",
|
|
156
|
+
className
|
|
157
|
+
),
|
|
158
|
+
children: [
|
|
159
|
+
label && /* @__PURE__ */ jsx(Label, { className: "m-0 min-w-0 oprt-wrap-anywhere text-oprt-base font-medium text-oprt-text", children: label }),
|
|
160
|
+
hiddenLabel && /* @__PURE__ */ jsx(Label, { className: "sr-only", children: hiddenLabel }),
|
|
161
|
+
/* @__PURE__ */ jsxs("div", { className: clsx("flex min-w-0 items-stretch", FORCED_FOCUS_WITHIN), children: [
|
|
162
|
+
/* @__PURE__ */ jsx(
|
|
163
|
+
Input,
|
|
164
|
+
{
|
|
165
|
+
ref: inputRef,
|
|
166
|
+
...definedOnly({ id: inputId, placeholder }),
|
|
167
|
+
"aria-busy": loading,
|
|
168
|
+
className: clsx(inputStyles({ size, invalid: isInvalid }), FORCED_NO_RESTING_OUTLINE)
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
/* @__PURE__ */ jsx(
|
|
172
|
+
Button,
|
|
173
|
+
{
|
|
174
|
+
className: clsx(
|
|
175
|
+
"inline-flex min-w-3u shrink-0 items-center justify-center border border-l-0 border-oprt-border-control bg-oprt-surface-2 px-1u text-oprt-text outline-hidden data-[focus-visible]:border-oprt-border-focus data-[focus-visible]:shadow-oprt-focus data-[disabled]:cursor-not-allowed data-[disabled]:bg-oprt-surface-3 data-[disabled]:border-oprt-border-control data-[disabled]:text-oprt-text-dim",
|
|
176
|
+
FORCED_NO_RESTING_OUTLINE
|
|
177
|
+
),
|
|
178
|
+
children: /* @__PURE__ */ jsx(ChevronDown, { size: 12, className: "oprt-motion-popover-chevron", "aria-hidden": "true" })
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
] }),
|
|
182
|
+
/* @__PURE__ */ jsx("p", { role: "status", className: loading ? "m-0 text-oprt-text-dim" : "sr-only", children: loading ? "Loading options." : null }),
|
|
183
|
+
/* @__PURE__ */ jsx(
|
|
184
|
+
MotionPopover,
|
|
185
|
+
{
|
|
186
|
+
motionState,
|
|
187
|
+
className: LISTBOX_SURFACE,
|
|
188
|
+
offset: 2,
|
|
189
|
+
containerPadding: SCREEN_MARGIN,
|
|
190
|
+
children: /* @__PURE__ */ jsx(
|
|
191
|
+
ListBox,
|
|
192
|
+
{
|
|
193
|
+
className: "outline-hidden",
|
|
194
|
+
renderEmptyState: () => /* @__PURE__ */ jsx("p", { className: LISTBOX_EMPTY, children: loading ? "Loading options." : emptyMessage }),
|
|
195
|
+
children: options.map((option) => /* @__PURE__ */ jsx(
|
|
196
|
+
ListBoxItem,
|
|
197
|
+
{
|
|
198
|
+
id: option.value,
|
|
199
|
+
textValue: option.label,
|
|
200
|
+
isDisabled: option.disabled ?? false,
|
|
201
|
+
className: LISTBOX_ROW,
|
|
202
|
+
children: ({ isSelected }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
203
|
+
/* @__PURE__ */ jsx("span", { className: MENU_ITEM_TEXT, children: option.label }),
|
|
204
|
+
isSelected && /* @__PURE__ */ jsx(Check, { size: 12, className: "shrink-0", "aria-hidden": "true" })
|
|
205
|
+
] })
|
|
206
|
+
},
|
|
207
|
+
option.value
|
|
208
|
+
))
|
|
209
|
+
}
|
|
210
|
+
)
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
]
|
|
214
|
+
},
|
|
215
|
+
hydration.key
|
|
216
|
+
) });
|
|
217
|
+
});
|
|
218
|
+
ComboBox.displayName = "ComboBox";
|
|
219
|
+
export {
|
|
220
|
+
ComboBox
|
|
221
|
+
};
|