@sesamehr/react-design-system 3.1.0-beta.2 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,31 @@
1
+ export interface DropdownMenuProps {
2
+ children?: React.ReactNode;
3
+ /** Open on first render, for a menu the caller does not otherwise control. */
4
+ defaultOpen?: boolean;
5
+ open?: boolean;
6
+ onOpenChange?: (open: boolean) => void;
7
+ /**
8
+ * Modal, which is Radix's default and the design's: while the menu is open
9
+ * the page behind it takes no pointer events and is hidden from screen
10
+ * readers, so the menu is the only thing to answer.
11
+ */
12
+ modal?: boolean;
13
+ }
14
+ /**
15
+ * A menu of actions that drops out of a control the caller owns: the trigger,
16
+ * the rows, the groups and the submenus are all composed, and this root only
17
+ * holds the open state and hands it down.
18
+ *
19
+ * It renders no element of its own — Radix's root is a provider — so there is
20
+ * nothing here to style and nothing for a `className` to land on.
21
+ *
22
+ * Both paths stay open the way Vue's `v-model:open` does, and they come free:
23
+ * Radix's own root holds the state when `open` is absent and defers to the
24
+ * caller when it is present, so there is no gating to write here. The
25
+ * components that do need it are the checkbox row and the radio group, whose
26
+ * Radix primitives are controlled-only.
27
+ */
28
+ export declare const DropdownMenu: {
29
+ ({ children, defaultOpen, open, onOpenChange, modal, }: DropdownMenuProps): import("react/jsx-runtime").JSX.Element;
30
+ displayName: string;
31
+ };
@@ -0,0 +1,20 @@
1
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
2
+ export interface DropdownMenuCheckboxItemProps extends Omit<React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem>, 'checked' | 'onCheckedChange'> {
3
+ checked?: boolean;
4
+ onCheckedChange?: (checked: boolean) => void;
5
+ dataTestid?: string;
6
+ }
7
+ /**
8
+ * A row that carries a tick. The indicator is handed to `MenuItem`
9
+ * unconditionally even though the check inside it only mounts when ticked:
10
+ * that is what keeps the 32px text column while a row is unticked, so the
11
+ * labels in a menu do not shuffle sideways as boxes are ticked.
12
+ *
13
+ * Radix's `CheckboxItem` is controlled-only — it renders whatever `checked`
14
+ * says and holds nothing — where the Vue original's `defineModel` keeps
15
+ * driving itself when the parent passes a value and does not listen. Both
16
+ * paths are kept here, gated on the **handler** rather than on the value:
17
+ * `<OxDropdownMenuCheckboxItem checked={false} />` with nobody listening is an
18
+ * ordinary row that ticks, not one pinned to false forever.
19
+ */
20
+ export declare const DropdownMenuCheckboxItem: import('react').ForwardRefExoticComponent<DropdownMenuCheckboxItemProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,10 @@
1
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
2
+ export interface DropdownMenuContentProps extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content> {
3
+ dataTestid?: string;
4
+ }
5
+ /**
6
+ * The panel the rows sit on. The fill, the border, the radius, the shadow and
7
+ * the open/close animation come from `Surface`, which `asChild` renders as
8
+ * this very element; what is left here is the part only a menu has.
9
+ */
10
+ export declare const DropdownMenuContent: import('react').ForwardRefExoticComponent<DropdownMenuContentProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,8 @@
1
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
2
+ export type DropdownMenuGroupProps = React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Group>;
3
+ /**
4
+ * A set of rows that belong together, as `role="group"`. Purely semantic — it
5
+ * draws nothing, so what separates two groups visually is still a
6
+ * `DropdownMenuSeparator`.
7
+ */
8
+ export declare const DropdownMenuGroup: import('react').ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuGroupProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,26 @@
1
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
2
+ export interface DropdownMenuItemProps extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> {
3
+ /**
4
+ * `destructive` is the red row: delete, revoke, sign out. The name is the
5
+ * system's for the variant, while the colour it reaches for is `error`.
6
+ */
7
+ variant?: 'default' | 'destructive';
8
+ /**
9
+ * The leading glyph, placed in the shared left column. A prop rather than
10
+ * part of `children`, which is what the Vue original's `#icon` slot is:
11
+ * the design puts every adornment a row can carry — the check of a checkbox
12
+ * row, the dot of a radio row, and this — in one 32px column on the left, so
13
+ * that a menu which mixes them keeps a single text column. An icon dropped
14
+ * into `children` sits in the text instead and takes that alignment away
15
+ * from every other row.
16
+ */
17
+ icon?: React.ReactNode;
18
+ dataTestid?: string;
19
+ }
20
+ /**
21
+ * A row that runs something. `asChild` hands Radix's item behaviour —
22
+ * `role="menuitem"`, `data-highlighted`, typeahead, the keyboard, closing the
23
+ * menu on select — to the shared row, which is the one thing every kind of
24
+ * menu row may share.
25
+ */
26
+ export declare const DropdownMenuItem: import('react').ForwardRefExoticComponent<DropdownMenuItemProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,20 @@
1
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
2
+ export interface DropdownMenuLabelProps extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> {
3
+ /**
4
+ * Start the heading on the text column rather than the panel edge, for a
5
+ * menu whose rows carry icons or ticks. Without it a heading sits 24px to
6
+ * the left of every label beneath it.
7
+ */
8
+ inset?: boolean;
9
+ }
10
+ /**
11
+ * The heading over a group of rows. Content is `children`, never a string
12
+ * prop: the heading is the caller's word for their own category, and taking it
13
+ * as a prop would decide for them that it can only ever be text.
14
+ *
15
+ * Not `ListboxLabel`. A select's group heading is small, grey and secondary —
16
+ * it names a category inside a list of like things. A menu's is the same size
17
+ * and weight as a row and reads as a title over a section of a panel, which is
18
+ * what the design draws.
19
+ */
20
+ export declare const DropdownMenuLabel: import('react').ForwardRefExoticComponent<DropdownMenuLabelProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,14 @@
1
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
2
+ export type DropdownMenuRadioGroupProps = React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioGroup>;
3
+ /**
4
+ * The one-of-many set. It owns the value, so the rows under it need no state
5
+ * of their own — each says what it is worth and the group says which one is
6
+ * chosen.
7
+ *
8
+ * Radix's `RadioGroup` is controlled-only, where the Vue original's
9
+ * `defineModel` keeps driving itself when the parent passes a value and does
10
+ * not listen. Both paths are kept, gated on the **handler**: a group given a
11
+ * `value` and no `onValueChange` still moves when a row is chosen, instead of
12
+ * being pinned to the value it started on.
13
+ */
14
+ export declare const DropdownMenuRadioGroup: import('react').ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuRadioGroupProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,13 @@
1
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
2
+ export interface DropdownMenuRadioItemProps extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem> {
3
+ dataTestid?: string;
4
+ }
5
+ /**
6
+ * One option of a `DropdownMenuRadioGroup`. The dot is a styled span rather
7
+ * than an icon, the same way `OxRadioButton`'s is: the design draws an 8px
8
+ * filled circle, and there is no asset to fetch for a circle.
9
+ *
10
+ * `bg-current` is what makes it follow the row — a destructive or highlighted
11
+ * row changes `color`, and the dot goes with it.
12
+ */
13
+ export declare const DropdownMenuRadioItem: import('react').ForwardRefExoticComponent<DropdownMenuRadioItemProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,13 @@
1
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
2
+ export type DropdownMenuSeparatorProps = React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator>;
3
+ /**
4
+ * The rule between two sections of a menu.
5
+ *
6
+ * `ListboxSeparator` and not a menu-specific twin: a 1px full-bleed rule in
7
+ * `border-default` is the same three declarations in both places, and the
8
+ * `-mx-1` that cancels the panel's padding assumes the same 4px here as it
9
+ * does on a select. A second file would be a second thing to keep in step for
10
+ * no difference at all — the rest of the menu row diverges from a listbox row,
11
+ * this does not.
12
+ */
13
+ export declare const DropdownMenuSeparator: import('react').ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSeparatorProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,14 @@
1
+ export type DropdownMenuShortcutProps = React.ComponentPropsWithoutRef<'span'>;
2
+ /**
3
+ * The key combination printed at the end of a row — `⇧⌘P`, `⌘S`.
4
+ *
5
+ * It goes inside the row's children, after the label, and pushes itself to the
6
+ * far end. Faded rather than a secondary colour: the design draws it at 60% of
7
+ * whatever the row is, so it follows a destructive row's red instead of
8
+ * turning grey on it.
9
+ *
10
+ * Decoration, not an announcement: the shortcut is already bound somewhere the
11
+ * screen reader user reaches by other means, and read aloud after every label
12
+ * it is noise. Hence `aria-hidden` on the element itself.
13
+ */
14
+ export declare const DropdownMenuShortcut: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & import('react').RefAttributes<HTMLSpanElement>>;
@@ -0,0 +1,14 @@
1
+ export interface DropdownMenuSubProps {
2
+ children?: React.ReactNode;
3
+ defaultOpen?: boolean;
4
+ open?: boolean;
5
+ onOpenChange?: (open: boolean) => void;
6
+ }
7
+ /**
8
+ * A submenu: pairs a `DropdownMenuSubTrigger` with a `DropdownMenuSubContent`
9
+ * and holds the open state between them. Renders no element of its own.
10
+ */
11
+ export declare const DropdownMenuSub: {
12
+ ({ children, defaultOpen, open, onOpenChange, }: DropdownMenuSubProps): import("react/jsx-runtime").JSX.Element;
13
+ displayName: string;
14
+ };
@@ -0,0 +1,9 @@
1
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
2
+ export interface DropdownMenuSubContentProps extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent> {
3
+ dataTestid?: string;
4
+ }
5
+ /**
6
+ * The panel a submenu opens onto. No `side`: a submenu's side is decided by the
7
+ * room beside its trigger, not by the caller, and Radix flips it on its own.
8
+ */
9
+ export declare const DropdownMenuSubContent: import('react').ForwardRefExoticComponent<DropdownMenuSubContentProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,17 @@
1
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
2
+ export interface DropdownMenuSubTriggerProps extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> {
3
+ /** The leading glyph, placed in the shared left column. */
4
+ icon?: React.ReactNode;
5
+ dataTestid?: string;
6
+ }
7
+ /**
8
+ * The row that opens a submenu. Reads as an ordinary row with a chevron at the
9
+ * end, and keeps its fill while the submenu is showing — `MenuItem` treats
10
+ * `data-state="open"` as the same lit row `data-highlighted` gives it, so the
11
+ * trigger does not go cold the moment the pointer travels into the panel it
12
+ * opened.
13
+ *
14
+ * The chevron goes inside the row's children rather than into `MenuItem`,
15
+ * because it is this row's alone.
16
+ */
17
+ export declare const DropdownMenuSubTrigger: import('react').ForwardRefExoticComponent<DropdownMenuSubTriggerProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,17 @@
1
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
2
+ export interface DropdownMenuTriggerProps extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Trigger> {
3
+ dataTestid?: string;
4
+ }
5
+ /**
6
+ * The control that opens the menu. Always `asChild`: the design system has no
7
+ * opinion on what opens a menu — the file draws a `Button`, an `IconButton`
8
+ * and an avatar row — so this contributes the behaviour (`aria-haspopup`,
9
+ * `aria-expanded`, `data-state`, the keyboard) and nothing else, and the
10
+ * caller's element is what renders.
11
+ *
12
+ * That makes the single child a requirement rather than a convention, and
13
+ * Radix enforces it: its `Slot` throws on a second child rather than letting
14
+ * it through the way reka does, so the Vue port's silent failure mode cannot
15
+ * happen here.
16
+ */
17
+ export declare const DropdownMenuTrigger: import('react').ForwardRefExoticComponent<DropdownMenuTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,14 @@
1
+ export { DropdownMenu, type DropdownMenuProps } from './DropdownMenu.tsx';
2
+ export { DropdownMenuTrigger, type DropdownMenuTriggerProps, } from './DropdownMenuTrigger.tsx';
3
+ export { DropdownMenuContent, type DropdownMenuContentProps, } from './DropdownMenuContent.tsx';
4
+ export { DropdownMenuGroup, type DropdownMenuGroupProps, } from './DropdownMenuGroup.tsx';
5
+ export { DropdownMenuLabel, type DropdownMenuLabelProps, } from './DropdownMenuLabel.tsx';
6
+ export { DropdownMenuItem, type DropdownMenuItemProps, } from './DropdownMenuItem.tsx';
7
+ export { DropdownMenuCheckboxItem, type DropdownMenuCheckboxItemProps, } from './DropdownMenuCheckboxItem.tsx';
8
+ export { DropdownMenuRadioGroup, type DropdownMenuRadioGroupProps, } from './DropdownMenuRadioGroup.tsx';
9
+ export { DropdownMenuRadioItem, type DropdownMenuRadioItemProps, } from './DropdownMenuRadioItem.tsx';
10
+ export { DropdownMenuSeparator, type DropdownMenuSeparatorProps, } from './DropdownMenuSeparator.tsx';
11
+ export { DropdownMenuShortcut, type DropdownMenuShortcutProps, } from './DropdownMenuShortcut.tsx';
12
+ export { DropdownMenuSub, type DropdownMenuSubProps, } from './DropdownMenuSub.tsx';
13
+ export { DropdownMenuSubTrigger, type DropdownMenuSubTriggerProps, } from './DropdownMenuSubTrigger.tsx';
14
+ export { DropdownMenuSubContent, type DropdownMenuSubContentProps, } from './DropdownMenuSubContent.tsx';
@@ -0,0 +1,34 @@
1
+ export interface MenuItemProps extends React.ComponentPropsWithoutRef<'div'> {
2
+ /**
3
+ * The left column: a tick, a radio dot, a leading glyph. Pass it — even as a
4
+ * node that renders nothing while the row is unchecked — and the row reserves
5
+ * the space; leave it out and the label starts at the row's own padding.
6
+ */
7
+ indicator?: React.ReactNode;
8
+ /**
9
+ * `destructive` colours the label red. The row's own fill is left alone: the
10
+ * design draws the error row at rest only, with no hover of its own.
11
+ */
12
+ variant?: 'default' | 'destructive';
13
+ }
14
+ /**
15
+ * One row of a menu: `DropdownMenu`'s item, its checkbox and radio items, and
16
+ * its sub-trigger. Port of `core/src/internal/Menu/MenuItem`.
17
+ *
18
+ * Not `ListboxItem`, and the difference is structural rather than a matter of
19
+ * sizing. A listbox row puts its check mark on the *right* and is padded for
20
+ * it there; every adornment a menu row can carry sits on the *left*, because a
21
+ * menu mixes plain rows with checkable ones and they have to share one text
22
+ * column. That is not reachable through `ListboxItem`'s handoff properties, and
23
+ * the note in that file says what to do when a sixth thing has to differ.
24
+ *
25
+ * Whether the row reserves the left column is decided by the presence of the
26
+ * `indicator` prop, not by whether the row is checked — a menu that has check
27
+ * marks in it always passes one, so the text column does not jump the moment a
28
+ * row is ticked.
29
+ *
30
+ * `forwardRef` is not optional: `asChild` composes the primitive's ref onto
31
+ * this component, and a plain function component would drop it — the row would
32
+ * be invisible to the menu's roving focus and typeahead.
33
+ */
34
+ export declare const MenuItem: import('react').ForwardRefExoticComponent<MenuItemProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -2,8 +2,9 @@
2
2
  * Shared presentational parts. Deliberately absent from `src/main.ts`: each is
3
3
  * an inert element with no keyboard, no roles and no positioning, so publishing
4
4
  * one would ship something that looks like an option and behaves like a div.
5
- * The public way to build a list stays `OxSelect`, `OxCombobox` or
6
- * `OxSearchPanel`, each of which pairs these with its own primitive.
5
+ * The public way to build a list stays `OxSelect`, `OxCombobox`,
6
+ * `OxSearchPanel` or `OxDropdownMenu`, each of which pairs these with its own
7
+ * primitive.
7
8
  */
8
9
  export { Surface, type SurfaceProps } from './Surface/Surface.tsx';
9
10
  export { ListboxEmpty, type ListboxEmptyProps, } from './Listbox/ListboxEmpty.tsx';
@@ -11,3 +12,4 @@ export { ListboxItem, type ListboxItemProps } from './Listbox/ListboxItem.tsx';
11
12
  export { ListboxLabel, type ListboxLabelProps, } from './Listbox/ListboxLabel.tsx';
12
13
  export { ListboxSeparator, type ListboxSeparatorProps, } from './Listbox/ListboxSeparator.tsx';
13
14
  export { ListboxViewport, type ListboxViewportProps, } from './Listbox/ListboxViewport.tsx';
15
+ export { MenuItem, type MenuItemProps } from './Menu/MenuItem.tsx';
package/dist/main.d.ts CHANGED
@@ -44,6 +44,7 @@ export { Popover as OxPopover, PopoverContent as OxPopoverContent, PopoverClose
44
44
  export { Accordion as OxAccordion, AccordionItem as OxAccordionItem, AccordionTrigger as OxAccordionTrigger, AccordionContent as OxAccordionContent, } from './Navigation/Accordion/index.ts';
45
45
  export { ToggleTabs as OxToggleTabs, ToggleTabsList as OxToggleTabsList, ToggleTabsTrigger as OxToggleTabsTrigger, ToggleTabsContent as OxToggleTabsContent, } from './Navigation/ToggleTabs/index.ts';
46
46
  export { PageControl as OxPageControl, pageControlDots, PAGE_CONTROL_WINDOW, type PageControlDot, type PageControlDotSize, } from './Navigation/PageControl/index.ts';
47
+ export { DropdownMenu as OxDropdownMenu, DropdownMenuTrigger as OxDropdownMenuTrigger, DropdownMenuContent as OxDropdownMenuContent, DropdownMenuGroup as OxDropdownMenuGroup, DropdownMenuLabel as OxDropdownMenuLabel, DropdownMenuItem as OxDropdownMenuItem, DropdownMenuCheckboxItem as OxDropdownMenuCheckboxItem, DropdownMenuRadioGroup as OxDropdownMenuRadioGroup, DropdownMenuRadioItem as OxDropdownMenuRadioItem, DropdownMenuSeparator as OxDropdownMenuSeparator, DropdownMenuShortcut as OxDropdownMenuShortcut, DropdownMenuSub as OxDropdownMenuSub, DropdownMenuSubTrigger as OxDropdownMenuSubTrigger, DropdownMenuSubContent as OxDropdownMenuSubContent, } from './Navigation/DropdownMenu/index.ts';
47
48
  export { Breadcrumb as OxBreadcrumb, BreadcrumbList as OxBreadcrumbList, BreadcrumbItem as OxBreadcrumbItem, BreadcrumbLink as OxBreadcrumbLink, BreadcrumbPage as OxBreadcrumbPage, BreadcrumbSeparator as OxBreadcrumbSeparator, BreadcrumbEllipsis as OxBreadcrumbEllipsis, } from './Navigation/Breadcrumb/index.ts';
48
49
  export { Counter as OxCounter, counterVariants, type CounterVariants, } from './Forms/Field/Counter/index.ts';
49
50
  export { FieldGroup as OxFieldGroup, FieldLabel as OxFieldLabel, FieldMessage as OxFieldMessage, useFieldControl, useFieldControlGroup, type FieldControlAttrs, type FieldControlGroupAttrs, type FieldGroupProps, type FieldVariant, } from './Forms/Field/index.ts';