@omer-x/tailwind-ui-kit 1.0.0-alpha.35 → 1.0.0-alpha.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +154 -0
- package/dist/components/display/BaseMeter.d.ts +60 -0
- package/dist/components/display/BaseMeter.js +45 -0
- package/dist/components/display/BaseMeterIndicator.d.ts +9 -0
- package/dist/components/display/BaseMeterIndicator.js +12 -0
- package/dist/components/display/BaseMeterLabel.d.ts +9 -0
- package/dist/components/display/BaseMeterLabel.js +7 -0
- package/dist/components/display/BaseMeterTrack.d.ts +12 -0
- package/dist/components/display/BaseMeterTrack.js +12 -0
- package/dist/components/display/BaseMeterValue.d.ts +14 -0
- package/dist/components/display/BaseMeterValue.js +10 -0
- package/dist/components/display/barStyles.d.ts +5 -0
- package/dist/components/display/barStyles.js +20 -0
- package/dist/components/display/index.d.ts +2 -1
- package/dist/components/display/index.js +3 -1
- package/dist/components/menu/BaseContextMenu.d.ts +140 -0
- package/dist/components/menu/BaseContextMenu.js +38 -0
- package/dist/components/menu/BaseContextMenuTrigger.d.ts +15 -0
- package/dist/components/menu/BaseContextMenuTrigger.js +10 -0
- package/dist/components/menu/BaseMenuArrow.d.ts +19 -0
- package/dist/components/menu/BaseMenuArrow.js +10 -0
- package/dist/components/menu/BaseMenuCheckboxItem.d.ts +37 -0
- package/dist/components/menu/BaseMenuCheckboxItem.js +25 -0
- package/dist/components/menu/BaseMenuGroup.d.ts +8 -0
- package/dist/components/menu/BaseMenuGroup.js +7 -0
- package/dist/components/menu/BaseMenuGroupLabel.d.ts +8 -0
- package/dist/components/menu/BaseMenuGroupLabel.js +11 -0
- package/dist/components/menu/BaseMenuItem.d.ts +24 -0
- package/dist/components/menu/BaseMenuItem.js +12 -0
- package/dist/components/menu/BaseMenuLinkItem.d.ts +20 -0
- package/dist/components/menu/BaseMenuLinkItem.js +12 -0
- package/dist/components/menu/BaseMenuPopup.d.ts +70 -0
- package/dist/components/menu/BaseMenuPopup.js +37 -0
- package/dist/components/menu/BaseMenuRadioGroup.d.ts +19 -0
- package/dist/components/menu/BaseMenuRadioGroup.js +10 -0
- package/dist/components/menu/BaseMenuRadioItem.d.ts +36 -0
- package/dist/components/menu/BaseMenuRadioItem.js +24 -0
- package/dist/components/menu/BaseMenuSeparator.d.ts +11 -0
- package/dist/components/menu/BaseMenuSeparator.js +11 -0
- package/dist/components/menu/BaseMenuSubmenu.d.ts +28 -0
- package/dist/components/menu/BaseMenuSubmenu.js +10 -0
- package/dist/components/menu/BaseMenuSubmenuTrigger.d.ts +43 -0
- package/dist/components/menu/BaseMenuSubmenuTrigger.js +20 -0
- package/dist/components/menu/index.d.ts +12 -0
- package/dist/components/menu/index.js +1 -0
- package/dist/components/menu/menuItemStyles.d.ts +6 -0
- package/dist/components/menu/menuItemStyles.js +27 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -652,6 +652,99 @@ const removeAlert = createAlertDialogHandle<{ id: string, name: string }>();
|
|
|
652
652
|
</BaseAlertDialog>
|
|
653
653
|
```
|
|
654
654
|
|
|
655
|
+
### `@omer-x/tailwind-ui-kit/menu`
|
|
656
|
+
|
|
657
|
+
#### `BaseContextMenu`
|
|
658
|
+
|
|
659
|
+
A Base UI [`Context Menu`](https://base-ui.com/react/components/context-menu): a menu that opens at the pointer on right click or long press. `Popup` brings its portal and positioner, so a simple context menu needs no more than this:
|
|
660
|
+
|
|
661
|
+
```tsx
|
|
662
|
+
import { BaseContextMenu } from "@omer-x/tailwind-ui-kit/menu";
|
|
663
|
+
|
|
664
|
+
<BaseContextMenu>
|
|
665
|
+
<BaseContextMenu.Trigger className="h-40 rounded border border-dashed">Right click here</BaseContextMenu.Trigger>
|
|
666
|
+
<BaseContextMenu.Popup className="rounded-md border bg-white shadow-lg">
|
|
667
|
+
<BaseContextMenu.Item className="data-highlighted:bg-neutral-100" onClick={reload}>Reload</BaseContextMenu.Item>
|
|
668
|
+
<BaseContextMenu.Separator className="bg-neutral-200" />
|
|
669
|
+
<BaseContextMenu.LinkItem className="data-highlighted:bg-neutral-100" href="/help">Help</BaseContextMenu.LinkItem>
|
|
670
|
+
</BaseContextMenu.Popup>
|
|
671
|
+
</BaseContextMenu>
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
Like `BaseDialog`, the parts use dot notation, so build menus in a `"use client"` file. Every part except the root and `Trigger` is shared with the upcoming `BaseMenu`, so one set of popup and item styles themes both.
|
|
675
|
+
|
|
676
|
+
| Part | Renders | Description |
|
|
677
|
+
|------|---------|-------------|
|
|
678
|
+
| `BaseContextMenu` | nothing | Groups the parts and holds the open state |
|
|
679
|
+
| `BaseContextMenu.Trigger` | `<div>` | The area that opens the menu on right click or long press. `data-popup-open` while the menu is open |
|
|
680
|
+
| `BaseContextMenu.Popup` | `<div>` | The menu, portaled and placed at the pointer (or next to its submenu trigger), with scale and fade transitions. Scrolls when taller than the viewport. Optional backdrop |
|
|
681
|
+
| `BaseContextMenu.Arrow` | `<div>` | An arrow pointing at the anchor, inside `Popup`. Draw it yourself |
|
|
682
|
+
| `BaseContextMenu.Item` | `<div>` | An action. Closes the menu when clicked (`closeOnClick`, default `true`) |
|
|
683
|
+
| `BaseContextMenu.LinkItem` | `<a>` | A link. Use `render` for your router's link. Doesn't close the menu (`closeOnClick`, default `false`) |
|
|
684
|
+
| `BaseContextMenu.Separator` | `<div>` | A `1px` line between items (`my-1 h-px`). Give it a color with `className` |
|
|
685
|
+
| `BaseContextMenu.Group` | `<div>` | Groups related items, labelled by the `GroupLabel` inside it |
|
|
686
|
+
| `BaseContextMenu.GroupLabel` | `<div>` | The group's name (`text-xs font-medium`) |
|
|
687
|
+
| `BaseContextMenu.RadioGroup` | `<div>` | Holds `RadioItem`s: `value` / `defaultValue`, `onValueChange(value, event)`, `disabled` |
|
|
688
|
+
| `BaseContextMenu.RadioItem` | `<div>` | An option of a `RadioGroup` (`value`) |
|
|
689
|
+
| `BaseContextMenu.CheckboxItem` | `<div>` | A toggle: `checked` / `defaultChecked`, `onCheckedChange(checked, event)` |
|
|
690
|
+
| `BaseContextMenu.Submenu` | nothing | Holds a `SubmenuTrigger` and a nested `Popup`. Takes `open` / `defaultOpen`, `onOpenChange`, `onOpenChangeComplete`, `disabled`, `loopFocus`, `highlightItemOnHover` and `closeParentOnEsc` |
|
|
691
|
+
| `BaseContextMenu.SubmenuTrigger` | `<div>` | The item that opens its submenu, on click or hover (`openOnHover`, `delay`, `closeDelay`). `icon` is shown at the end (e.g. a chevron), with `iconClassName` for its `<span>` |
|
|
692
|
+
|
|
693
|
+
Every part that renders an element takes `className` and `render`.
|
|
694
|
+
|
|
695
|
+
Items (`Item`, `LinkItem`, `SubmenuTrigger`, `CheckboxItem`, `RadioItem`) share one layout: `flex items-center gap-2 px-3 py-1.5 text-sm`, no outline, faded and inert while disabled. They take `label` (the text for keyboard text navigation), and the `<div>` ones take `disabled` and `nativeButton` (set it to `true` when `render` renders a `<button>`). Style the highlighted item with `data-highlighted:`.
|
|
696
|
+
|
|
697
|
+
`CheckboxItem` and `RadioItem` put their indicator in a first `1rem` column, so labels line up whether it shows or not. Indicator props:
|
|
698
|
+
|
|
699
|
+
| Prop | Type | Description |
|
|
700
|
+
|------|------|-------------|
|
|
701
|
+
| `indicator` | `ReactNode` | Shown when checked, e.g. a check mark or a dot. Nothing by default |
|
|
702
|
+
| `renderIndicator` | `RenderProp<"span", State>` | Style or replace the indicator's `<span>` |
|
|
703
|
+
| `keepIndicatorMounted` | `boolean` | Keeps the indicator in the DOM when unchecked, e.g. to animate it out |
|
|
704
|
+
| `closeOnClick` | `boolean` | Closes the menu when clicked. Default `false` |
|
|
705
|
+
|
|
706
|
+
`BaseContextMenu` props:
|
|
707
|
+
|
|
708
|
+
| Prop | Type | Default | Description |
|
|
709
|
+
|------|------|---------|-------------|
|
|
710
|
+
| `open` / `defaultOpen` | `boolean` | `false` | Controlled / initial open state |
|
|
711
|
+
| `onOpenChange` | `(open, event) => void` | | Called with the new state and the DOM event that changed it (`undefined` when changed from code) |
|
|
712
|
+
| `onOpenChangeComplete` | `(open) => void` | | Called after the open or close transition ends |
|
|
713
|
+
| `disabled` | `boolean` | `false` | Doesn't open, so the browser's own context menu shows |
|
|
714
|
+
| `loopFocus` | `boolean` | `true` | Arrow keys wrap from the last item to the first |
|
|
715
|
+
| `highlightItemOnHover` | `boolean` | `true` | Highlights items under the pointer. Turn it off to style `:hover` apart from `data-highlighted` |
|
|
716
|
+
| `orientation` | `"vertical" \| "horizontal"` | `"vertical"` | Which arrow keys move between items |
|
|
717
|
+
|
|
718
|
+
`BaseContextMenu.Popup` props:
|
|
719
|
+
|
|
720
|
+
| Prop | Type | Default | Description |
|
|
721
|
+
|------|------|---------|-------------|
|
|
722
|
+
| `side` / `align` | `MenuSide` / `MenuAlign` | at the pointer | Where the popup sits against its anchor (`"top"`, `"bottom"`, `"left"`, `"right"`, `"inline-start"`, `"inline-end"` / `"start"`, `"center"`, `"end"`). Submenus default to `"inline-end"` / `"start"` |
|
|
723
|
+
| `sideOffset` / `alignOffset` | `number` | | Offsets from the anchor, in pixels |
|
|
724
|
+
| `collisionPadding` | `number` | `5` | Space kept from the viewport edges |
|
|
725
|
+
| `sticky` | `boolean` | `false` | Stays in view while the anchor scrolls away |
|
|
726
|
+
| `positionMethod` | `"absolute" \| "fixed"` | `"absolute"` | Use `"fixed"` when the anchor is inside a fixed container |
|
|
727
|
+
| `positionerClassName` / `renderPositioner` | `string` / `RenderProp<"div", MenuPositionerState>` | | Style or replace the positioner, the `<div>` around the popup that places it (`z-50`) |
|
|
728
|
+
| `finalFocus` | `MenuFocusTarget` | `true` | The element focused on close: `true` (default), `false` (don't move focus), a ref, or a function of the interaction type |
|
|
729
|
+
| `container` | `HTMLElement \| ShadowRoot \| RefObject \| null` | `<body>` | Where the popup is portaled to |
|
|
730
|
+
| `keepMounted` | `boolean` | `false` | Keeps the popup in the DOM while closed |
|
|
731
|
+
| `backdrop` | `boolean` | `false` | Renders a transparent full-screen backdrop (`fixed inset-0`) behind the popup |
|
|
732
|
+
| `renderBackdrop` | `RenderProp<"div", MenuBackdropState>` | | Style or replace the backdrop. A `className` on the element wins over the kit's conflicting classes |
|
|
733
|
+
| `render` | `RenderProp<"div", MenuPopupState>` | | The state is `{ open, side, align, nested }` |
|
|
734
|
+
|
|
735
|
+
Data attributes: the popup has `data-open` / `data-closed`, `data-side`, `data-align`, `data-nested` (in a submenu) and `data-starting-style` / `data-ending-style` during transitions. Items have `data-highlighted` and `data-disabled`; checkbox and radio items and their indicators also have `data-checked` / `data-unchecked`.
|
|
736
|
+
|
|
737
|
+
**Submenus:** put a `Submenu` among the items, with a `SubmenuTrigger` and another `Popup` inside:
|
|
738
|
+
|
|
739
|
+
```tsx
|
|
740
|
+
<BaseContextMenu.Submenu>
|
|
741
|
+
<BaseContextMenu.SubmenuTrigger icon={<ChevronRight />}>Share</BaseContextMenu.SubmenuTrigger>
|
|
742
|
+
<BaseContextMenu.Popup className="rounded-md border bg-white shadow-lg">
|
|
743
|
+
<BaseContextMenu.Item>Email</BaseContextMenu.Item>
|
|
744
|
+
</BaseContextMenu.Popup>
|
|
745
|
+
</BaseContextMenu.Submenu>
|
|
746
|
+
```
|
|
747
|
+
|
|
655
748
|
### `@omer-x/tailwind-ui-kit/disclosure`
|
|
656
749
|
|
|
657
750
|
#### `BaseAccordion`
|
|
@@ -824,6 +917,67 @@ Every part takes `className` and `render`.
|
|
|
824
917
|
|
|
825
918
|
Data attributes: the image has `data-starting-style` / `data-ending-style` while it appears and disappears, so it can fade in (`transition-opacity data-starting-style:opacity-0`). With `keepMounted`, it has `data-loading` while loading and `data-error` when it failed.
|
|
826
919
|
|
|
920
|
+
#### `BaseMeter`
|
|
921
|
+
|
|
922
|
+
A Base UI [`Meter`](https://base-ui.com/react/components/meter): a graphical display of a numeric value within a known range, like disk usage or battery level. It renders a `<div role="meter">` with the label and the value on top and the track below (`flex flex-wrap`). For a task's completion, use a progress bar instead.
|
|
923
|
+
|
|
924
|
+
```tsx
|
|
925
|
+
import { BaseMeter } from "@omer-x/tailwind-ui-kit/display";
|
|
926
|
+
|
|
927
|
+
<BaseMeter
|
|
928
|
+
value={usedGb}
|
|
929
|
+
max={quotaGb}
|
|
930
|
+
label="Storage used"
|
|
931
|
+
showValue
|
|
932
|
+
trackClassName="bg-neutral-200"
|
|
933
|
+
indicatorClassName="bg-blue-600"
|
|
934
|
+
/>
|
|
935
|
+
```
|
|
936
|
+
|
|
937
|
+
| Prop | Type | Default | Description |
|
|
938
|
+
|------|------|---------|-------------|
|
|
939
|
+
| `value` | `number` | | The current value, clamped to `min`…`max` |
|
|
940
|
+
| `min` / `max` | `number` | `0` / `100` | The range |
|
|
941
|
+
| `format` | `Intl.NumberFormatOptions` | | How the value is formatted. Without it, it is shown as a percentage of the range |
|
|
942
|
+
| `locale` | `Intl.LocalesArgument` | runtime locale | The locale used to format the value |
|
|
943
|
+
| `getAriaValueText` | `(formattedValue, value) => string` | | What screen readers announce for the value |
|
|
944
|
+
| `label` | `ReactNode` | | The visible name. It labels the meter. Without it, nothing is rendered for it: use `aria-label` |
|
|
945
|
+
| `labelClassName` | `string` | | Classes for the label `<span>` (default `grow`) |
|
|
946
|
+
| `renderLabel` | `RenderProp<"span", MeterState>` | | Render another element for the label |
|
|
947
|
+
| `showValue` | `boolean \| (formattedValue, value) => ReactNode` | `false` | Shows the value as text next to the label. A function shows something else, e.g. `` (f) => `${f} of 5 kWh` `` |
|
|
948
|
+
| `valueClassName` | `string` | | Classes for the value `<span>` (default `ms-auto tabular-nums`). It is `aria-hidden`: screen readers read the meter's value |
|
|
949
|
+
| `renderValue` | `RenderProp<"span", MeterState>` | | Render another element for the value |
|
|
950
|
+
| `size` | `"lg" \| "md" \| "sm" \| "xs"` | `"md"` | The track's height: `h-3` / `h-2` / `h-1.5` / `h-1` |
|
|
951
|
+
| `trackClassName` | `string` | | Classes for the track `<div>` (default `relative block w-full overflow-hidden rounded-full`) |
|
|
952
|
+
| `renderTrack` | `RenderProp<"div", MeterState>` | | Render another element for the track |
|
|
953
|
+
| `indicatorClassName` | `string` | | Classes for the indicator `<div>`, the filled part. Its width is set inline and transitions (`transition-[width] duration-500`) |
|
|
954
|
+
| `renderIndicator` | `RenderProp<"div", MeterState>` | | Render another element for the indicator |
|
|
955
|
+
| `children` | `ReactNode` | | Lays out the parts yourself (see below). The built-in label, value and track aren't rendered then |
|
|
956
|
+
| `className` | `string` | | Classes for the root `<div>` |
|
|
957
|
+
| `render` | `RenderProp<"div", MeterState>` | | Render another element for the root |
|
|
958
|
+
| …rest | | | `<div>` props |
|
|
959
|
+
|
|
960
|
+
To place the parts yourself, e.g. the value inside the track, pass them as children. Dot notation only works in client components.
|
|
961
|
+
|
|
962
|
+
```tsx
|
|
963
|
+
<BaseMeter value={24}>
|
|
964
|
+
<BaseMeter.Label className="sr-only">Upload quota</BaseMeter.Label>
|
|
965
|
+
<BaseMeter.Track className="h-5 bg-neutral-200">
|
|
966
|
+
<BaseMeter.Indicator className="bg-blue-600" />
|
|
967
|
+
<BaseMeter.Value className="absolute inset-0 flex items-center justify-center" />
|
|
968
|
+
</BaseMeter.Track>
|
|
969
|
+
</BaseMeter>
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
| Part | Renders | Props |
|
|
973
|
+
|------|---------|-------|
|
|
974
|
+
| `BaseMeter.Label` | `<span>` | `className`, `render` |
|
|
975
|
+
| `BaseMeter.Track` | `<div>` | `size`, `className`, `render` |
|
|
976
|
+
| `BaseMeter.Indicator` | `<div>` | `className`, `render` |
|
|
977
|
+
| `BaseMeter.Value` | `<span>` | `className`, `render`, `children?: (formattedValue, value) => ReactNode` |
|
|
978
|
+
|
|
979
|
+
Render functions get `MeterState`, which is empty for now. The meter sets no data attributes: style value ranges in your wrapper (e.g. pick the indicator color from `value`).
|
|
980
|
+
|
|
827
981
|
### `@omer-x/tailwind-ui-kit/layout`
|
|
828
982
|
|
|
829
983
|
#### `Container`
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { BarSize } from "./barStyles.js";
|
|
2
|
+
import { RenderProp } from "../../utils/render.js";
|
|
3
|
+
import { ComponentProps, ReactNode } from "react";
|
|
4
|
+
/** The meter has no state of its own yet. Render functions get an empty object. */
|
|
5
|
+
export type MeterState = object;
|
|
6
|
+
type BaseMeterProps = Omit<ComponentProps<"div">, "children"> & {
|
|
7
|
+
render?: RenderProp<"div", MeterState>;
|
|
8
|
+
/** The current value. It is clamped to `min`…`max`. */
|
|
9
|
+
value: number;
|
|
10
|
+
/** @default 0 */
|
|
11
|
+
min?: number;
|
|
12
|
+
/** @default 100 */
|
|
13
|
+
max?: number;
|
|
14
|
+
/** How the value is formatted. Without it, the value is shown as a percentage of the range. */
|
|
15
|
+
format?: Intl.NumberFormatOptions;
|
|
16
|
+
/** The locale used to format the value. Defaults to the user's runtime locale. */
|
|
17
|
+
locale?: Intl.LocalesArgument;
|
|
18
|
+
/** Text that screen readers announce for the value, built from the formatted value. */
|
|
19
|
+
getAriaValueText?: (formattedValue: string, value: number) => string;
|
|
20
|
+
/** The meter's visible name. It labels the meter for assistive technology. */
|
|
21
|
+
label?: ReactNode;
|
|
22
|
+
/** Classes for the label `<span>`. */
|
|
23
|
+
labelClassName?: string;
|
|
24
|
+
renderLabel?: RenderProp<"span", MeterState>;
|
|
25
|
+
/** Shows the value as text next to the label. A function shows something else, e.g. `"3 of 10 GB"`. */
|
|
26
|
+
showValue?: boolean | ((formattedValue: string, value: number) => ReactNode);
|
|
27
|
+
/** Classes for the value `<span>`. */
|
|
28
|
+
valueClassName?: string;
|
|
29
|
+
renderValue?: RenderProp<"span", MeterState>;
|
|
30
|
+
/** The track's height. */
|
|
31
|
+
size?: BarSize;
|
|
32
|
+
/** Classes for the track `<div>`. */
|
|
33
|
+
trackClassName?: string;
|
|
34
|
+
renderTrack?: RenderProp<"div", MeterState>;
|
|
35
|
+
/** Classes for the indicator `<div>`, the filled part of the track. */
|
|
36
|
+
indicatorClassName?: string;
|
|
37
|
+
renderIndicator?: RenderProp<"div", MeterState>;
|
|
38
|
+
/**
|
|
39
|
+
* Lays out the meter's parts yourself (`BaseMeter.Label`, `.Track`, `.Indicator`, `.Value`).
|
|
40
|
+
* When given, the built-in label, value and track aren't rendered.
|
|
41
|
+
*/
|
|
42
|
+
children?: ReactNode;
|
|
43
|
+
};
|
|
44
|
+
declare const _default: (({ label, labelClassName, renderLabel, showValue, valueClassName, renderValue, size, trackClassName, renderTrack, indicatorClassName, renderIndicator, className, children, ...otherProps }: BaseMeterProps) => import("react").JSX.Element) & {
|
|
45
|
+
Label: (props: import("react").ClassAttributes<HTMLSpanElement> & import("react").HTMLAttributes<HTMLSpanElement> & {
|
|
46
|
+
render?: RenderProp<"span", MeterState>;
|
|
47
|
+
}) => import("react").JSX.Element;
|
|
48
|
+
Track: ({ size, className, ...otherProps }: import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
49
|
+
render?: RenderProp<"div", MeterState>;
|
|
50
|
+
size?: BarSize;
|
|
51
|
+
}) => import("react").JSX.Element;
|
|
52
|
+
Indicator: ({ className, ...otherProps }: import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
53
|
+
render?: RenderProp<"div", MeterState>;
|
|
54
|
+
}) => import("react").JSX.Element;
|
|
55
|
+
Value: (props: Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "children"> & {
|
|
56
|
+
render?: RenderProp<"span", MeterState>;
|
|
57
|
+
children?: (formattedValue: string, value: number) => ReactNode;
|
|
58
|
+
}) => import("react").JSX.Element;
|
|
59
|
+
};
|
|
60
|
+
export { _default as default };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Meter } from "@base-ui/react/meter";
|
|
3
|
+
import { cn } from "cn";
|
|
4
|
+
import BaseMeterIndicator from "./BaseMeterIndicator.js";
|
|
5
|
+
import BaseMeterLabel from "./BaseMeterLabel.js";
|
|
6
|
+
import BaseMeterTrack from "./BaseMeterTrack.js";
|
|
7
|
+
import BaseMeterValue from "./BaseMeterValue.js";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
// src/components/display/BaseMeter.tsx
|
|
10
|
+
/**
|
|
11
|
+
* A graphical display of a numeric value within a known range, like disk usage or battery level.
|
|
12
|
+
* Renders a `<div>` with `role="meter"`: the label and the value on top, the track below.
|
|
13
|
+
*/
|
|
14
|
+
const BaseMeter = ({ label, labelClassName, renderLabel, showValue = false, valueClassName, renderValue, size = "md", trackClassName, renderTrack, indicatorClassName, renderIndicator, className, children, ...otherProps }) => /* @__PURE__ */ jsx(Meter.Root, {
|
|
15
|
+
...otherProps,
|
|
16
|
+
className: cn("flex flex-wrap items-center gap-x-2 gap-y-1", className),
|
|
17
|
+
children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
18
|
+
typeof label !== "undefined" && /* @__PURE__ */ jsx(BaseMeterLabel, {
|
|
19
|
+
render: renderLabel,
|
|
20
|
+
className: cn("grow", labelClassName),
|
|
21
|
+
children: label
|
|
22
|
+
}),
|
|
23
|
+
showValue !== false && /* @__PURE__ */ jsx(BaseMeterValue, {
|
|
24
|
+
render: renderValue,
|
|
25
|
+
className: cn("ms-auto", "tabular-nums", valueClassName),
|
|
26
|
+
children: typeof showValue === "function" ? showValue : void 0
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ jsx(BaseMeterTrack, {
|
|
29
|
+
size,
|
|
30
|
+
render: renderTrack,
|
|
31
|
+
className: trackClassName,
|
|
32
|
+
children: /* @__PURE__ */ jsx(BaseMeterIndicator, {
|
|
33
|
+
render: renderIndicator,
|
|
34
|
+
className: indicatorClassName
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
] })
|
|
38
|
+
});
|
|
39
|
+
var BaseMeter_default = Object.assign(BaseMeter, {
|
|
40
|
+
Label: BaseMeterLabel,
|
|
41
|
+
Track: BaseMeterTrack,
|
|
42
|
+
Indicator: BaseMeterIndicator,
|
|
43
|
+
Value: BaseMeterValue
|
|
44
|
+
});
|
|
45
|
+
export { BaseMeter_default as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MeterState } from "./BaseMeter.js";
|
|
2
|
+
import { RenderProp } from "../../utils/render.js";
|
|
3
|
+
import { ComponentProps } from "react";
|
|
4
|
+
type BaseMeterIndicatorProps = ComponentProps<"div"> & {
|
|
5
|
+
render?: RenderProp<"div", MeterState>;
|
|
6
|
+
};
|
|
7
|
+
/** The filled part of the track. Its width follows the value. Renders a `<div>`. */
|
|
8
|
+
declare const BaseMeterIndicator: ({ className, ...otherProps }: BaseMeterIndicatorProps) => import("react").JSX.Element;
|
|
9
|
+
export { BaseMeterIndicator as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Meter } from "@base-ui/react/meter";
|
|
3
|
+
import { cn } from "cn";
|
|
4
|
+
import { barIndicatorClassName } from "./barStyles.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
// src/components/display/BaseMeterIndicator.tsx
|
|
7
|
+
/** The filled part of the track. Its width follows the value. Renders a `<div>`. */
|
|
8
|
+
const BaseMeterIndicator = ({ className, ...otherProps }) => /* @__PURE__ */ jsx(Meter.Indicator, {
|
|
9
|
+
...otherProps,
|
|
10
|
+
className: cn(barIndicatorClassName, className)
|
|
11
|
+
});
|
|
12
|
+
export { BaseMeterIndicator as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MeterState } from "./BaseMeter.js";
|
|
2
|
+
import { RenderProp } from "../../utils/render.js";
|
|
3
|
+
import { ComponentProps } from "react";
|
|
4
|
+
type BaseMeterLabelProps = ComponentProps<"span"> & {
|
|
5
|
+
render?: RenderProp<"span", MeterState>;
|
|
6
|
+
};
|
|
7
|
+
/** The meter's visible name. It labels the meter for assistive technology. Renders a `<span>`. */
|
|
8
|
+
declare const BaseMeterLabel: (props: BaseMeterLabelProps) => import("react").JSX.Element;
|
|
9
|
+
export { BaseMeterLabel as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Meter } from "@base-ui/react/meter";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/display/BaseMeterLabel.tsx
|
|
5
|
+
/** The meter's visible name. It labels the meter for assistive technology. Renders a `<span>`. */
|
|
6
|
+
const BaseMeterLabel = (props) => /* @__PURE__ */ jsx(Meter.Label, { ...props });
|
|
7
|
+
export { BaseMeterLabel as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BarSize } from "./barStyles.js";
|
|
2
|
+
import { MeterState } from "./BaseMeter.js";
|
|
3
|
+
import { RenderProp } from "../../utils/render.js";
|
|
4
|
+
import { ComponentProps } from "react";
|
|
5
|
+
type BaseMeterTrackProps = ComponentProps<"div"> & {
|
|
6
|
+
render?: RenderProp<"div", MeterState>;
|
|
7
|
+
/** The track's height. */
|
|
8
|
+
size?: BarSize;
|
|
9
|
+
};
|
|
10
|
+
/** The whole range of the meter. Put a `BaseMeter.Indicator` inside it. Renders a `<div>`. */
|
|
11
|
+
declare const BaseMeterTrack: ({ size, className, ...otherProps }: BaseMeterTrackProps) => import("react").JSX.Element;
|
|
12
|
+
export { BaseMeterTrack as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Meter } from "@base-ui/react/meter";
|
|
3
|
+
import { cn } from "cn";
|
|
4
|
+
import { barTrackClassName } from "./barStyles.js";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
// src/components/display/BaseMeterTrack.tsx
|
|
7
|
+
/** The whole range of the meter. Put a `BaseMeter.Indicator` inside it. Renders a `<div>`. */
|
|
8
|
+
const BaseMeterTrack = ({ size = "md", className, ...otherProps }) => /* @__PURE__ */ jsx(Meter.Track, {
|
|
9
|
+
...otherProps,
|
|
10
|
+
className: cn(barTrackClassName(size), className)
|
|
11
|
+
});
|
|
12
|
+
export { BaseMeterTrack as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MeterState } from "./BaseMeter.js";
|
|
2
|
+
import { RenderProp } from "../../utils/render.js";
|
|
3
|
+
import { ComponentProps, ReactNode } from "react";
|
|
4
|
+
type BaseMeterValueProps = Omit<ComponentProps<"span">, "children"> & {
|
|
5
|
+
render?: RenderProp<"span", MeterState>;
|
|
6
|
+
/** Shows something else than the formatted value, e.g. `(formatted, value) => `${value} GB``. */
|
|
7
|
+
children?: (formattedValue: string, value: number) => ReactNode;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* The value as text, formatted with the meter's `format` and `locale` (a percentage by default).
|
|
11
|
+
* Hidden from assistive technology, which reads the meter's own value. Renders a `<span>`.
|
|
12
|
+
*/
|
|
13
|
+
declare const BaseMeterValue: (props: BaseMeterValueProps) => import("react").JSX.Element;
|
|
14
|
+
export { BaseMeterValue as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Meter } from "@base-ui/react/meter";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/display/BaseMeterValue.tsx
|
|
5
|
+
/**
|
|
6
|
+
* The value as text, formatted with the meter's `format` and `locale` (a percentage by default).
|
|
7
|
+
* Hidden from assistive technology, which reads the meter's own value. Renders a `<span>`.
|
|
8
|
+
*/
|
|
9
|
+
const BaseMeterValue = (props) => /* @__PURE__ */ jsx(Meter.Value, { ...props });
|
|
10
|
+
export { BaseMeterValue as default };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type BarSize = "lg" | "md" | "sm" | "xs";
|
|
2
|
+
/** Classes for the track of a horizontal bar (Meter, Progress): the full range. */
|
|
3
|
+
export declare function barTrackClassName(size: BarSize): string;
|
|
4
|
+
/** Classes for the filled part of a bar. Base UI sets its width (and height) inline. */
|
|
5
|
+
export declare const barIndicatorClassName: string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { cn } from "cn";
|
|
2
|
+
// src/components/display/barStyles.ts
|
|
3
|
+
/** Classes for the track of a horizontal bar (Meter, Progress): the full range. */
|
|
4
|
+
function barTrackClassName(size) {
|
|
5
|
+
return cn({
|
|
6
|
+
"h-3": size === "lg",
|
|
7
|
+
"h-2": size === "md",
|
|
8
|
+
"h-1.5": size === "sm",
|
|
9
|
+
"h-1": size === "xs"
|
|
10
|
+
}, [
|
|
11
|
+
"relative",
|
|
12
|
+
"block",
|
|
13
|
+
"w-full",
|
|
14
|
+
"overflow-hidden",
|
|
15
|
+
"rounded-full"
|
|
16
|
+
]);
|
|
17
|
+
}
|
|
18
|
+
/** Classes for the filled part of a bar. Base UI sets its width (and height) inline. */
|
|
19
|
+
const barIndicatorClassName = cn("block", "h-full", "transition-[width]", "duration-500", "ease-out", "motion-reduce:transition-none");
|
|
20
|
+
export { barIndicatorClassName, barTrackClassName };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import _default, { AvatarImageLoadingStatus, AvatarState } from "./BaseAvatar.js";
|
|
2
2
|
import { AvatarImageState } from "./BaseAvatarImage.js";
|
|
3
|
-
|
|
3
|
+
import _default$1, { MeterState } from "./BaseMeter.js";
|
|
4
|
+
export { type AvatarImageLoadingStatus, type AvatarImageState, type AvatarState, _default as BaseAvatar, _default$1 as BaseMeter, type MeterState };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { RenderProp } from "../../utils/render.js";
|
|
2
|
+
import { ContextMenuTriggerState } from "./BaseContextMenuTrigger.js";
|
|
3
|
+
import "../../utils/index.js";
|
|
4
|
+
import { MenuAlign, MenuBackdropState, MenuFocusTarget, MenuPopupState, MenuPositionerState, MenuSide } from "./BaseMenuPopup.js";
|
|
5
|
+
import { MenuArrowState } from "./BaseMenuArrow.js";
|
|
6
|
+
import { MenuItemState } from "./BaseMenuItem.js";
|
|
7
|
+
import { MenuLinkItemState } from "./BaseMenuLinkItem.js";
|
|
8
|
+
import { MenuSeparatorState } from "./BaseMenuSeparator.js";
|
|
9
|
+
import { MenuRadioGroupState } from "./BaseMenuRadioGroup.js";
|
|
10
|
+
import { MenuRadioItemState } from "./BaseMenuRadioItem.js";
|
|
11
|
+
import { MenuCheckboxItemState } from "./BaseMenuCheckboxItem.js";
|
|
12
|
+
import { MenuSubmenuTriggerState } from "./BaseMenuSubmenuTrigger.js";
|
|
13
|
+
import { ReactNode } from "react";
|
|
14
|
+
type BaseContextMenuProps = {
|
|
15
|
+
open?: boolean;
|
|
16
|
+
defaultOpen?: boolean;
|
|
17
|
+
/** Called with the new state and the DOM event that changed it (none when it was changed from code). */
|
|
18
|
+
onOpenChange?: (open: boolean, event: Event | undefined) => void;
|
|
19
|
+
/** Called after the open or close transition ends. */
|
|
20
|
+
onOpenChangeComplete?: (open: boolean) => void;
|
|
21
|
+
/** Keeps the menu from opening, so the browser's own context menu shows. */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Moves focus from the last item back to the first with the arrow keys, and the other way around.
|
|
25
|
+
* @default true
|
|
26
|
+
*/
|
|
27
|
+
loopFocus?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Highlights items under the pointer. Turn it off to style `:hover` apart from `data-highlighted`.
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
highlightItemOnHover?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* The arrow keys that move between items: up / down for `"vertical"`, left / right for `"horizontal"`.
|
|
35
|
+
* @default "vertical"
|
|
36
|
+
*/
|
|
37
|
+
orientation?: "vertical" | "horizontal";
|
|
38
|
+
/** A `Trigger` and a `Popup`. */
|
|
39
|
+
children?: ReactNode;
|
|
40
|
+
};
|
|
41
|
+
declare const _default: (({ onOpenChange, ...otherProps }: BaseContextMenuProps) => import("react").JSX.Element) & {
|
|
42
|
+
Trigger: (props: import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
43
|
+
render?: RenderProp<"div", ContextMenuTriggerState>;
|
|
44
|
+
}) => import("react").JSX.Element;
|
|
45
|
+
Popup: ({ side, align, sideOffset, alignOffset, collisionPadding, sticky, positionMethod, positionerClassName, renderPositioner, container, keepMounted, backdrop, renderBackdrop, className, ...otherProps }: import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
46
|
+
render?: RenderProp<"div", MenuPopupState>;
|
|
47
|
+
side?: MenuSide;
|
|
48
|
+
align?: MenuAlign;
|
|
49
|
+
sideOffset?: number;
|
|
50
|
+
alignOffset?: number;
|
|
51
|
+
collisionPadding?: number;
|
|
52
|
+
sticky?: boolean;
|
|
53
|
+
positionMethod?: "absolute" | "fixed";
|
|
54
|
+
positionerClassName?: string;
|
|
55
|
+
renderPositioner?: RenderProp<"div", MenuPositionerState>;
|
|
56
|
+
finalFocus?: MenuFocusTarget;
|
|
57
|
+
container?: HTMLElement | ShadowRoot | import("react").RefObject<HTMLElement | ShadowRoot | null> | null;
|
|
58
|
+
keepMounted?: boolean;
|
|
59
|
+
backdrop?: boolean;
|
|
60
|
+
renderBackdrop?: RenderProp<"div", MenuBackdropState>;
|
|
61
|
+
}) => import("react").JSX.Element;
|
|
62
|
+
Arrow: (props: import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
63
|
+
render?: RenderProp<"div", MenuArrowState>;
|
|
64
|
+
}) => import("react").JSX.Element;
|
|
65
|
+
Item: ({ className, ...otherProps }: import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
66
|
+
render?: RenderProp<"div", MenuItemState>;
|
|
67
|
+
disabled?: boolean;
|
|
68
|
+
label?: string;
|
|
69
|
+
closeOnClick?: boolean;
|
|
70
|
+
nativeButton?: boolean;
|
|
71
|
+
}) => import("react").JSX.Element;
|
|
72
|
+
LinkItem: ({ className, ...otherProps }: import("react").ClassAttributes<HTMLAnchorElement> & import("react").AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
73
|
+
render?: RenderProp<"a", MenuLinkItemState>;
|
|
74
|
+
label?: string;
|
|
75
|
+
closeOnClick?: boolean;
|
|
76
|
+
}) => import("react").JSX.Element;
|
|
77
|
+
Separator: ({ className, ...otherProps }: import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
78
|
+
render?: RenderProp<"div", MenuSeparatorState>;
|
|
79
|
+
}) => import("react").JSX.Element;
|
|
80
|
+
Group: (props: import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
81
|
+
render?: RenderProp<"div">;
|
|
82
|
+
}) => import("react").JSX.Element;
|
|
83
|
+
GroupLabel: ({ className, ...otherProps }: import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
84
|
+
render?: RenderProp<"div">;
|
|
85
|
+
}) => import("react").JSX.Element;
|
|
86
|
+
RadioGroup: <Value>({ onValueChange, ...otherProps }: Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "defaultValue"> & {
|
|
87
|
+
render?: RenderProp<"div", MenuRadioGroupState>;
|
|
88
|
+
value?: Value | undefined;
|
|
89
|
+
defaultValue?: Value | undefined;
|
|
90
|
+
onValueChange?: ((value: Value, event: Event) => void) | undefined;
|
|
91
|
+
disabled?: boolean;
|
|
92
|
+
}) => import("react").JSX.Element;
|
|
93
|
+
RadioItem: <Value>({ indicator, renderIndicator, keepIndicatorMounted, className, children, ...otherProps }: import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
94
|
+
value: Value;
|
|
95
|
+
render?: RenderProp<"div", MenuRadioItemState>;
|
|
96
|
+
indicator?: ReactNode;
|
|
97
|
+
renderIndicator?: RenderProp<"span", MenuRadioItemState>;
|
|
98
|
+
keepIndicatorMounted?: boolean;
|
|
99
|
+
disabled?: boolean;
|
|
100
|
+
label?: string;
|
|
101
|
+
closeOnClick?: boolean;
|
|
102
|
+
nativeButton?: boolean;
|
|
103
|
+
}) => import("react").JSX.Element;
|
|
104
|
+
CheckboxItem: ({ indicator, renderIndicator, keepIndicatorMounted, onCheckedChange, className, children, ...otherProps }: Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "defaultChecked"> & {
|
|
105
|
+
render?: RenderProp<"div", MenuCheckboxItemState>;
|
|
106
|
+
checked?: boolean;
|
|
107
|
+
defaultChecked?: boolean;
|
|
108
|
+
onCheckedChange?: (checked: boolean, event: Event) => void;
|
|
109
|
+
indicator?: ReactNode;
|
|
110
|
+
renderIndicator?: RenderProp<"span", MenuCheckboxItemState>;
|
|
111
|
+
keepIndicatorMounted?: boolean;
|
|
112
|
+
disabled?: boolean;
|
|
113
|
+
label?: string;
|
|
114
|
+
closeOnClick?: boolean;
|
|
115
|
+
nativeButton?: boolean;
|
|
116
|
+
}) => import("react").JSX.Element;
|
|
117
|
+
Submenu: ({ onOpenChange, ...otherProps }: {
|
|
118
|
+
open?: boolean;
|
|
119
|
+
defaultOpen?: boolean;
|
|
120
|
+
onOpenChange?: (open: boolean, event: Event | undefined) => void;
|
|
121
|
+
onOpenChangeComplete?: (open: boolean) => void;
|
|
122
|
+
disabled?: boolean;
|
|
123
|
+
loopFocus?: boolean;
|
|
124
|
+
highlightItemOnHover?: boolean;
|
|
125
|
+
closeParentOnEsc?: boolean;
|
|
126
|
+
children?: ReactNode;
|
|
127
|
+
}) => import("react").JSX.Element;
|
|
128
|
+
SubmenuTrigger: ({ icon, iconClassName, className, children, ...otherProps }: import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
|
|
129
|
+
render?: RenderProp<"div", MenuSubmenuTriggerState>;
|
|
130
|
+
icon?: ReactNode;
|
|
131
|
+
iconClassName?: string;
|
|
132
|
+
disabled?: boolean;
|
|
133
|
+
label?: string;
|
|
134
|
+
openOnHover?: boolean;
|
|
135
|
+
delay?: number;
|
|
136
|
+
closeDelay?: number;
|
|
137
|
+
nativeButton?: boolean;
|
|
138
|
+
}) => import("react").JSX.Element;
|
|
139
|
+
};
|
|
140
|
+
export { _default as default };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ContextMenu } from "@base-ui/react/context-menu";
|
|
3
|
+
import BaseContextMenuTrigger from "./BaseContextMenuTrigger.js";
|
|
4
|
+
import BaseMenuArrow from "./BaseMenuArrow.js";
|
|
5
|
+
import BaseMenuCheckboxItem from "./BaseMenuCheckboxItem.js";
|
|
6
|
+
import BaseMenuGroup from "./BaseMenuGroup.js";
|
|
7
|
+
import BaseMenuGroupLabel from "./BaseMenuGroupLabel.js";
|
|
8
|
+
import BaseMenuItem from "./BaseMenuItem.js";
|
|
9
|
+
import BaseMenuLinkItem from "./BaseMenuLinkItem.js";
|
|
10
|
+
import BaseMenuPopup from "./BaseMenuPopup.js";
|
|
11
|
+
import BaseMenuRadioGroup from "./BaseMenuRadioGroup.js";
|
|
12
|
+
import BaseMenuRadioItem from "./BaseMenuRadioItem.js";
|
|
13
|
+
import BaseMenuSeparator from "./BaseMenuSeparator.js";
|
|
14
|
+
import BaseMenuSubmenu from "./BaseMenuSubmenu.js";
|
|
15
|
+
import BaseMenuSubmenuTrigger from "./BaseMenuSubmenuTrigger.js";
|
|
16
|
+
import { jsx } from "react/jsx-runtime";
|
|
17
|
+
// src/components/menu/BaseContextMenu.tsx
|
|
18
|
+
/** Groups the parts of a context menu, a menu that opens at the pointer on right click or long press. Renders no element. */
|
|
19
|
+
const BaseContextMenu = ({ onOpenChange, ...otherProps }) => /* @__PURE__ */ jsx(ContextMenu.Root, {
|
|
20
|
+
...otherProps,
|
|
21
|
+
onOpenChange: onOpenChange && ((open, details) => onOpenChange(open, details.event))
|
|
22
|
+
});
|
|
23
|
+
var BaseContextMenu_default = Object.assign(BaseContextMenu, {
|
|
24
|
+
Trigger: BaseContextMenuTrigger,
|
|
25
|
+
Popup: BaseMenuPopup,
|
|
26
|
+
Arrow: BaseMenuArrow,
|
|
27
|
+
Item: BaseMenuItem,
|
|
28
|
+
LinkItem: BaseMenuLinkItem,
|
|
29
|
+
Separator: BaseMenuSeparator,
|
|
30
|
+
Group: BaseMenuGroup,
|
|
31
|
+
GroupLabel: BaseMenuGroupLabel,
|
|
32
|
+
RadioGroup: BaseMenuRadioGroup,
|
|
33
|
+
RadioItem: BaseMenuRadioItem,
|
|
34
|
+
CheckboxItem: BaseMenuCheckboxItem,
|
|
35
|
+
Submenu: BaseMenuSubmenu,
|
|
36
|
+
SubmenuTrigger: BaseMenuSubmenuTrigger
|
|
37
|
+
});
|
|
38
|
+
export { BaseContextMenu_default as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RenderProp } from "../../utils/render.js";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
export type ContextMenuTriggerState = {
|
|
4
|
+
/** Whether the context menu is open. */
|
|
5
|
+
open: boolean;
|
|
6
|
+
};
|
|
7
|
+
type BaseContextMenuTriggerProps = ComponentProps<"div"> & {
|
|
8
|
+
render?: RenderProp<"div", ContextMenuTriggerState>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* The area that opens the context menu on right click or long press.
|
|
12
|
+
* Renders a `<div>`, with `data-popup-open` while its menu is open.
|
|
13
|
+
*/
|
|
14
|
+
declare const BaseContextMenuTrigger: (props: BaseContextMenuTriggerProps) => import("react").JSX.Element;
|
|
15
|
+
export { BaseContextMenuTrigger as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ContextMenu } from "@base-ui/react/context-menu";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/components/menu/BaseContextMenuTrigger.tsx
|
|
5
|
+
/**
|
|
6
|
+
* The area that opens the context menu on right click or long press.
|
|
7
|
+
* Renders a `<div>`, with `data-popup-open` while its menu is open.
|
|
8
|
+
*/
|
|
9
|
+
const BaseContextMenuTrigger = (props) => /* @__PURE__ */ jsx(ContextMenu.Trigger, { ...props });
|
|
10
|
+
export { BaseContextMenuTrigger as default };
|