@mintplayer/react-bootstrap 19.6.0 → 19.7.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.
@@ -0,0 +1,47 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import * as n from "react";
3
+ import { createComponent as f } from "@lit/react";
4
+ import { MpDropdownMenu as u } from "@mintplayer/web-components/dropdown-menu";
5
+ const m = f({
6
+ react: n,
7
+ tagName: "mp-dropdown-menu",
8
+ elementClass: u,
9
+ events: {
10
+ onSelect: "select"
11
+ }
12
+ }), v = n.forwardRef(function({ maxHeight: o, labelId: e, ...r }, t) {
13
+ return /* @__PURE__ */ a(
14
+ m,
15
+ {
16
+ ref: t,
17
+ ...o != null ? { "max-height": o } : {},
18
+ ...e != null ? { "label-id": e } : {},
19
+ ...r
20
+ }
21
+ );
22
+ }), R = n.forwardRef(
23
+ function({ active: o, disabled: e, value: r, className: t, children: i, ...c }, l) {
24
+ const s = n.useRef(null);
25
+ n.useImperativeHandle(l, () => s.current), n.useEffect(() => {
26
+ s.current && (s.current.value = r);
27
+ }, [r]);
28
+ const p = ["dropdown-item", o ? "active" : "", e ? "disabled" : "", t ?? ""].filter(Boolean).join(" ");
29
+ return /* @__PURE__ */ a("li", { ref: s, className: p, "aria-disabled": e ? !0 : void 0, ...c, children: i });
30
+ }
31
+ ), M = n.forwardRef(
32
+ function({ className: o, ...e }, r) {
33
+ const t = ["dropdown-divider", o ?? ""].filter(Boolean).join(" ");
34
+ return /* @__PURE__ */ a("li", { ref: r, role: "separator", className: t, ...e });
35
+ }
36
+ ), j = n.forwardRef(
37
+ function({ className: o, children: e, ...r }, t) {
38
+ const i = ["dropdown-header", o ?? ""].filter(Boolean).join(" ");
39
+ return /* @__PURE__ */ a("li", { ref: t, className: i, ...r, children: e });
40
+ }
41
+ );
42
+ export {
43
+ M as BsDropdownDivider,
44
+ j as BsDropdownHeader,
45
+ R as BsDropdownItem,
46
+ v as BsDropdownMenu
47
+ };
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * `<BsDropdownDivider>` — a Bootstrap `.dropdown-divider` separating groups of
4
+ * items inside `<BsDropdownMenu>`. Renders a plain `<li class="dropdown-divider">`
5
+ * that the menu WC styles via `::slotted(.dropdown-divider)`.
6
+ */
7
+ export declare const BsDropdownDivider: React.ForwardRefExoticComponent<React.LiHTMLAttributes<HTMLLIElement> & React.RefAttributes<HTMLLIElement>>;
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * `<BsDropdownHeader>` — a Bootstrap `.dropdown-header` labelling a group of items
4
+ * inside `<BsDropdownMenu>`. Renders a plain `<li class="dropdown-header">` that
5
+ * the menu WC styles via `::slotted(.dropdown-header)`. The label is the children.
6
+ */
7
+ export declare const BsDropdownHeader: React.ForwardRefExoticComponent<React.LiHTMLAttributes<HTMLLIElement> & React.RefAttributes<HTMLLIElement>>;
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ export interface BsDropdownItemProps extends Omit<React.LiHTMLAttributes<HTMLLIElement>, 'value'> {
3
+ /** Bootstrap `.active` appearance (also drives `aria-selected` in a listbox menu). */
4
+ active?: boolean;
5
+ /** Non-interactive; removed from the menu's roving order. */
6
+ disabled?: boolean;
7
+ /** Opaque value carried in the menu's `select` event detail. */
8
+ value?: unknown;
9
+ }
10
+ /**
11
+ * `<BsDropdownItem>` — a Bootstrap `.dropdown-item` for use inside
12
+ * `<BsDropdownMenu>`. There is no per-item web component: it renders a plain
13
+ * light-DOM `<li class="dropdown-item">` that the menu WC styles via its shadow
14
+ * `::slotted(.dropdown-item)` rule. Put the navigable content inside, e.g.
15
+ * `<BsDropdownItem><a href="/x">Action</a></BsDropdownItem>` (the companion
16
+ * stylesheet resets the nested link). The opaque `value` is assigned as a `value`
17
+ * property on the `<li>` so the menu can carry it in its `select` event.
18
+ */
19
+ export declare const BsDropdownItem: React.ForwardRefExoticComponent<BsDropdownItemProps & React.RefAttributes<HTMLLIElement>>;
@@ -0,0 +1,32 @@
1
+ import { MpDropdownMenu, DropdownMode, DropdownSelectEventDetail } from '@mintplayer/web-components/dropdown-menu';
2
+ import * as React from 'react';
3
+ export interface BsDropdownMenuProps {
4
+ /** `menu` (default, roving-tabindex keyboard nav) | `listbox`. */
5
+ mode?: DropdownMode;
6
+ /** px cap on the menu height; scrolls beyond. Maps to the `max-height` attribute. */
7
+ maxHeight?: number;
8
+ /** id of an external label, set as `aria-labelledby` on the list. Maps to `label-id`. */
9
+ labelId?: string;
10
+ /** Fires when an enabled item is activated; `detail.value` carries the item's value. */
11
+ onSelect?: (event: CustomEvent<DropdownSelectEventDetail>) => void;
12
+ className?: string;
13
+ children?: React.ReactNode;
14
+ }
15
+ /**
16
+ * React wrapper for `<mp-dropdown-menu>` — a Bootstrap `.dropdown-menu`.
17
+ * Side-effect-registers the WC on import.
18
+ *
19
+ * The menu chrome is server-rendered as Declarative Shadow DOM (see
20
+ * `injectMpDropdownDsd` in `@mintplayer/web-components/dropdown-menu/ssr`), so it
21
+ * renders styled with JavaScript disabled. Slot `<BsDropdownItem>` /
22
+ * `<BsDropdownDivider>` / `<BsDropdownHeader>` children. In `menu` mode (default)
23
+ * the menu provides roving-tabindex keyboard navigation over the enabled items.
24
+ *
25
+ * <BsDropdownMenu onSelect={(e) => console.log(e.detail.value)}>
26
+ * <BsDropdownHeader>Section</BsDropdownHeader>
27
+ * <BsDropdownItem value="a">First</BsDropdownItem>
28
+ * <BsDropdownDivider />
29
+ * <BsDropdownItem value="b" selected>Second</BsDropdownItem>
30
+ * </BsDropdownMenu>
31
+ */
32
+ export declare const BsDropdownMenu: React.ForwardRefExoticComponent<BsDropdownMenuProps & React.RefAttributes<MpDropdownMenu>>;
@@ -0,0 +1,7 @@
1
+ export { BsDropdownMenu } from './BsDropdownMenu';
2
+ export type { BsDropdownMenuProps } from './BsDropdownMenu';
3
+ export { BsDropdownItem } from './BsDropdownItem';
4
+ export type { BsDropdownItemProps } from './BsDropdownItem';
5
+ export { BsDropdownDivider } from './BsDropdownDivider';
6
+ export { BsDropdownHeader } from './BsDropdownHeader';
7
+ export type { DropdownMode, DropdownSelectEventDetail } from '@mintplayer/web-components/dropdown-menu';
@@ -0,0 +1,50 @@
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import * as a from "react";
3
+ import { createComponent as r } from "@lit/react";
4
+ import { MpNavbar as s, MpNavbarItem as b, MpNavbarBrand as v, MpNavbarDropdown as d } from "@mintplayer/web-components/navbar";
5
+ const c = r({
6
+ react: a,
7
+ tagName: "mp-navbar",
8
+ elementClass: s,
9
+ events: {
10
+ onExpandedChange: "expandedchange"
11
+ }
12
+ }), B = a.forwardRef(function({ ariaLabel: e, expanded: n, ...t }, o) {
13
+ return /* @__PURE__ */ m(
14
+ c,
15
+ {
16
+ ref: o,
17
+ ...e != null ? { "aria-label": e } : {},
18
+ ...n ? { expanded: "" } : {},
19
+ ...t
20
+ }
21
+ );
22
+ }), N = r({
23
+ react: a,
24
+ tagName: "mp-navbar-item",
25
+ elementClass: b
26
+ }), C = a.forwardRef(function({ active: e, disabled: n, ...t }, o) {
27
+ return /* @__PURE__ */ m(
28
+ N,
29
+ {
30
+ ref: o,
31
+ ...e ? { active: "" } : {},
32
+ ...n ? { disabled: "" } : {},
33
+ ...t
34
+ }
35
+ );
36
+ }), g = r({
37
+ react: a,
38
+ tagName: "mp-navbar-brand",
39
+ elementClass: v
40
+ }), M = r({
41
+ react: a,
42
+ tagName: "mp-navbar-dropdown",
43
+ elementClass: d
44
+ });
45
+ export {
46
+ B as BsNavbar,
47
+ g as BsNavbarBrand,
48
+ M as BsNavbarDropdown,
49
+ C as BsNavbarItem
50
+ };
@@ -0,0 +1,35 @@
1
+ import { MpNavbar, NavbarBreakpoint, NavbarExpandedChangeEventDetail } from '@mintplayer/web-components/navbar';
2
+ import * as React from 'react';
3
+ export interface BsNavbarProps {
4
+ /** Bootstrap breakpoint name (`xs`…`xxl`, default `md`); at/above it the nav is inline. */
5
+ breakpoint?: NavbarBreakpoint;
6
+ /** Background: a theme color (`primary`…`dark`) or adaptive `body` / `body-secondary` / `body-tertiary`. */
7
+ color?: string;
8
+ /** Programmatic collapse state (narrow mode); reflects the toggle. */
9
+ expanded?: boolean;
10
+ /** `fixed` pins the bar to the top of the viewport, full width; omit for in-flow. */
11
+ positioning?: 'fixed';
12
+ /** Landmark label for the `<nav>` (default `Main navigation`). Maps to `aria-label`. */
13
+ ariaLabel?: string;
14
+ /** Fires when the collapse toggles; `detail.expanded` carries the new state. */
15
+ onExpandedChange?: (event: CustomEvent<NavbarExpandedChangeEventDetail>) => void;
16
+ className?: string;
17
+ children?: React.ReactNode;
18
+ }
19
+ /**
20
+ * React wrapper for `<mp-navbar>` — the responsive Bootstrap navbar.
21
+ * Side-effect-registers the WC on import.
22
+ *
23
+ * The bar chrome (hamburger toggle, collapsible region) is server-rendered as
24
+ * Declarative Shadow DOM (see `injectMpNavbarDsd` in
25
+ * `@mintplayer/web-components/navbar/ssr`), so it collapses/reveals via its
26
+ * pure-CSS state machine with JavaScript disabled. Place the brand in
27
+ * `<BsNavbarBrand slot="brand">`, left items as default `<BsNavbarItem>`
28
+ * children, and right-aligned items with `slot="end"`.
29
+ *
30
+ * <BsNavbar breakpoint="lg" color="body-tertiary">
31
+ * <BsNavbarBrand slot="brand"><a href="/">MyApp</a></BsNavbarBrand>
32
+ * <BsNavbarItem active><a href="/home">Home</a></BsNavbarItem>
33
+ * </BsNavbar>
34
+ */
35
+ export declare const BsNavbar: React.ForwardRefExoticComponent<BsNavbarProps & React.RefAttributes<MpNavbar>>;
@@ -0,0 +1,17 @@
1
+ import { MpNavbarBrand } from '@mintplayer/web-components/navbar';
2
+ import * as React from 'react';
3
+ export interface BsNavbarBrandProps {
4
+ /** Always `"brand"` to project into the navbar's brand slot. */
5
+ slot?: string;
6
+ className?: string;
7
+ children?: React.ReactNode;
8
+ }
9
+ /**
10
+ * React wrapper for `<mp-navbar-brand>` — the navbar brand/logo. Place it with
11
+ * `slot="brand"` and slot a link (`<a href>` / router `<Link>`) or text as its
12
+ * child; it is styled as a Bootstrap `.navbar-brand`. Renders the custom element
13
+ * directly so it projects cleanly. Side-effect-registers the WC on import.
14
+ *
15
+ * <BsNavbarBrand slot="brand"><a href="/">MyApp</a></BsNavbarBrand>
16
+ */
17
+ export declare const BsNavbarBrand: React.ForwardRefExoticComponent<BsNavbarBrandProps & React.RefAttributes<MpNavbarBrand>>;
@@ -0,0 +1,23 @@
1
+ import { MpNavbarDropdown } from '@mintplayer/web-components/navbar';
2
+ import * as React from 'react';
3
+ export interface BsNavbarDropdownProps {
4
+ /** Set when nesting the dropdown into a parent slot (e.g. `"end"`). */
5
+ slot?: string;
6
+ className?: string;
7
+ children?: React.ReactNode;
8
+ }
9
+ /**
10
+ * React wrapper for `<mp-navbar-dropdown>` — a navbar entry that opens a
11
+ * dropdown. Slot the trigger label with `slot="label"` and a `<BsDropdownMenu>`
12
+ * as the default content (the panel). Nest one inside a `<BsDropdownItem>` to
13
+ * make a submenu. Renders the custom element directly so children project
14
+ * cleanly. Side-effect-registers the WC on import.
15
+ *
16
+ * <BsNavbarDropdown>
17
+ * <span slot="label">Products</span>
18
+ * <BsDropdownMenu>
19
+ * <BsDropdownItem><a href="/p1">Product 1</a></BsDropdownItem>
20
+ * </BsDropdownMenu>
21
+ * </BsNavbarDropdown>
22
+ */
23
+ export declare const BsNavbarDropdown: React.ForwardRefExoticComponent<BsNavbarDropdownProps & React.RefAttributes<MpNavbarDropdown>>;
@@ -0,0 +1,21 @@
1
+ import { MpNavbarItem } from '@mintplayer/web-components/navbar';
2
+ import * as React from 'react';
3
+ export interface BsNavbarItemProps {
4
+ /** Current page (`.active` appearance). Reflected boolean attribute. */
5
+ active?: boolean;
6
+ /** Non-interactive. Reflected boolean attribute. */
7
+ disabled?: boolean;
8
+ /** Navbar slot; set `"end"` to place the item in the right-aligned group. */
9
+ slot?: string;
10
+ className?: string;
11
+ children?: React.ReactNode;
12
+ }
13
+ /**
14
+ * React wrapper for `<mp-navbar-item>` — a navbar nav entry. Slot a real link
15
+ * (`<a href>` / a router `<Link>`) as the child: it stays light DOM so it
16
+ * navigates with no JavaScript, and is styled as a Bootstrap `.nav-link`.
17
+ * Side-effect-registers the WC on import.
18
+ *
19
+ * <BsNavbarItem active><a href="/home">Home</a></BsNavbarItem>
20
+ */
21
+ export declare const BsNavbarItem: React.ForwardRefExoticComponent<BsNavbarItemProps & React.RefAttributes<MpNavbarItem>>;
@@ -0,0 +1,9 @@
1
+ export { BsNavbar } from './BsNavbar';
2
+ export type { BsNavbarProps } from './BsNavbar';
3
+ export { BsNavbarItem } from './BsNavbarItem';
4
+ export type { BsNavbarItemProps } from './BsNavbarItem';
5
+ export { BsNavbarBrand } from './BsNavbarBrand';
6
+ export type { BsNavbarBrandProps } from './BsNavbarBrand';
7
+ export { BsNavbarDropdown } from './BsNavbarDropdown';
8
+ export type { BsNavbarDropdownProps } from './BsNavbarDropdown';
9
+ export type { NavbarBreakpoint, NavbarExpandedChangeEventDetail } from '@mintplayer/web-components/navbar';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintplayer/react-bootstrap",
3
- "version": "19.6.0",
3
+ "version": "19.7.1",
4
4
  "description": "React 19 wrappers around @mintplayer/web-components. Each sub-entry maps one-to-one with a WC sub-entry and exposes typed React components via @lit/react's createComponent.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -0,0 +1 @@
1
+ .dropdown-item>a,.dropdown-item>button{display:block;width:auto;margin:calc(-1 * var(--bs-dropdown-item-padding-y, .25rem)) calc(-1 * var(--bs-dropdown-item-padding-x, 1rem));padding:var(--bs-dropdown-item-padding-y, .25rem) var(--bs-dropdown-item-padding-x, 1rem);color:inherit;text-decoration:none;text-align:inherit;background:none;border:0;font:inherit}.dropdown-item>a.active,.dropdown-item>button.active{color:var(--bs-dropdown-link-active-color, #fff);background-color:var(--bs-dropdown-link-active-bg, var(--bs-primary))}