macbetter 0.0.0-stage → 0.1.0-beta.1
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 +201 -0
- package/README.md +92 -2
- package/dist/components/accessory-tile.d.ts +50 -0
- package/dist/components/accessory-tile.js +46 -0
- package/dist/components/activity-indicator.d.ts +15 -0
- package/dist/components/activity-indicator.js +15 -0
- package/dist/components/alert.d.ts +29 -0
- package/dist/components/alert.js +30 -0
- package/dist/components/artwork.d.ts +44 -0
- package/dist/components/artwork.js +935 -0
- package/dist/components/automation-row.d.ts +24 -0
- package/dist/components/automation-row.js +12 -0
- package/dist/components/avatar.d.ts +33 -0
- package/dist/components/avatar.js +45 -0
- package/dist/components/badge.d.ts +24 -0
- package/dist/components/badge.js +19 -0
- package/dist/components/button.d.ts +20 -0
- package/dist/components/button.js +10 -0
- package/dist/components/calendar.d.ts +30 -0
- package/dist/components/calendar.js +47 -0
- package/dist/components/camera-view.d.ts +40 -0
- package/dist/components/camera-view.js +44 -0
- package/dist/components/card.d.ts +14 -0
- package/dist/components/card.js +21 -0
- package/dist/components/carousel.d.ts +18 -0
- package/dist/components/carousel.js +33 -0
- package/dist/components/checkbox.d.ts +13 -0
- package/dist/components/checkbox.js +16 -0
- package/dist/components/code-field.d.ts +16 -0
- package/dist/components/code-field.js +29 -0
- package/dist/components/color-well.d.ts +23 -0
- package/dist/components/color-well.js +27 -0
- package/dist/components/combo-box.d.ts +42 -0
- package/dist/components/combo-box.js +102 -0
- package/dist/components/command-palette.d.ts +33 -0
- package/dist/components/command-palette.js +55 -0
- package/dist/components/context-menu.d.ts +9 -0
- package/dist/components/context-menu.js +15 -0
- package/dist/components/date-picker.d.ts +53 -0
- package/dist/components/date-picker.js +86 -0
- package/dist/components/device-frame.d.ts +18 -0
- package/dist/components/device-frame.js +16 -0
- package/dist/components/dialog.d.ts +27 -0
- package/dist/components/dialog.js +35 -0
- package/dist/components/disclosure.d.ts +32 -0
- package/dist/components/disclosure.js +35 -0
- package/dist/components/dock.d.ts +28 -0
- package/dist/components/dock.js +80 -0
- package/dist/components/door-control.d.ts +20 -0
- package/dist/components/door-control.js +43 -0
- package/dist/components/energy-readout.d.ts +32 -0
- package/dist/components/energy-readout.js +27 -0
- package/dist/components/field.d.ts +28 -0
- package/dist/components/field.js +32 -0
- package/dist/components/gauge.d.ts +25 -0
- package/dist/components/gauge.js +42 -0
- package/dist/components/glass.d.ts +34 -0
- package/dist/components/glass.js +31 -0
- package/dist/components/home-backdrop.d.ts +23 -0
- package/dist/components/home-backdrop.js +12 -0
- package/dist/components/home-section.d.ts +19 -0
- package/dist/components/home-section.js +21 -0
- package/dist/components/home-status.d.ts +24 -0
- package/dist/components/home-status.js +14 -0
- package/dist/components/hover-card.d.ts +14 -0
- package/dist/components/hover-card.js +16 -0
- package/dist/components/level-control.d.ts +19 -0
- package/dist/components/level-control.js +13 -0
- package/dist/components/light-color-picker.d.ts +33 -0
- package/dist/components/light-color-picker.js +56 -0
- package/dist/components/list.d.ts +42 -0
- package/dist/components/list.js +42 -0
- package/dist/components/listbox.d.ts +16 -0
- package/dist/components/listbox.js +28 -0
- package/dist/components/lock-control.d.ts +20 -0
- package/dist/components/lock-control.js +35 -0
- package/dist/components/menu-bar.d.ts +14 -0
- package/dist/components/menu-bar.js +16 -0
- package/dist/components/menu.d.ts +40 -0
- package/dist/components/menu.js +54 -0
- package/dist/components/navigation-bar.d.ts +24 -0
- package/dist/components/navigation-bar.js +54 -0
- package/dist/components/outline.d.ts +21 -0
- package/dist/components/outline.js +40 -0
- package/dist/components/page-control.d.ts +10 -0
- package/dist/components/page-control.js +8 -0
- package/dist/components/popover.d.ts +16 -0
- package/dist/components/popover.js +24 -0
- package/dist/components/progress.d.ts +27 -0
- package/dist/components/progress.js +27 -0
- package/dist/components/radio.d.ts +16 -0
- package/dist/components/radio.js +13 -0
- package/dist/components/rating.d.ts +10 -0
- package/dist/components/rating.js +12 -0
- package/dist/components/scene-tile.d.ts +22 -0
- package/dist/components/scene-tile.js +13 -0
- package/dist/components/scroll-view.d.ts +21 -0
- package/dist/components/scroll-view.js +13 -0
- package/dist/components/search-field.d.ts +16 -0
- package/dist/components/search-field.js +12 -0
- package/dist/components/secure-field.d.ts +23 -0
- package/dist/components/secure-field.js +21 -0
- package/dist/components/segmented-control.d.ts +12 -0
- package/dist/components/segmented-control.js +10 -0
- package/dist/components/select.d.ts +45 -0
- package/dist/components/select.js +79 -0
- package/dist/components/sensor-readout.d.ts +29 -0
- package/dist/components/sensor-readout.js +12 -0
- package/dist/components/separator.d.ts +14 -0
- package/dist/components/separator.js +11 -0
- package/dist/components/setup-code.d.ts +29 -0
- package/dist/components/setup-code.js +47 -0
- package/dist/components/sheet.d.ts +31 -0
- package/dist/components/sheet.js +51 -0
- package/dist/components/sidebar.d.ts +30 -0
- package/dist/components/sidebar.js +26 -0
- package/dist/components/slider.d.ts +27 -0
- package/dist/components/slider.js +43 -0
- package/dist/components/split-view.d.ts +11 -0
- package/dist/components/split-view.js +13 -0
- package/dist/components/squircle.d.ts +41 -0
- package/dist/components/squircle.js +63 -0
- package/dist/components/stepper.d.ts +30 -0
- package/dist/components/stepper.js +28 -0
- package/dist/components/switch.d.ts +10 -0
- package/dist/components/switch.js +10 -0
- package/dist/components/tab-bar.d.ts +20 -0
- package/dist/components/tab-bar.js +17 -0
- package/dist/components/table.d.ts +49 -0
- package/dist/components/table.js +179 -0
- package/dist/components/tabs.d.ts +16 -0
- package/dist/components/tabs.js +19 -0
- package/dist/components/text-area.d.ts +14 -0
- package/dist/components/text-area.js +9 -0
- package/dist/components/text-field.d.ts +26 -0
- package/dist/components/text-field.js +23 -0
- package/dist/components/thermostat-control.d.ts +30 -0
- package/dist/components/thermostat-control.js +139 -0
- package/dist/components/toast.d.ts +30 -0
- package/dist/components/toast.js +114 -0
- package/dist/components/toggle.d.ts +21 -0
- package/dist/components/toggle.js +19 -0
- package/dist/components/token-field.d.ts +31 -0
- package/dist/components/token-field.js +78 -0
- package/dist/components/toolbar.d.ts +27 -0
- package/dist/components/toolbar.js +39 -0
- package/dist/components/tooltip.d.ts +11 -0
- package/dist/components/tooltip.js +18 -0
- package/dist/components/window.d.ts +56 -0
- package/dist/components/window.js +61 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.js +79 -0
- package/dist/lib/cx.d.ts +9 -0
- package/dist/lib/cx.js +14 -0
- package/dist/lib/derive.d.ts +53 -0
- package/dist/lib/derive.js +255 -0
- package/dist/lib/field-glyphs.d.ts +13 -0
- package/dist/lib/field-glyphs.js +28 -0
- package/dist/lib/menu-glyphs.d.ts +6 -0
- package/dist/lib/menu-glyphs.js +15 -0
- package/dist/lib/platform.d.ts +18 -0
- package/dist/lib/platform.js +17 -0
- package/dist/lib/squircle.d.ts +23 -0
- package/dist/lib/squircle.js +69 -0
- package/dist/lib/theme.d.ts +42 -0
- package/dist/lib/theme.js +62 -0
- package/dist/styles/base.css +115 -0
- package/dist/styles/components/accessory-tile.css +461 -0
- package/dist/styles/components/activity-indicator.css +63 -0
- package/dist/styles/components/alert.css +433 -0
- package/dist/styles/components/artwork.css +380 -0
- package/dist/styles/components/automation-row.css +52 -0
- package/dist/styles/components/avatar.css +230 -0
- package/dist/styles/components/badge.css +204 -0
- package/dist/styles/components/button.css +298 -0
- package/dist/styles/components/calendar.css +287 -0
- package/dist/styles/components/camera-view.css +239 -0
- package/dist/styles/components/card.css +100 -0
- package/dist/styles/components/carousel.css +210 -0
- package/dist/styles/components/checkbox.css +212 -0
- package/dist/styles/components/code-field.css +163 -0
- package/dist/styles/components/color-well.css +452 -0
- package/dist/styles/components/combo-box.css +222 -0
- package/dist/styles/components/command-palette.css +379 -0
- package/dist/styles/components/context-menu.css +43 -0
- package/dist/styles/components/date-picker.css +356 -0
- package/dist/styles/components/device-frame.css +194 -0
- package/dist/styles/components/dialog.css +366 -0
- package/dist/styles/components/disclosure.css +197 -0
- package/dist/styles/components/dock.css +404 -0
- package/dist/styles/components/door-control.css +187 -0
- package/dist/styles/components/energy-readout.css +161 -0
- package/dist/styles/components/field.css +175 -0
- package/dist/styles/components/gauge.css +239 -0
- package/dist/styles/components/glass.css +113 -0
- package/dist/styles/components/home-backdrop.css +81 -0
- package/dist/styles/components/home-section.css +100 -0
- package/dist/styles/components/home-status.css +215 -0
- package/dist/styles/components/hover-card.css +145 -0
- package/dist/styles/components/index.css +75 -0
- package/dist/styles/components/level-control.css +247 -0
- package/dist/styles/components/light-color-picker.css +94 -0
- package/dist/styles/components/list.css +411 -0
- package/dist/styles/components/listbox.css +168 -0
- package/dist/styles/components/lock-control.css +164 -0
- package/dist/styles/components/menu-bar.css +94 -0
- package/dist/styles/components/menu.css +454 -0
- package/dist/styles/components/navigation-bar.css +248 -0
- package/dist/styles/components/outline.css +248 -0
- package/dist/styles/components/page-control.css +127 -0
- package/dist/styles/components/popover.css +186 -0
- package/dist/styles/components/progress.css +228 -0
- package/dist/styles/components/radio.css +281 -0
- package/dist/styles/components/rating.css +122 -0
- package/dist/styles/components/scene-tile.css +295 -0
- package/dist/styles/components/scroll-view.css +195 -0
- package/dist/styles/components/search-field.css +128 -0
- package/dist/styles/components/secure-field.css +189 -0
- package/dist/styles/components/segmented-control.css +183 -0
- package/dist/styles/components/select.css +290 -0
- package/dist/styles/components/sensor-readout.css +231 -0
- package/dist/styles/components/separator.css +62 -0
- package/dist/styles/components/setup-code.css +138 -0
- package/dist/styles/components/sheet.css +345 -0
- package/dist/styles/components/sidebar.css +261 -0
- package/dist/styles/components/slider.css +208 -0
- package/dist/styles/components/split-view.css +75 -0
- package/dist/styles/components/squircle.css +44 -0
- package/dist/styles/components/stepper.css +278 -0
- package/dist/styles/components/switch.css +115 -0
- package/dist/styles/components/tab-bar.css +223 -0
- package/dist/styles/components/table.css +313 -0
- package/dist/styles/components/tabs.css +262 -0
- package/dist/styles/components/text-area.css +94 -0
- package/dist/styles/components/text-field.css +294 -0
- package/dist/styles/components/thermostat-control.css +214 -0
- package/dist/styles/components/toast.css +418 -0
- package/dist/styles/components/toggle.css +312 -0
- package/dist/styles/components/token-field.css +193 -0
- package/dist/styles/components/toolbar.css +370 -0
- package/dist/styles/components/tooltip.css +69 -0
- package/dist/styles/components/window.css +428 -0
- package/dist/styles/index.css +17 -0
- package/dist/styles/materials.css +263 -0
- package/dist/styles/platforms.css +214 -0
- package/dist/styles/themes/ember.css +24 -0
- package/dist/styles/themes/graphite.css +16 -0
- package/dist/styles/themes/nebula.css +16 -0
- package/dist/styles/themes/system.css +28 -0
- package/dist/styles/tokens.css +299 -0
- package/package.json +82 -3
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Autocomplete, AutocompleteClear as AutocompleteClearPrimitive, AutocompleteContent as AutocompleteContentPrimitive, AutocompleteEmpty as AutocompleteEmptyPrimitive, AutocompleteGroup as AutocompleteGroupPrimitive, AutocompleteGroupLabel as AutocompleteGroupLabelPrimitive, AutocompleteInput as AutocompleteInputPrimitive, AutocompleteItem as AutocompleteItemPrimitive, AutocompleteItemIcon as AutocompleteItemIconPrimitive, AutocompleteItems, AutocompleteItemText as AutocompleteItemTextPrimitive, AutocompleteLabel as AutocompleteLabelPrimitive, AutocompleteList as AutocompleteListPrimitive, AutocompleteSeparator as AutocompleteSeparatorPrimitive, AutocompleteStatus as AutocompleteStatusPrimitive, AutocompleteTrigger as AutocompleteTriggerPrimitive, createAutocompleteController } from "@ui-sdk/react/autocomplete";
|
|
2
|
+
import type { AutocompleteProps } from "@ui-sdk/react/autocomplete";
|
|
3
|
+
import { Combobox, ComboboxClear as ComboboxClearPrimitive, ComboboxContent as ComboboxContentPrimitive, ComboboxEmpty as ComboboxEmptyPrimitive, ComboboxGroup as ComboboxGroupPrimitive, ComboboxGroupLabel as ComboboxGroupLabelPrimitive, ComboboxInput as ComboboxInputPrimitive, ComboboxItem as ComboboxItemPrimitive, ComboboxItemIcon as ComboboxItemIconPrimitive, ComboboxItemIndicator as ComboboxItemIndicatorPrimitive, ComboboxItems, ComboboxItemText as ComboboxItemTextPrimitive, ComboboxLabel as ComboboxLabelPrimitive, ComboboxList as ComboboxListPrimitive, ComboboxSeparator as ComboboxSeparatorPrimitive, ComboboxStatus as ComboboxStatusPrimitive, ComboboxTrigger as ComboboxTriggerPrimitive, createComboboxController } from "@ui-sdk/react/combobox";
|
|
4
|
+
import type { ComboboxProps } from "@ui-sdk/react/combobox";
|
|
5
|
+
import type * as React from "react";
|
|
6
|
+
/** The field: holds the input, and the clear button and trigger at its trailing edge. */
|
|
7
|
+
declare function ComboboxControl({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
8
|
+
declare function ComboboxLabel({ className, ...props }: React.ComponentProps<typeof ComboboxLabelPrimitive>): React.JSX.Element;
|
|
9
|
+
declare function ComboboxInput({ className, ...props }: React.ComponentProps<typeof ComboboxInputPrimitive>): React.JSX.Element;
|
|
10
|
+
/** The button that shows every choice. Renders its own chevron; name it with `aria-label`. */
|
|
11
|
+
declare function ComboboxTrigger({ className, children, ...props }: React.ComponentProps<typeof ComboboxTriggerPrimitive>): React.JSX.Element;
|
|
12
|
+
declare function ComboboxClear({ className, children, ...props }: React.ComponentProps<typeof ComboboxClearPrimitive>): React.JSX.Element;
|
|
13
|
+
declare function ComboboxContent({ sideOffset, className, ...props }: React.ComponentProps<typeof ComboboxContentPrimitive>): React.JSX.Element;
|
|
14
|
+
declare function ComboboxList({ className, ...props }: React.ComponentProps<typeof ComboboxListPrimitive>): React.JSX.Element;
|
|
15
|
+
/** A choice. Renders its own checkmark beside the selected one. */
|
|
16
|
+
declare function ComboboxItem<T = string>({ className, children, ...props }: Omit<React.ComponentProps<typeof ComboboxItemPrimitive<T>>, "children"> & {
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
}): React.JSX.Element;
|
|
19
|
+
declare function ComboboxItemIndicator({ keepMounted, className, children, ...props }: React.ComponentProps<typeof ComboboxItemIndicatorPrimitive>): React.JSX.Element;
|
|
20
|
+
declare function ComboboxItemIcon({ className, ...props }: React.ComponentProps<typeof ComboboxItemIconPrimitive>): React.JSX.Element;
|
|
21
|
+
declare function ComboboxItemText({ className, ...props }: React.ComponentProps<typeof ComboboxItemTextPrimitive>): React.JSX.Element;
|
|
22
|
+
declare function ComboboxGroup({ className, ...props }: React.ComponentProps<typeof ComboboxGroupPrimitive>): React.JSX.Element;
|
|
23
|
+
declare function ComboboxGroupLabel({ className, ...props }: React.ComponentProps<typeof ComboboxGroupLabelPrimitive>): React.JSX.Element;
|
|
24
|
+
declare function ComboboxSeparator({ className, ...props }: React.ComponentProps<typeof ComboboxSeparatorPrimitive>): React.JSX.Element;
|
|
25
|
+
declare function ComboboxEmpty({ className, ...props }: React.ComponentProps<typeof ComboboxEmptyPrimitive>): React.JSX.Element;
|
|
26
|
+
declare function ComboboxStatus({ className, ...props }: React.ComponentProps<typeof ComboboxStatusPrimitive>): React.JSX.Element;
|
|
27
|
+
declare function AutocompleteLabel({ className, ...props }: React.ComponentProps<typeof AutocompleteLabelPrimitive>): React.JSX.Element;
|
|
28
|
+
declare function AutocompleteInput({ className, ...props }: React.ComponentProps<typeof AutocompleteInputPrimitive>): React.JSX.Element;
|
|
29
|
+
declare function AutocompleteTrigger({ className, children, ...props }: React.ComponentProps<typeof AutocompleteTriggerPrimitive>): React.JSX.Element;
|
|
30
|
+
declare function AutocompleteClear({ className, children, ...props }: React.ComponentProps<typeof AutocompleteClearPrimitive>): React.JSX.Element;
|
|
31
|
+
declare function AutocompleteContent({ sideOffset, className, ...props }: React.ComponentProps<typeof AutocompleteContentPrimitive>): React.JSX.Element;
|
|
32
|
+
declare function AutocompleteList({ className, ...props }: React.ComponentProps<typeof AutocompleteListPrimitive>): React.JSX.Element;
|
|
33
|
+
declare function AutocompleteItem({ className, ...props }: React.ComponentProps<typeof AutocompleteItemPrimitive>): React.JSX.Element;
|
|
34
|
+
declare function AutocompleteItemIcon({ className, ...props }: React.ComponentProps<typeof AutocompleteItemIconPrimitive>): React.JSX.Element;
|
|
35
|
+
declare function AutocompleteItemText({ className, ...props }: React.ComponentProps<typeof AutocompleteItemTextPrimitive>): React.JSX.Element;
|
|
36
|
+
declare function AutocompleteGroup({ className, ...props }: React.ComponentProps<typeof AutocompleteGroupPrimitive>): React.JSX.Element;
|
|
37
|
+
declare function AutocompleteGroupLabel({ className, ...props }: React.ComponentProps<typeof AutocompleteGroupLabelPrimitive>): React.JSX.Element;
|
|
38
|
+
declare function AutocompleteSeparator({ className, ...props }: React.ComponentProps<typeof AutocompleteSeparatorPrimitive>): React.JSX.Element;
|
|
39
|
+
declare function AutocompleteEmpty({ className, ...props }: React.ComponentProps<typeof AutocompleteEmptyPrimitive>): React.JSX.Element;
|
|
40
|
+
declare function AutocompleteStatus({ className, ...props }: React.ComponentProps<typeof AutocompleteStatusPrimitive>): React.JSX.Element;
|
|
41
|
+
export { Autocomplete, AutocompleteClear, AutocompleteContent, AutocompleteEmpty, AutocompleteGroup, AutocompleteGroupLabel, AutocompleteInput, AutocompleteItem, AutocompleteItemIcon, AutocompleteItems, AutocompleteItemText, AutocompleteLabel, AutocompleteList, AutocompleteSeparator, AutocompleteStatus, AutocompleteTrigger, Combobox, ComboboxClear, ComboboxContent, ComboboxControl, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxItemIcon, ComboboxItemIndicator, ComboboxItems, ComboboxItemText, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, createAutocompleteController, createComboboxController, };
|
|
42
|
+
export type { AutocompleteProps, ComboboxProps };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Autocomplete, AutocompleteClear as AutocompleteClearPrimitive, AutocompleteContent as AutocompleteContentPrimitive, AutocompleteEmpty as AutocompleteEmptyPrimitive, AutocompleteGroup as AutocompleteGroupPrimitive, AutocompleteGroupLabel as AutocompleteGroupLabelPrimitive, AutocompleteInput as AutocompleteInputPrimitive, AutocompleteItem as AutocompleteItemPrimitive, AutocompleteItemIcon as AutocompleteItemIconPrimitive, AutocompleteItems, AutocompleteItemText as AutocompleteItemTextPrimitive, AutocompleteLabel as AutocompleteLabelPrimitive, AutocompleteList as AutocompleteListPrimitive, AutocompleteSeparator as AutocompleteSeparatorPrimitive, AutocompleteStatus as AutocompleteStatusPrimitive, AutocompleteTrigger as AutocompleteTriggerPrimitive, createAutocompleteController, } from "@ui-sdk/react/autocomplete";
|
|
3
|
+
import { Combobox, ComboboxClear as ComboboxClearPrimitive, ComboboxContent as ComboboxContentPrimitive, ComboboxEmpty as ComboboxEmptyPrimitive, ComboboxGroup as ComboboxGroupPrimitive, ComboboxGroupLabel as ComboboxGroupLabelPrimitive, ComboboxInput as ComboboxInputPrimitive, ComboboxItem as ComboboxItemPrimitive, ComboboxItemIcon as ComboboxItemIconPrimitive, ComboboxItemIndicator as ComboboxItemIndicatorPrimitive, ComboboxItems, ComboboxItemText as ComboboxItemTextPrimitive, ComboboxLabel as ComboboxLabelPrimitive, ComboboxList as ComboboxListPrimitive, ComboboxSeparator as ComboboxSeparatorPrimitive, ComboboxStatus as ComboboxStatusPrimitive, ComboboxTrigger as ComboboxTriggerPrimitive, createComboboxController, } from "@ui-sdk/react/combobox";
|
|
4
|
+
import { cx, join } from "../lib/cx.js";
|
|
5
|
+
import { CheckGlyph, ChevronGlyph } from "../lib/menu-glyphs.js";
|
|
6
|
+
function ClearGlyph() {
|
|
7
|
+
return (_jsxs("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", children: [_jsx("circle", { cx: "8", cy: "8", r: "7", fill: "currentColor" }), _jsx("path", { d: "m5.6 5.6 4.8 4.8m0-4.8-4.8 4.8", stroke: "var(--mb-bg-field)", strokeWidth: "1.5", strokeLinecap: "round" })] }));
|
|
8
|
+
}
|
|
9
|
+
/** The field: holds the input, and the clear button and trigger at its trailing edge. */
|
|
10
|
+
function ComboboxControl({ className, ...props }) {
|
|
11
|
+
return _jsx("div", { className: join("mb-combo-box-control", className), ...props });
|
|
12
|
+
}
|
|
13
|
+
function ComboboxLabel({ className, ...props }) {
|
|
14
|
+
return _jsx(ComboboxLabelPrimitive, { className: cx("mb-combo-box-label", className), ...props });
|
|
15
|
+
}
|
|
16
|
+
function ComboboxInput({ className, ...props }) {
|
|
17
|
+
return _jsx(ComboboxInputPrimitive, { className: cx("mb-combo-box-input", className), ...props });
|
|
18
|
+
}
|
|
19
|
+
/** The button that shows every choice. Renders its own chevron; name it with `aria-label`. */
|
|
20
|
+
function ComboboxTrigger({ className, children, ...props }) {
|
|
21
|
+
return (_jsx(ComboboxTriggerPrimitive, { className: cx("mb-combo-box-trigger", className), ...props, children: children ?? _jsx(ChevronGlyph, { direction: "down" }) }));
|
|
22
|
+
}
|
|
23
|
+
function ComboboxClear({ className, children, ...props }) {
|
|
24
|
+
return (_jsx(ComboboxClearPrimitive, { className: cx("mb-combo-box-clear", className), ...props, children: children ?? _jsx(ClearGlyph, {}) }));
|
|
25
|
+
}
|
|
26
|
+
function ComboboxContent({ sideOffset = 4, className, ...props }) {
|
|
27
|
+
return (_jsx(ComboboxContentPrimitive, { sideOffset: sideOffset, className: cx("mb-menu-content mb-combo-box-content", className), ...props }));
|
|
28
|
+
}
|
|
29
|
+
function ComboboxList({ className, ...props }) {
|
|
30
|
+
return _jsx(ComboboxListPrimitive, { className: cx("mb-combo-box-list", className), ...props });
|
|
31
|
+
}
|
|
32
|
+
/** A choice. Renders its own checkmark beside the selected one. */
|
|
33
|
+
function ComboboxItem({ className, children, ...props }) {
|
|
34
|
+
return (_jsxs(ComboboxItemPrimitive, { className: cx("mb-menu-item mb-menu-checkable mb-combo-box-item", className), ...props, children: [_jsx(ComboboxItemIndicator, {}), children] }));
|
|
35
|
+
}
|
|
36
|
+
function ComboboxItemIndicator({ keepMounted = true, className, children, ...props }) {
|
|
37
|
+
return (_jsx(ComboboxItemIndicatorPrimitive, { keepMounted: keepMounted, className: cx("mb-menu-item-indicator mb-combo-box-item-indicator", className), ...props, children: children ?? _jsx(CheckGlyph, {}) }));
|
|
38
|
+
}
|
|
39
|
+
function ComboboxItemIcon({ className, ...props }) {
|
|
40
|
+
return _jsx(ComboboxItemIconPrimitive, { className: cx("mb-menu-item-icon", className), ...props });
|
|
41
|
+
}
|
|
42
|
+
function ComboboxItemText({ className, ...props }) {
|
|
43
|
+
return _jsx(ComboboxItemTextPrimitive, { className: cx("mb-combo-box-item-text", className), ...props });
|
|
44
|
+
}
|
|
45
|
+
function ComboboxGroup({ className, ...props }) {
|
|
46
|
+
return _jsx(ComboboxGroupPrimitive, { className: cx("mb-menu-group", className), ...props });
|
|
47
|
+
}
|
|
48
|
+
function ComboboxGroupLabel({ className, ...props }) {
|
|
49
|
+
return _jsx(ComboboxGroupLabelPrimitive, { className: cx("mb-menu-group-label", className), ...props });
|
|
50
|
+
}
|
|
51
|
+
function ComboboxSeparator({ className, ...props }) {
|
|
52
|
+
return _jsx(ComboboxSeparatorPrimitive, { className: cx("mb-menu-separator", className), ...props });
|
|
53
|
+
}
|
|
54
|
+
function ComboboxEmpty({ className, ...props }) {
|
|
55
|
+
return _jsx(ComboboxEmptyPrimitive, { className: cx("mb-combo-box-empty", className), ...props });
|
|
56
|
+
}
|
|
57
|
+
function ComboboxStatus({ className, ...props }) {
|
|
58
|
+
return _jsx(ComboboxStatusPrimitive, { className: cx("mb-combo-box-status", className), ...props });
|
|
59
|
+
}
|
|
60
|
+
function AutocompleteLabel({ className, ...props }) {
|
|
61
|
+
return _jsx(AutocompleteLabelPrimitive, { className: cx("mb-combo-box-label", className), ...props });
|
|
62
|
+
}
|
|
63
|
+
function AutocompleteInput({ className, ...props }) {
|
|
64
|
+
return _jsx(AutocompleteInputPrimitive, { className: cx("mb-combo-box-input", className), ...props });
|
|
65
|
+
}
|
|
66
|
+
function AutocompleteTrigger({ className, children, ...props }) {
|
|
67
|
+
return (_jsx(AutocompleteTriggerPrimitive, { className: cx("mb-combo-box-trigger", className), ...props, children: children ?? _jsx(ChevronGlyph, { direction: "down" }) }));
|
|
68
|
+
}
|
|
69
|
+
function AutocompleteClear({ className, children, ...props }) {
|
|
70
|
+
return (_jsx(AutocompleteClearPrimitive, { className: cx("mb-combo-box-clear", className), ...props, children: children ?? _jsx(ClearGlyph, {}) }));
|
|
71
|
+
}
|
|
72
|
+
function AutocompleteContent({ sideOffset = 4, className, ...props }) {
|
|
73
|
+
return (_jsx(AutocompleteContentPrimitive, { sideOffset: sideOffset, className: cx("mb-menu-content mb-combo-box-content", className), ...props }));
|
|
74
|
+
}
|
|
75
|
+
function AutocompleteList({ className, ...props }) {
|
|
76
|
+
return _jsx(AutocompleteListPrimitive, { className: cx("mb-combo-box-list", className), ...props });
|
|
77
|
+
}
|
|
78
|
+
function AutocompleteItem({ className, ...props }) {
|
|
79
|
+
return _jsx(AutocompleteItemPrimitive, { className: cx("mb-menu-item mb-combo-box-item", className), ...props });
|
|
80
|
+
}
|
|
81
|
+
function AutocompleteItemIcon({ className, ...props }) {
|
|
82
|
+
return _jsx(AutocompleteItemIconPrimitive, { className: cx("mb-menu-item-icon", className), ...props });
|
|
83
|
+
}
|
|
84
|
+
function AutocompleteItemText({ className, ...props }) {
|
|
85
|
+
return _jsx(AutocompleteItemTextPrimitive, { className: cx("mb-combo-box-item-text", className), ...props });
|
|
86
|
+
}
|
|
87
|
+
function AutocompleteGroup({ className, ...props }) {
|
|
88
|
+
return _jsx(AutocompleteGroupPrimitive, { className: cx("mb-menu-group", className), ...props });
|
|
89
|
+
}
|
|
90
|
+
function AutocompleteGroupLabel({ className, ...props }) {
|
|
91
|
+
return _jsx(AutocompleteGroupLabelPrimitive, { className: cx("mb-menu-group-label", className), ...props });
|
|
92
|
+
}
|
|
93
|
+
function AutocompleteSeparator({ className, ...props }) {
|
|
94
|
+
return _jsx(AutocompleteSeparatorPrimitive, { className: cx("mb-menu-separator", className), ...props });
|
|
95
|
+
}
|
|
96
|
+
function AutocompleteEmpty({ className, ...props }) {
|
|
97
|
+
return _jsx(AutocompleteEmptyPrimitive, { className: cx("mb-combo-box-empty", className), ...props });
|
|
98
|
+
}
|
|
99
|
+
function AutocompleteStatus({ className, ...props }) {
|
|
100
|
+
return _jsx(AutocompleteStatusPrimitive, { className: cx("mb-combo-box-status", className), ...props });
|
|
101
|
+
}
|
|
102
|
+
export { Autocomplete, AutocompleteClear, AutocompleteContent, AutocompleteEmpty, AutocompleteGroup, AutocompleteGroupLabel, AutocompleteInput, AutocompleteItem, AutocompleteItemIcon, AutocompleteItems, AutocompleteItemText, AutocompleteLabel, AutocompleteList, AutocompleteSeparator, AutocompleteStatus, AutocompleteTrigger, Combobox, ComboboxClear, ComboboxContent, ComboboxControl, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxItemIcon, ComboboxItemIndicator, ComboboxItems, ComboboxItemText, ComboboxLabel, ComboboxList, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, createAutocompleteController, createComboboxController, };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CommandEmpty as CommandEmptyPrimitive, CommandGroup as CommandGroupPrimitive, CommandGroupLabel as CommandGroupLabelPrimitive, CommandInput as CommandInputPrimitive, CommandItem as CommandItemPrimitive, CommandItemIcon as CommandItemIconPrimitive, CommandItems, CommandItemText as CommandItemTextPrimitive, CommandList as CommandListPrimitive, CommandPage, CommandSeparator as CommandSeparatorPrimitive, CommandShortcut as CommandShortcutPrimitive, CommandStatus as CommandStatusPrimitive, createCommandController } from "@ui-sdk/react/command";
|
|
2
|
+
import type { CommandProps } from "@ui-sdk/react/command";
|
|
3
|
+
import { Dialog, DialogContent, DialogTrigger } from "@ui-sdk/react/dialog";
|
|
4
|
+
import type * as React from "react";
|
|
5
|
+
/** The palette's root: a dialog that holds a `Command`. Control it with `open` and `onOpenChange`. */
|
|
6
|
+
declare function CommandPalette(props: React.ComponentProps<typeof Dialog>): React.JSX.Element;
|
|
7
|
+
type CommandPaletteTriggerProps = Omit<React.ComponentProps<typeof DialogTrigger>, "children"> & {
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
/** A search-field-shaped button that opens the palette, with ⌘K by default. */
|
|
11
|
+
declare function CommandPaletteTrigger({ shortcut, className, children, ...props }: CommandPaletteTriggerProps): React.JSX.Element;
|
|
12
|
+
type CommandPaletteContentProps = Omit<React.ComponentProps<typeof DialogContent>, "children"> & {
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
/** Names the palette for screen readers. It isn't shown. */
|
|
15
|
+
title?: string;
|
|
16
|
+
};
|
|
17
|
+
/** The floating panel, Spotlight-style: a large translucent sheet of glass near the top of the screen. */
|
|
18
|
+
declare function CommandPaletteContent({ title, className, children, ...props }: CommandPaletteContentProps): React.JSX.Element;
|
|
19
|
+
declare function Command({ className, ...props }: CommandProps): React.JSX.Element;
|
|
20
|
+
/** The search field. Renders its own magnifier. */
|
|
21
|
+
declare function CommandInput({ className, ...props }: React.ComponentProps<typeof CommandInputPrimitive>): React.JSX.Element;
|
|
22
|
+
declare function CommandList({ className, ...props }: React.ComponentProps<typeof CommandListPrimitive>): React.JSX.Element;
|
|
23
|
+
declare function CommandItem({ className, ...props }: React.ComponentProps<typeof CommandItemPrimitive>): React.JSX.Element;
|
|
24
|
+
declare function CommandItemIcon({ className, ...props }: React.ComponentProps<typeof CommandItemIconPrimitive>): React.JSX.Element;
|
|
25
|
+
declare function CommandItemText({ className, ...props }: React.ComponentProps<typeof CommandItemTextPrimitive>): React.JSX.Element;
|
|
26
|
+
declare function CommandShortcut({ className, ...props }: React.ComponentProps<typeof CommandShortcutPrimitive>): React.JSX.Element;
|
|
27
|
+
declare function CommandGroup({ className, ...props }: React.ComponentProps<typeof CommandGroupPrimitive>): React.JSX.Element;
|
|
28
|
+
declare function CommandGroupLabel({ className, ...props }: React.ComponentProps<typeof CommandGroupLabelPrimitive>): React.JSX.Element;
|
|
29
|
+
declare function CommandSeparator({ className, ...props }: React.ComponentProps<typeof CommandSeparatorPrimitive>): React.JSX.Element;
|
|
30
|
+
declare function CommandEmpty({ className, ...props }: React.ComponentProps<typeof CommandEmptyPrimitive>): React.JSX.Element;
|
|
31
|
+
declare function CommandStatus({ className, ...props }: React.ComponentProps<typeof CommandStatusPrimitive>): React.JSX.Element;
|
|
32
|
+
export { Command, CommandEmpty, CommandGroup, CommandGroupLabel, CommandInput, CommandItem, CommandItemIcon, CommandItems, CommandItemText, CommandList, CommandPage, CommandPalette, CommandPaletteContent, CommandPaletteTrigger, CommandSeparator, CommandShortcut, CommandStatus, createCommandController, };
|
|
33
|
+
export type { CommandPaletteContentProps, CommandPaletteTriggerProps, CommandProps };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Command as CommandPrimitive, CommandEmpty as CommandEmptyPrimitive, CommandGroup as CommandGroupPrimitive, CommandGroupLabel as CommandGroupLabelPrimitive, CommandInput as CommandInputPrimitive, CommandItem as CommandItemPrimitive, CommandItemIcon as CommandItemIconPrimitive, CommandItems, CommandItemText as CommandItemTextPrimitive, CommandList as CommandListPrimitive, CommandPage, CommandSeparator as CommandSeparatorPrimitive, CommandShortcut as CommandShortcutPrimitive, CommandStatus as CommandStatusPrimitive, createCommandController, } from "@ui-sdk/react/command";
|
|
3
|
+
import { Dialog, DialogBackdrop, DialogContent, DialogShortcut, DialogTitle, DialogTrigger, } from "@ui-sdk/react/dialog";
|
|
4
|
+
import { cx } from "../lib/cx.js";
|
|
5
|
+
import { SearchGlyph } from "../lib/menu-glyphs.js";
|
|
6
|
+
/** The palette's root: a dialog that holds a `Command`. Control it with `open` and `onOpenChange`. */
|
|
7
|
+
function CommandPalette(props) {
|
|
8
|
+
return _jsx(Dialog, { ...props });
|
|
9
|
+
}
|
|
10
|
+
/** A search-field-shaped button that opens the palette, with ⌘K by default. */
|
|
11
|
+
function CommandPaletteTrigger({ shortcut = "mod+k", className, children, ...props }) {
|
|
12
|
+
return (_jsxs(DialogTrigger, { shortcut: shortcut, className: cx("mb-command-palette-trigger", className), ...props, children: [_jsx(SearchGlyph, {}), _jsx("span", { className: "mb-command-palette-trigger-label", children: children ?? "Search" }), _jsx(DialogShortcut, { className: "mb-command-palette-trigger-shortcut" })] }));
|
|
13
|
+
}
|
|
14
|
+
/** The floating panel, Spotlight-style: a large translucent sheet of glass near the top of the screen. */
|
|
15
|
+
function CommandPaletteContent({ title = "Search", className, children, ...props }) {
|
|
16
|
+
return (_jsxs(_Fragment, { children: [_jsx(DialogBackdrop, { className: "mb-command-palette-backdrop" }), _jsxs(DialogContent, { className: cx("mb-command-palette", className), ...props, children: [_jsx(DialogTitle, { className: "mb-visually-hidden", children: title }), children] })] }));
|
|
17
|
+
}
|
|
18
|
+
function Command({ className, ...props }) {
|
|
19
|
+
return _jsx(CommandPrimitive, { className: cx("mb-command", className), ...props });
|
|
20
|
+
}
|
|
21
|
+
/** The search field. Renders its own magnifier. */
|
|
22
|
+
function CommandInput({ className, ...props }) {
|
|
23
|
+
return (_jsxs("div", { className: "mb-command-search", children: [_jsx(SearchGlyph, {}), _jsx(CommandInputPrimitive, { className: cx("mb-command-input", className), ...props })] }));
|
|
24
|
+
}
|
|
25
|
+
function CommandList({ className, ...props }) {
|
|
26
|
+
return _jsx(CommandListPrimitive, { className: cx("mb-command-list", className), ...props });
|
|
27
|
+
}
|
|
28
|
+
function CommandItem({ className, ...props }) {
|
|
29
|
+
return _jsx(CommandItemPrimitive, { className: cx("mb-command-item", className), ...props });
|
|
30
|
+
}
|
|
31
|
+
function CommandItemIcon({ className, ...props }) {
|
|
32
|
+
return _jsx(CommandItemIconPrimitive, { className: cx("mb-command-item-icon", className), ...props });
|
|
33
|
+
}
|
|
34
|
+
function CommandItemText({ className, ...props }) {
|
|
35
|
+
return _jsx(CommandItemTextPrimitive, { className: cx("mb-command-item-text", className), ...props });
|
|
36
|
+
}
|
|
37
|
+
function CommandShortcut({ className, ...props }) {
|
|
38
|
+
return _jsx(CommandShortcutPrimitive, { className: cx("mb-command-shortcut", className), ...props });
|
|
39
|
+
}
|
|
40
|
+
function CommandGroup({ className, ...props }) {
|
|
41
|
+
return _jsx(CommandGroupPrimitive, { className: cx("mb-command-group", className), ...props });
|
|
42
|
+
}
|
|
43
|
+
function CommandGroupLabel({ className, ...props }) {
|
|
44
|
+
return _jsx(CommandGroupLabelPrimitive, { className: cx("mb-command-group-label", className), ...props });
|
|
45
|
+
}
|
|
46
|
+
function CommandSeparator({ className, ...props }) {
|
|
47
|
+
return _jsx(CommandSeparatorPrimitive, { className: cx("mb-command-separator", className), ...props });
|
|
48
|
+
}
|
|
49
|
+
function CommandEmpty({ className, ...props }) {
|
|
50
|
+
return _jsx(CommandEmptyPrimitive, { className: cx("mb-command-empty", className), ...props });
|
|
51
|
+
}
|
|
52
|
+
function CommandStatus({ className, ...props }) {
|
|
53
|
+
return _jsx(CommandStatusPrimitive, { className: cx("mb-command-status", className), ...props });
|
|
54
|
+
}
|
|
55
|
+
export { Command, CommandEmpty, CommandGroup, CommandGroupLabel, CommandInput, CommandItem, CommandItemIcon, CommandItems, CommandItemText, CommandList, CommandPage, CommandPalette, CommandPaletteContent, CommandPaletteTrigger, CommandSeparator, CommandShortcut, CommandStatus, createCommandController, };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MenuContent as MenuContentPrimitive, MenuContextTrigger as MenuContextTriggerPrimitive } from "@ui-sdk/react/menu";
|
|
2
|
+
import type { MenuProps } from "@ui-sdk/react/menu";
|
|
3
|
+
import type * as React from "react";
|
|
4
|
+
/** A menu opened from an area by right-click, long press, Shift+F10 or the context-menu key. */
|
|
5
|
+
declare function ContextMenu(props: MenuProps): React.JSX.Element;
|
|
6
|
+
/** The area that opens the menu. Give it `tabIndex={0}` so the keyboard can open it too. */
|
|
7
|
+
declare function ContextMenuTrigger({ className, ...props }: React.ComponentProps<typeof MenuContextTriggerPrimitive>): React.JSX.Element;
|
|
8
|
+
declare function ContextMenuContent<Payload = unknown>({ className, ...props }: React.ComponentProps<typeof MenuContentPrimitive<Payload>>): React.JSX.Element;
|
|
9
|
+
export { ContextMenu, ContextMenuContent, ContextMenuTrigger };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Menu, MenuContent as MenuContentPrimitive, MenuContextTrigger as MenuContextTriggerPrimitive, } from "@ui-sdk/react/menu";
|
|
3
|
+
import { cx } from "../lib/cx.js";
|
|
4
|
+
/** A menu opened from an area by right-click, long press, Shift+F10 or the context-menu key. */
|
|
5
|
+
function ContextMenu(props) {
|
|
6
|
+
return _jsx(Menu, { ...props });
|
|
7
|
+
}
|
|
8
|
+
/** The area that opens the menu. Give it `tabIndex={0}` so the keyboard can open it too. */
|
|
9
|
+
function ContextMenuTrigger({ className, ...props }) {
|
|
10
|
+
return (_jsx(MenuContextTriggerPrimitive, { className: cx("mb-menu-context-trigger mb-context-menu-trigger", className), ...props }));
|
|
11
|
+
}
|
|
12
|
+
function ContextMenuContent({ className, ...props }) {
|
|
13
|
+
return (_jsx(MenuContentPrimitive, { className: cx("mb-menu-content mb-context-menu-content", className), ...props }));
|
|
14
|
+
}
|
|
15
|
+
export { ContextMenu, ContextMenuContent, ContextMenuTrigger };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { DateInput } from "@ui-sdk/react/date-input";
|
|
2
|
+
import { DatePicker as DatePickerPrimitive, DatePickerContent as DatePickerContentPrimitive, DatePickerTrigger as DatePickerTriggerPrimitive } from "@ui-sdk/react/date-picker";
|
|
3
|
+
import { TimeInput } from "@ui-sdk/react/time-input";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
type FieldSize = "sm" | "md" | "lg";
|
|
6
|
+
type FieldVariant = "auto" | "bordered" | "filled";
|
|
7
|
+
type DateFieldProps = React.ComponentProps<typeof DateInput> & {
|
|
8
|
+
size?: FieldSize;
|
|
9
|
+
/** `auto` is bordered on macOS and filled on touch, like `TextField`. */
|
|
10
|
+
variant?: FieldVariant;
|
|
11
|
+
};
|
|
12
|
+
/** A date typed one part at a time: month, day and year in the locale's order. Arrow keys step a part. */
|
|
13
|
+
declare function DateField({ size, variant, className, children, ...props }: DateFieldProps): React.JSX.Element;
|
|
14
|
+
type TimeFieldProps = React.ComponentProps<typeof TimeInput> & {
|
|
15
|
+
size?: FieldSize;
|
|
16
|
+
variant?: FieldVariant;
|
|
17
|
+
};
|
|
18
|
+
/** A time of day, typed or stepped one part at a time, on the locale's clock. */
|
|
19
|
+
declare function TimeField({ size, variant, className, children, ...props }: TimeFieldProps): React.JSX.Element;
|
|
20
|
+
type PrimitiveProps = React.ComponentProps<typeof DatePickerPrimitive>;
|
|
21
|
+
type DateValue = string | null;
|
|
22
|
+
type PickerDetails = Parameters<NonNullable<PrimitiveProps["onValueChange"]>>[1];
|
|
23
|
+
type SegmentDetails = Parameters<NonNullable<React.ComponentProps<typeof DateInput>["onValueChange"]>>[1];
|
|
24
|
+
type DatePickerProps = Omit<PrimitiveProps, "mode" | "value" | "defaultValue" | "onValueChange"> & {
|
|
25
|
+
value?: DateValue;
|
|
26
|
+
defaultValue?: DateValue;
|
|
27
|
+
/** Runs when a day is picked in the calendar, or typing completes a date in the segments. */
|
|
28
|
+
onValueChange?: (value: DateValue, details: PickerDetails | SegmentDetails) => void;
|
|
29
|
+
/**
|
|
30
|
+
* `field` is the macOS date field: segments you type or step, and a calendar
|
|
31
|
+
* button. `compact` is a button showing the date, as on iOS.
|
|
32
|
+
*/
|
|
33
|
+
variant?: "field" | "compact";
|
|
34
|
+
size?: FieldSize;
|
|
35
|
+
"aria-label"?: string;
|
|
36
|
+
"aria-labelledby"?: string;
|
|
37
|
+
id?: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* A date field whose calendar opens in a popover, or a sheet on a small touch
|
|
41
|
+
* screen. Without children it renders the field, the button and the calendar.
|
|
42
|
+
*/
|
|
43
|
+
declare function DatePicker({ variant, size, value: valueProp, defaultValue, onValueChange, presentation, weekdayFormat, fixedWeeks, showOutsideDays, months, locale, min, max, unavailable, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, id, controller: controllerProp, className, children, ...props }: DatePickerProps): React.JSX.Element;
|
|
44
|
+
/** Opens and closes the calendar. Without children it's a calendar glyph. */
|
|
45
|
+
declare function DatePickerTrigger({ className, children, ...props }: React.ComponentProps<typeof DatePickerTriggerPrimitive>): React.JSX.Element;
|
|
46
|
+
type DatePickerContentProps = React.ComponentProps<typeof DatePickerContentPrimitive> & {
|
|
47
|
+
/** How many month grids the default calendar shows. */
|
|
48
|
+
months?: number;
|
|
49
|
+
};
|
|
50
|
+
/** The calendar's popover: a translucent material. Without children it holds the compact calendar. */
|
|
51
|
+
declare function DatePickerContent({ months, sideOffset, align, className, children, ...props }: DatePickerContentProps): React.JSX.Element;
|
|
52
|
+
export { DateField, DatePicker, DatePickerContent, DatePickerTrigger, TimeField };
|
|
53
|
+
export type { DateFieldProps, DatePickerContentProps, DatePickerProps, TimeFieldProps };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { createDateInputController, DateInput, DateInputSegment } from "@ui-sdk/react/date-input";
|
|
4
|
+
import { createDatePickerController, DatePicker as DatePickerPrimitive, DatePickerContent as DatePickerContentPrimitive, DatePickerTrigger as DatePickerTriggerPrimitive, } from "@ui-sdk/react/date-picker";
|
|
5
|
+
import { TimeInput, TimeInputSegment } from "@ui-sdk/react/time-input";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { cx } from "../lib/cx.js";
|
|
8
|
+
import { CalendarGlyph } from "../lib/field-glyphs.js";
|
|
9
|
+
import { CalendarBody } from "./calendar.js";
|
|
10
|
+
const rtlLanguages = new Set(["ar", "ckb", "dv", "fa", "he", "ps", "sd", "ug", "ur", "yi"]);
|
|
11
|
+
/**
|
|
12
|
+
* Segments follow the direction of the locale that formats them, not the page:
|
|
13
|
+
* "11/14/2026" stays in that order on a right-to-left page, as AppKit's date field does.
|
|
14
|
+
*/
|
|
15
|
+
function localeDir(locale) {
|
|
16
|
+
const resolved = new Intl.DateTimeFormat(locale).resolvedOptions().locale;
|
|
17
|
+
return rtlLanguages.has(resolved.split("-")[0] ?? "") ? "rtl" : "ltr";
|
|
18
|
+
}
|
|
19
|
+
/** A date typed one part at a time: month, day and year in the locale's order. Arrow keys step a part. */
|
|
20
|
+
function DateField({ size = "md", variant = "auto", className, children, ...props }) {
|
|
21
|
+
return (_jsx(DateInput, { dir: localeDir(props.locale), "data-size": size, "data-variant": variant, className: cx("mb-date-field", className), ...props, children: children ??
|
|
22
|
+
(({ segments }) => segments.map((segment) => (_jsx(DateInputSegment, { segment: segment, className: "mb-date-field-segment" }, segment.key)))) }));
|
|
23
|
+
}
|
|
24
|
+
/** A time of day, typed or stepped one part at a time, on the locale's clock. */
|
|
25
|
+
function TimeField({ size = "md", variant = "auto", className, children, ...props }) {
|
|
26
|
+
return (_jsx(TimeInput, { dir: localeDir(props.locale), "data-size": size, "data-variant": variant, className: cx("mb-date-field mb-time-field", className), ...props, children: children ??
|
|
27
|
+
(({ segments }) => segments.map((segment) => (_jsx(TimeInputSegment, { segment: segment, className: "mb-date-field-segment" }, segment.key)))) }));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A date field whose calendar opens in a popover, or a sheet on a small touch
|
|
31
|
+
* screen. Without children it renders the field, the button and the calendar.
|
|
32
|
+
*/
|
|
33
|
+
function DatePicker({ variant = "field", size = "md", value: valueProp, defaultValue = null, onValueChange, presentation = "auto", weekdayFormat = "narrow", fixedWeeks = true, showOutsideDays = false, months = 1, locale, min, max, unavailable, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, id, controller: controllerProp, className, children, ...props }) {
|
|
34
|
+
const [own] = React.useState(createDatePickerController);
|
|
35
|
+
const picker = controllerProp ?? own;
|
|
36
|
+
const [current, setCurrent] = React.useState(defaultValue);
|
|
37
|
+
const value = valueProp !== undefined ? valueProp : current;
|
|
38
|
+
const [anchor, setAnchor] = React.useState(null);
|
|
39
|
+
const [segments] = React.useState(createDateInputController);
|
|
40
|
+
const typed = React.useRef(false);
|
|
41
|
+
// A date picked in the calendar shows in the segments; one typed there is already showing.
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
if (variant !== "field")
|
|
44
|
+
return;
|
|
45
|
+
if (typed.current) {
|
|
46
|
+
typed.current = false;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (segments.getValue() !== value)
|
|
50
|
+
segments.setValue(value);
|
|
51
|
+
}, [segments, value, variant]);
|
|
52
|
+
const commit = (next, details) => {
|
|
53
|
+
const date = typeof next === "string" ? next : null;
|
|
54
|
+
onValueChange?.(date, details);
|
|
55
|
+
if (!details.canceled && valueProp === undefined)
|
|
56
|
+
setCurrent(date);
|
|
57
|
+
};
|
|
58
|
+
return (_jsx(DatePickerPrimitive, { value: value, onValueChange: commit, controller: picker, presentation: presentation, weekdayFormat: weekdayFormat, fixedWeeks: fixedWeeks, showOutsideDays: showOutsideDays, months: months, locale: locale, min: min, max: max, unavailable: unavailable, "data-variant": variant, "data-size": size, className: cx("mb-date-picker", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [variant === "compact" ? (_jsx(DatePickerTriggerPrimitive, { id: id, "aria-label": ariaLabel && `${ariaLabel}, ${format(value, locale) ?? "none"}`, "aria-labelledby": ariaLabelledBy, className: "mb-date-picker-button", children: format(value, locale) ?? "Choose a date" })) : (_jsxs("div", { ref: setAnchor, "data-size": size, className: "mb-date-picker-field", onKeyDown: (event) => {
|
|
59
|
+
if (event.altKey && event.key === "ArrowDown") {
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
picker.setOpen(true);
|
|
62
|
+
}
|
|
63
|
+
}, children: [_jsx(DateInput, { controller: segments, defaultValue: value, locale: locale, min: min, max: max, unavailable: unavailable, id: id, dir: localeDir(locale), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className: "mb-date-picker-segments", onValueChange: (next, details) => {
|
|
64
|
+
if (details.reason === "imperative")
|
|
65
|
+
return;
|
|
66
|
+
typed.current = true;
|
|
67
|
+
commit(next, details);
|
|
68
|
+
}, children: ({ segments: parts }) => parts.map((segment) => (_jsx(DateInputSegment, { segment: segment, className: "mb-date-field-segment" }, segment.key))) }), _jsx(DatePickerTrigger, { "aria-label": "Show calendar" })] })), _jsx(DatePickerContent, { anchor: variant === "compact" ? undefined : anchor, months: months })] })) }));
|
|
69
|
+
}
|
|
70
|
+
function format(value, locale) {
|
|
71
|
+
if (!value)
|
|
72
|
+
return null;
|
|
73
|
+
const [y, m, d] = value.split("-").map(Number);
|
|
74
|
+
if (!y || !m || !d)
|
|
75
|
+
return null;
|
|
76
|
+
return new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeZone: "UTC" }).format(Date.UTC(y, m - 1, d));
|
|
77
|
+
}
|
|
78
|
+
/** Opens and closes the calendar. Without children it's a calendar glyph. */
|
|
79
|
+
function DatePickerTrigger({ className, children, ...props }) {
|
|
80
|
+
return (_jsx(DatePickerTriggerPrimitive, { className: cx("mb-date-picker-trigger", className), ...props, children: children ?? _jsx(CalendarGlyph, {}) }));
|
|
81
|
+
}
|
|
82
|
+
/** The calendar's popover: a translucent material. Without children it holds the compact calendar. */
|
|
83
|
+
function DatePickerContent({ months, sideOffset = 6, align = "start", className, children, ...props }) {
|
|
84
|
+
return (_jsx(DatePickerContentPrimitive, { sideOffset: sideOffset, align: align, className: cx("mb-date-picker-content", className), ...props, children: children ?? (_jsx("div", { className: "mb-calendar mb-date-picker-calendar", "data-size": "sm", children: _jsx(CalendarBody, { months: months }) })) }));
|
|
85
|
+
}
|
|
86
|
+
export { DateField, DatePicker, DatePickerContent, DatePickerTrigger, TimeField };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
type DeviceFrameProps = React.ComponentProps<"div"> & {
|
|
3
|
+
device?: "iphone" | "ipad";
|
|
4
|
+
/** The iPad's orientation. iPhone frames are portrait. */
|
|
5
|
+
orientation?: "portrait" | "landscape";
|
|
6
|
+
/** The status bar's clock. */
|
|
7
|
+
time?: string;
|
|
8
|
+
/** The date beside the clock on iPad. */
|
|
9
|
+
date?: string;
|
|
10
|
+
/** Shows the status bar's time, signal, Wi-Fi and battery. */
|
|
11
|
+
statusBar?: boolean;
|
|
12
|
+
homeIndicator?: boolean;
|
|
13
|
+
/** Scales the whole device, for fitting a phone into a column. 1 is actual size in points. */
|
|
14
|
+
scale?: number;
|
|
15
|
+
};
|
|
16
|
+
declare function DeviceFrame({ device, orientation, time, date, statusBar, homeIndicator, scale, className, style, children, ...props }: DeviceFrameProps): React.JSX.Element;
|
|
17
|
+
export { DeviceFrame };
|
|
18
|
+
export type { DeviceFrameProps };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { join } from "../lib/cx.js";
|
|
3
|
+
function DeviceFrame({ device = "iphone", orientation = device === "ipad" ? "landscape" : "portrait", time = "9:41", date = "Mon Jun 9", statusBar = true, homeIndicator = true, scale, className, style, children, ...props }) {
|
|
4
|
+
const platform = device === "ipad" ? "ipados" : "ios";
|
|
5
|
+
return (_jsx("div", { "data-device": device, "data-orientation": orientation, className: join("mb-device-frame", className), style: scale ? { "--mb-device-scale": scale, ...style } : style, ...props, children: _jsxs("div", { "data-platform": platform, "data-macbetter": "", className: "mb-device-frame-screen", children: [children, statusBar ? (_jsxs("div", { "aria-hidden": "true", className: "mb-device-frame-status-bar", children: [_jsx("span", { className: "mb-device-frame-time", children: time }), device === "ipad" ? _jsx("span", { className: "mb-device-frame-date", children: date }) : null, _jsxs("span", { className: "mb-device-frame-indicators", children: [_jsx(SignalIcon, {}), _jsx(WifiIcon, {}), _jsx(BatteryIcon, {})] })] })) : null, device === "iphone" ? _jsx("div", { "aria-hidden": "true", className: "mb-device-frame-island" }) : null, homeIndicator ? _jsx("div", { "aria-hidden": "true", className: "mb-device-frame-home-indicator" }) : null] }) }));
|
|
6
|
+
}
|
|
7
|
+
function SignalIcon() {
|
|
8
|
+
return (_jsxs("svg", { viewBox: "0 0 18 12", className: "mb-device-frame-icon", "data-icon": "signal", children: [_jsx("rect", { x: "0", y: "7.5", width: "3", height: "4.5", rx: "0.9" }), _jsx("rect", { x: "5", y: "5", width: "3", height: "7", rx: "0.9" }), _jsx("rect", { x: "10", y: "2.5", width: "3", height: "9.5", rx: "0.9" }), _jsx("rect", { x: "15", y: "0", width: "3", height: "12", rx: "0.9" })] }));
|
|
9
|
+
}
|
|
10
|
+
function WifiIcon() {
|
|
11
|
+
return (_jsxs("svg", { viewBox: "0 0 16 12", className: "mb-device-frame-icon", "data-icon": "wifi", children: [_jsx("path", { d: "M8 2.3c2.3 0 4.4.9 6 2.4l1.2-1.2A10.2 10.2 0 0 0 8 .6C5.2.6 2.6 1.7.8 3.5L2 4.7a8.5 8.5 0 0 1 6-2.4z" }), _jsx("path", { d: "M8 5.7c1.4 0 2.6.5 3.6 1.4l1.2-1.2A6.9 6.9 0 0 0 8 4c-1.8 0-3.5.7-4.8 1.9l1.2 1.2c1-.9 2.2-1.4 3.6-1.4z" }), _jsx("path", { d: "M8 9.1c.5 0 .9.2 1.2.5L8 11.4 6.8 9.6c.3-.3.7-.5 1.2-.5z" }), _jsx("path", { d: "M8 7.4c.9 0 1.7.3 2.4.9L9.2 9.5A1.8 1.8 0 0 0 8 9.1c-.5 0-.9.2-1.2.4L5.6 8.3A3.6 3.6 0 0 1 8 7.4z" })] }));
|
|
12
|
+
}
|
|
13
|
+
function BatteryIcon() {
|
|
14
|
+
return (_jsxs("svg", { viewBox: "0 0 27 13", className: "mb-device-frame-icon", "data-icon": "battery", children: [_jsx("rect", { x: "0.5", y: "0.5", width: "23", height: "12", rx: "3.8", fill: "none", stroke: "currentColor", opacity: "0.4" }), _jsx("rect", { x: "2", y: "2", width: "20", height: "9", rx: "2.5" }), _jsx("path", { d: "M25 4.5v4c.8-.3 1.4-1.1 1.4-2s-.6-1.7-1.4-2z", opacity: "0.45" })] }));
|
|
15
|
+
}
|
|
16
|
+
export { DeviceFrame };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Dialog as DialogPrimitive, DialogClose as DialogClosePrimitive, DialogContent as DialogContentPrimitive, DialogDescription as DialogDescriptionPrimitive, DialogTitle as DialogTitlePrimitive, DialogTrigger as DialogTriggerPrimitive } from "@ui-sdk/react/dialog";
|
|
2
|
+
import type * as React from "react";
|
|
3
|
+
type DialogProps = React.ComponentProps<typeof DialogPrimitive>;
|
|
4
|
+
/** `presentation` defaults to `auto`: a swipeable page sheet on phones, a centered panel elsewhere. */
|
|
5
|
+
declare function Dialog({ presentation, ...props }: DialogProps): React.JSX.Element;
|
|
6
|
+
declare function DialogTrigger(props: React.ComponentProps<typeof DialogTriggerPrimitive>): React.JSX.Element;
|
|
7
|
+
type DialogContentProps<Payload = unknown> = React.ComponentProps<typeof DialogContentPrimitive<Payload>> & {
|
|
8
|
+
/** The panel's width on macOS and iPadOS. iPhone always fills the screen. */
|
|
9
|
+
size?: "sm" | "md" | "lg";
|
|
10
|
+
};
|
|
11
|
+
declare function DialogContent<Payload = unknown>({ size, className, ...props }: DialogContentProps<Payload>): React.JSX.Element;
|
|
12
|
+
/** Holds the title and description. On iOS and iPadOS it becomes the navigation bar. */
|
|
13
|
+
declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
14
|
+
declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogTitlePrimitive>): React.JSX.Element;
|
|
15
|
+
declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogDescriptionPrimitive>): React.JSX.Element;
|
|
16
|
+
declare function DialogBody({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
17
|
+
/** Right-aligned buttons on macOS. On iOS and iPadOS its cancel and primary buttons move into the navigation bar. */
|
|
18
|
+
declare function DialogFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
19
|
+
type DialogCloseProps = React.ComponentProps<typeof DialogClosePrimitive> & {
|
|
20
|
+
/** `primary` is the default action (Done, Save); `cancel` dismisses. On touch they sit at the ends of the navigation bar. */
|
|
21
|
+
variant?: "default" | "primary" | "cancel";
|
|
22
|
+
tone?: "accent" | "destructive";
|
|
23
|
+
};
|
|
24
|
+
declare function DialogClose({ variant, tone, className, ...props }: DialogCloseProps): React.JSX.Element;
|
|
25
|
+
export { createDialogController } from "@ui-sdk/react/dialog";
|
|
26
|
+
export { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, };
|
|
27
|
+
export type { DialogCloseProps, DialogContentProps, DialogProps };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog as DialogPrimitive, DialogBackdrop, DialogClose as DialogClosePrimitive, DialogContent as DialogContentPrimitive, DialogDescription as DialogDescriptionPrimitive, DialogTitle as DialogTitlePrimitive, DialogTrigger as DialogTriggerPrimitive, } from "@ui-sdk/react/dialog";
|
|
3
|
+
import { cx, join } from "../lib/cx.js";
|
|
4
|
+
/** `presentation` defaults to `auto`: a swipeable page sheet on phones, a centered panel elsewhere. */
|
|
5
|
+
function Dialog({ presentation = "auto", ...props }) {
|
|
6
|
+
return _jsx(DialogPrimitive, { presentation: presentation, ...props });
|
|
7
|
+
}
|
|
8
|
+
function DialogTrigger(props) {
|
|
9
|
+
return _jsx(DialogTriggerPrimitive, { ...props });
|
|
10
|
+
}
|
|
11
|
+
function DialogContent({ size = "md", className, ...props }) {
|
|
12
|
+
return (_jsxs(_Fragment, { children: [_jsx(DialogBackdrop, { className: "mb-dialog-backdrop" }), _jsx(DialogContentPrimitive, { "data-size": size, className: cx("mb-dialog", className), ...props })] }));
|
|
13
|
+
}
|
|
14
|
+
/** Holds the title and description. On iOS and iPadOS it becomes the navigation bar. */
|
|
15
|
+
function DialogHeader({ className, ...props }) {
|
|
16
|
+
return _jsx("div", { className: join("mb-dialog-header", className), ...props });
|
|
17
|
+
}
|
|
18
|
+
function DialogTitle({ className, ...props }) {
|
|
19
|
+
return _jsx(DialogTitlePrimitive, { className: cx("mb-dialog-title", className), ...props });
|
|
20
|
+
}
|
|
21
|
+
function DialogDescription({ className, ...props }) {
|
|
22
|
+
return _jsx(DialogDescriptionPrimitive, { className: cx("mb-dialog-description", className), ...props });
|
|
23
|
+
}
|
|
24
|
+
function DialogBody({ className, ...props }) {
|
|
25
|
+
return _jsx("div", { className: join("mb-dialog-body", className), ...props });
|
|
26
|
+
}
|
|
27
|
+
/** Right-aligned buttons on macOS. On iOS and iPadOS its cancel and primary buttons move into the navigation bar. */
|
|
28
|
+
function DialogFooter({ className, ...props }) {
|
|
29
|
+
return _jsx("div", { className: join("mb-dialog-footer", className), ...props });
|
|
30
|
+
}
|
|
31
|
+
function DialogClose({ variant = "default", tone = "accent", className, ...props }) {
|
|
32
|
+
return (_jsx(DialogClosePrimitive, { "data-variant": variant, "data-tone": tone, className: cx("mb-dialog-close", className), ...props }));
|
|
33
|
+
}
|
|
34
|
+
export { createDialogController } from "@ui-sdk/react/dialog";
|
|
35
|
+
export { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Accordion, AccordionHeader, AccordionItem, AccordionPanel, AccordionTrigger } from "@ui-sdk/react/accordion";
|
|
2
|
+
import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "@ui-sdk/react/collapsible";
|
|
3
|
+
import type * as React from "react";
|
|
4
|
+
type DisclosureVariant = "grouped" | "plain";
|
|
5
|
+
type DisclosureGroupProps = React.ComponentProps<typeof Accordion> & {
|
|
6
|
+
/** `grouped` draws the rows in an inset grouped box, like a Settings list; `plain` draws bare rows. */
|
|
7
|
+
variant?: DisclosureVariant;
|
|
8
|
+
};
|
|
9
|
+
/** Several disclosures in a group: by default one opens at a time; `multiple` lets several open. */
|
|
10
|
+
declare function DisclosureGroup({ variant, className, ...props }: DisclosureGroupProps): React.JSX.Element;
|
|
11
|
+
declare function DisclosureItem({ className, ...props }: React.ComponentProps<typeof AccordionItem>): React.JSX.Element;
|
|
12
|
+
/** The heading around a trigger. It renders an `h3`; pick the level that fits with `render`. */
|
|
13
|
+
declare function DisclosureHeader({ className, ...props }: React.ComponentProps<typeof AccordionHeader>): React.JSX.Element;
|
|
14
|
+
declare function DisclosureTrigger({ className, children, ...props }: Omit<React.ComponentProps<typeof AccordionTrigger>, "children"> & {
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
}): React.JSX.Element;
|
|
17
|
+
declare function DisclosurePanel({ className, children, ...props }: Omit<React.ComponentProps<typeof AccordionPanel>, "children"> & {
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
}): React.JSX.Element;
|
|
20
|
+
type DisclosureProps = React.ComponentProps<typeof Collapsible> & {
|
|
21
|
+
variant?: DisclosureVariant;
|
|
22
|
+
};
|
|
23
|
+
/** One disclosure on its own, like "Advanced" under a form. */
|
|
24
|
+
declare function Disclosure({ variant, className, ...props }: DisclosureProps): React.JSX.Element;
|
|
25
|
+
declare function DisclosureButton({ className, children, ...props }: Omit<React.ComponentProps<typeof CollapsibleTrigger>, "children"> & {
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
}): React.JSX.Element;
|
|
28
|
+
declare function DisclosureContent({ className, children, ...props }: Omit<React.ComponentProps<typeof CollapsiblePanel>, "children"> & {
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
}): React.JSX.Element;
|
|
31
|
+
export { Disclosure, DisclosureButton, DisclosureContent, DisclosureGroup, DisclosureHeader, DisclosureItem, DisclosurePanel, DisclosureTrigger, };
|
|
32
|
+
export type { DisclosureGroupProps, DisclosureProps, DisclosureVariant };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Accordion, AccordionHeader, AccordionItem, AccordionPanel, AccordionTrigger, } from "@ui-sdk/react/accordion";
|
|
3
|
+
import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "@ui-sdk/react/collapsible";
|
|
4
|
+
import { cx } from "../lib/cx.js";
|
|
5
|
+
function Chevron() {
|
|
6
|
+
return (_jsx("svg", { className: "mb-disclosure-chevron", viewBox: "0 0 8 14", "aria-hidden": "true", children: _jsx("path", { d: "M1.5 1.5 6.5 7l-5 5.5" }) }));
|
|
7
|
+
}
|
|
8
|
+
/** Several disclosures in a group: by default one opens at a time; `multiple` lets several open. */
|
|
9
|
+
function DisclosureGroup({ variant = "grouped", className, ...props }) {
|
|
10
|
+
return _jsx(Accordion, { "data-variant": variant, className: cx("mb-disclosure-group", className), ...props });
|
|
11
|
+
}
|
|
12
|
+
function DisclosureItem({ className, ...props }) {
|
|
13
|
+
return _jsx(AccordionItem, { className: cx("mb-disclosure-item", className), ...props });
|
|
14
|
+
}
|
|
15
|
+
/** The heading around a trigger. It renders an `h3`; pick the level that fits with `render`. */
|
|
16
|
+
function DisclosureHeader({ className, ...props }) {
|
|
17
|
+
return _jsx(AccordionHeader, { className: cx("mb-disclosure-header", className), ...props });
|
|
18
|
+
}
|
|
19
|
+
function DisclosureTrigger({ className, children, ...props }) {
|
|
20
|
+
return (_jsxs(AccordionTrigger, { className: cx("mb-disclosure-trigger", className), ...props, children: [_jsx(Chevron, {}), _jsx("span", { className: "mb-disclosure-label", children: children })] }));
|
|
21
|
+
}
|
|
22
|
+
function DisclosurePanel({ className, children, ...props }) {
|
|
23
|
+
return (_jsx(AccordionPanel, { className: cx("mb-disclosure-panel", className), ...props, children: _jsx("div", { className: "mb-disclosure-content", children: children }) }));
|
|
24
|
+
}
|
|
25
|
+
/** One disclosure on its own, like "Advanced" under a form. */
|
|
26
|
+
function Disclosure({ variant = "plain", className, ...props }) {
|
|
27
|
+
return _jsx(Collapsible, { "data-variant": variant, className: cx("mb-disclosure", className), ...props });
|
|
28
|
+
}
|
|
29
|
+
function DisclosureButton({ className, children, ...props }) {
|
|
30
|
+
return (_jsxs(CollapsibleTrigger, { className: cx("mb-disclosure-trigger", className), ...props, children: [_jsx(Chevron, {}), _jsx("span", { className: "mb-disclosure-label", children: children })] }));
|
|
31
|
+
}
|
|
32
|
+
function DisclosureContent({ className, children, ...props }) {
|
|
33
|
+
return (_jsx(CollapsiblePanel, { className: cx("mb-disclosure-panel", className), ...props, children: _jsx("div", { className: "mb-disclosure-content", children: children }) }));
|
|
34
|
+
}
|
|
35
|
+
export { Disclosure, DisclosureButton, DisclosureContent, DisclosureGroup, DisclosureHeader, DisclosureItem, DisclosurePanel, DisclosureTrigger, };
|