@mintplayer/react-bootstrap 19.2.0 → 19.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/card/index.mjs CHANGED
@@ -1,56 +1,67 @@
1
- import * as e from "react";
2
- import { createComponent as a } from "@lit/react";
3
- import { MpCardElement as t, MpCardBodyElement as r, MpCardFooterElement as m, MpCardGroupElement as s, MpCardHeaderElement as l, MpCardImgElement as d, MpCardLinkElement as n, MpCardSubtitleElement as c, MpCardTextElement as o, MpCardTitleElement as C } from "@mintplayer/web-components/card";
4
- const i = a({
5
- react: e,
1
+ import * as B from "react";
2
+ import { forwardRef as r, useRef as p, useEffect as f } from "react";
3
+ import { createComponent as C } from "@lit/react";
4
+ import { MpCardElement as N, applyHeaderNavStyle as u } from "@mintplayer/web-components/card";
5
+ import { jsx as o, jsxs as x, Fragment as y } from "react/jsx-runtime";
6
+ const D = C({
7
+ react: B,
6
8
  tagName: "mp-card",
7
- elementClass: t
8
- }), B = a({
9
- react: e,
10
- tagName: "mp-card-body",
11
- elementClass: r
12
- }), E = a({
13
- react: e,
14
- tagName: "mp-card-footer",
15
- elementClass: m
16
- }), M = a({
17
- react: e,
18
- tagName: "mp-card-group",
19
- elementClass: s
20
- }), N = a({
21
- react: e,
22
- tagName: "mp-card-header",
23
- elementClass: l
24
- }), u = a({
25
- react: e,
26
- tagName: "mp-card-img",
27
- elementClass: d
28
- }), b = a({
29
- react: e,
30
- tagName: "mp-card-link",
31
- elementClass: n
32
- }), f = a({
33
- react: e,
34
- tagName: "mp-card-subtitle",
35
- elementClass: c
36
- }), x = a({
37
- react: e,
38
- tagName: "mp-card-text",
39
- elementClass: o
40
- }), T = a({
41
- react: e,
42
- tagName: "mp-card-title",
43
- elementClass: C
44
- });
9
+ elementClass: N
10
+ }), g = (...a) => a.filter(Boolean).join(" "), j = r(
11
+ ({ className: a, ...e }, s) => /* @__PURE__ */ o("div", { ref: s, className: g("card-body", a), ...e })
12
+ );
13
+ j.displayName = "BsCardBody";
14
+ const v = (...a) => a.filter(Boolean).join(" "), $ = r(
15
+ ({ className: a, color: e, ...s }, t) => /* @__PURE__ */ o("div", { ref: t, className: v("card-footer", e && `text-bg-${e}`, a), ...s })
16
+ );
17
+ $.displayName = "BsCardFooter";
18
+ const b = (...a) => a.filter(Boolean).join(" "), R = r(
19
+ ({ className: a, ...e }, s) => /* @__PURE__ */ o("div", { ref: s, className: b("card-group", a), ...e })
20
+ );
21
+ R.displayName = "BsCardGroup";
22
+ const T = (...a) => a.filter(Boolean).join(" "), k = r(
23
+ ({ className: a, color: e, navStyle: s, children: t, ...n }, i) => {
24
+ const c = p(null);
25
+ return f(() => {
26
+ c.current && u(c.current, s ?? null);
27
+ }, [s, t]), /* @__PURE__ */ o("div", { ref: (d) => {
28
+ c.current = d, typeof i == "function" ? i(d) : i && (i.current = d);
29
+ }, className: T("card-header", e && `text-bg-${e}`, a), ...n, children: t });
30
+ }
31
+ );
32
+ k.displayName = "BsCardHeader";
33
+ const l = (...a) => a.filter(Boolean).join(" "), F = r(
34
+ ({ className: a, position: e = "top", src: s, alt: t, children: n, ...i }, c) => e === "overlay" ? /* @__PURE__ */ x(y, { children: [
35
+ /* @__PURE__ */ o("img", { ref: c, className: l("card-img", a), src: s, alt: t, ...i }),
36
+ /* @__PURE__ */ o("div", { className: "card-img-overlay", children: n })
37
+ ] }) : /* @__PURE__ */ o("img", { ref: c, className: l(e === "bottom" ? "card-img-bottom" : "card-img-top", a), src: s, alt: t, ...i })
38
+ );
39
+ F.displayName = "BsCardImg";
40
+ const H = (...a) => a.filter(Boolean).join(" "), E = r(
41
+ ({ className: a, href: e, ...s }, t) => /* @__PURE__ */ o("a", { ref: t, className: H("card-link", a), href: e, ...s })
42
+ );
43
+ E.displayName = "BsCardLink";
44
+ const G = (...a) => a.filter(Boolean).join(" "), I = r(
45
+ ({ className: a, ...e }, s) => /* @__PURE__ */ o("div", { ref: s, className: G("card-subtitle", a), ...e })
46
+ );
47
+ I.displayName = "BsCardSubtitle";
48
+ const L = (...a) => a.filter(Boolean).join(" "), S = r(
49
+ ({ className: a, ...e }, s) => /* @__PURE__ */ o("div", { ref: s, className: L("card-text", a), ...e })
50
+ );
51
+ S.displayName = "BsCardText";
52
+ const h = (...a) => a.filter(Boolean).join(" "), w = r(
53
+ ({ className: a, ...e }, s) => /* @__PURE__ */ o("div", { ref: s, className: h("card-title", a), ...e })
54
+ );
55
+ w.displayName = "BsCardTitle";
45
56
  export {
46
- i as BsCard,
47
- B as BsCardBody,
48
- E as BsCardFooter,
49
- M as BsCardGroup,
50
- N as BsCardHeader,
51
- u as BsCardImg,
52
- b as BsCardLink,
53
- f as BsCardSubtitle,
54
- x as BsCardText,
55
- T as BsCardTitle
57
+ D as BsCard,
58
+ j as BsCardBody,
59
+ $ as BsCardFooter,
60
+ R as BsCardGroup,
61
+ k as BsCardHeader,
62
+ F as BsCardImg,
63
+ E as BsCardLink,
64
+ I as BsCardSubtitle,
65
+ S as BsCardText,
66
+ w as BsCardTitle
56
67
  };
@@ -1,8 +1,9 @@
1
- import { MpCardBodyElement } from '@mintplayer/web-components/card';
1
+ import * as React from 'react';
2
2
  /**
3
- * React wrapper for `<mp-card-body>`. Side-effect-registers the WC via
4
- * the import above. Typed props/events extend off MpCardBodyElement;
5
- * hand-edit this file to add an `events: { onXxx: 'xxx' as EventName<...> }`
6
- * block if you need typed event listeners.
3
+ * Plain React `card-body` element. Renders a `div.card-body` that gets
4
+ * slotted into `<mp-card>` and styled by mp-card's shadow + the global
5
+ * card sheet. Merges an incoming `className` and spreads remaining props.
7
6
  */
8
- export declare const BsCardBody: import('@lit/react').ReactWebComponent<MpCardBodyElement, {}>;
7
+ export declare const BsCardBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
8
+ children?: React.ReactNode | undefined;
9
+ } & React.RefAttributes<HTMLDivElement>>;
@@ -1,8 +1,15 @@
1
- import { MpCardFooterElement } from '@mintplayer/web-components/card';
1
+ import { HTMLAttributes } from 'react';
2
+ import * as React from 'react';
3
+ interface BsCardFooterProps extends HTMLAttributes<HTMLDivElement> {
4
+ /** Bootstrap contextual color; emits a `text-bg-{color}` class. */
5
+ color?: string;
6
+ }
2
7
  /**
3
- * React wrapper for `<mp-card-footer>`. Side-effect-registers the WC via
4
- * the import above. Typed props/events extend off MpCardFooterElement;
5
- * hand-edit this file to add an `events: { onXxx: 'xxx' as EventName<...> }`
6
- * block if you need typed event listeners.
8
+ * Plain React `card-footer` element. Renders a `div.card-footer` that gets
9
+ * slotted into `<mp-card>` and styled by mp-card's shadow + the global
10
+ * card sheet. Merges an incoming `className` and spreads remaining props.
7
11
  */
8
- export declare const BsCardFooter: import('@lit/react').ReactWebComponent<MpCardFooterElement, {}>;
12
+ export declare const BsCardFooter: React.ForwardRefExoticComponent<BsCardFooterProps & {
13
+ children?: React.ReactNode | undefined;
14
+ } & React.RefAttributes<HTMLDivElement>>;
15
+ export {};
@@ -1,8 +1,9 @@
1
- import { MpCardGroupElement } from '@mintplayer/web-components/card';
1
+ import * as React from 'react';
2
2
  /**
3
- * React wrapper for `<mp-card-group>`. Side-effect-registers the WC via
4
- * the import above. Typed props/events extend off MpCardGroupElement;
5
- * hand-edit this file to add an `events: { onXxx: 'xxx' as EventName<...> }`
6
- * block if you need typed event listeners.
3
+ * Plain React `card-group` element. Renders a `div.card-group` that gets
4
+ * slotted into `<mp-card>` and styled by mp-card's shadow + the global
5
+ * card sheet. Merges an incoming `className` and spreads remaining props.
7
6
  */
8
- export declare const BsCardGroup: import('@lit/react').ReactWebComponent<MpCardGroupElement, {}>;
7
+ export declare const BsCardGroup: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
8
+ children?: React.ReactNode | undefined;
9
+ } & React.RefAttributes<HTMLDivElement>>;
@@ -1,8 +1,20 @@
1
- import { MpCardHeaderElement } from '@mintplayer/web-components/card';
1
+ import { HTMLAttributes } from 'react';
2
+ import { CardHeaderNavStyle } from '@mintplayer/web-components/card';
3
+ import * as React from 'react';
4
+ interface BsCardHeaderProps extends HTMLAttributes<HTMLDivElement> {
5
+ /** Bootstrap contextual color; emits a `text-bg-{color}` class. */
6
+ color?: string;
7
+ /** Promotes a slotted nav to `card-header-tabs` / `card-header-pills`. */
8
+ navStyle?: CardHeaderNavStyle;
9
+ }
2
10
  /**
3
- * React wrapper for `<mp-card-header>`. Side-effect-registers the WC via
4
- * the import above. Typed props/events extend off MpCardHeaderElement;
5
- * hand-edit this file to add an `events: { onXxx: 'xxx' as EventName<...> }`
6
- * block if you need typed event listeners.
11
+ * Plain React `card-header` element. Renders a `div.card-header` that gets
12
+ * slotted into `<mp-card>` and styled by mp-card's shadow + the global
13
+ * card sheet. When `navStyle` is set, the kept `applyHeaderNavStyle` helper
14
+ * promotes the first slotted nav to the matching Bootstrap class.
15
+ * Merges an incoming `className` and spreads remaining props.
7
16
  */
8
- export declare const BsCardHeader: import('@lit/react').ReactWebComponent<MpCardHeaderElement, {}>;
17
+ export declare const BsCardHeader: React.ForwardRefExoticComponent<BsCardHeaderProps & {
18
+ children?: React.ReactNode | undefined;
19
+ } & React.RefAttributes<HTMLDivElement>>;
20
+ export {};
@@ -1,8 +1,20 @@
1
- import { MpCardImgElement } from '@mintplayer/web-components/card';
1
+ import { ImgHTMLAttributes } from 'react';
2
+ import { CardImagePosition } from '@mintplayer/web-components/card';
3
+ import * as React from 'react';
4
+ interface BsCardImgProps extends ImgHTMLAttributes<HTMLImageElement> {
5
+ /** Where the image sits relative to the card body. Defaults to `top`. */
6
+ position?: CardImagePosition;
7
+ src?: string;
8
+ alt?: string;
9
+ }
2
10
  /**
3
- * React wrapper for `<mp-card-img>`. Side-effect-registers the WC via
4
- * the import above. Typed props/events extend off MpCardImgElement;
5
- * hand-edit this file to add an `events: { onXxx: 'xxx' as EventName<...> }`
6
- * block if you need typed event listeners.
11
+ * Plain React `card-img` element. Renders a `card-img-top` / `card-img-bottom`
12
+ * image, or — for `overlay` — a `card-img` paired with a `card-img-overlay`
13
+ * div that holds `children`. The result gets slotted into `<mp-card>` and
14
+ * styled by mp-card's shadow + the global card sheet. Merges an incoming
15
+ * `className` and spreads remaining props onto the `<img>`.
7
16
  */
8
- export declare const BsCardImg: import('@lit/react').ReactWebComponent<MpCardImgElement, {}>;
17
+ export declare const BsCardImg: React.ForwardRefExoticComponent<BsCardImgProps & {
18
+ children?: React.ReactNode | undefined;
19
+ } & React.RefAttributes<HTMLImageElement>>;
20
+ export {};
@@ -1,8 +1,15 @@
1
- import { MpCardLinkElement } from '@mintplayer/web-components/card';
1
+ import { AnchorHTMLAttributes } from 'react';
2
+ import * as React from 'react';
3
+ interface BsCardLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
4
+ /** Link target. */
5
+ href?: string;
6
+ }
2
7
  /**
3
- * React wrapper for `<mp-card-link>`. Side-effect-registers the WC via
4
- * the import above. Typed props/events extend off MpCardLinkElement;
5
- * hand-edit this file to add an `events: { onXxx: 'xxx' as EventName<...> }`
6
- * block if you need typed event listeners.
8
+ * Plain React `card-link` element. Renders an `a.card-link` that gets
9
+ * slotted into `<mp-card>` and styled by mp-card's shadow + the global
10
+ * card sheet. Merges an incoming `className` and spreads remaining props.
7
11
  */
8
- export declare const BsCardLink: import('@lit/react').ReactWebComponent<MpCardLinkElement, {}>;
12
+ export declare const BsCardLink: React.ForwardRefExoticComponent<BsCardLinkProps & {
13
+ children?: React.ReactNode | undefined;
14
+ } & React.RefAttributes<HTMLAnchorElement>>;
15
+ export {};
@@ -1,8 +1,9 @@
1
- import { MpCardSubtitleElement } from '@mintplayer/web-components/card';
1
+ import * as React from 'react';
2
2
  /**
3
- * React wrapper for `<mp-card-subtitle>`. Side-effect-registers the WC via
4
- * the import above. Typed props/events extend off MpCardSubtitleElement;
5
- * hand-edit this file to add an `events: { onXxx: 'xxx' as EventName<...> }`
6
- * block if you need typed event listeners.
3
+ * Plain React `card-subtitle` element. Renders a `div.card-subtitle` that
4
+ * gets slotted into `<mp-card>` and styled by mp-card's shadow + the global
5
+ * card sheet. Merges an incoming `className` and spreads remaining props.
7
6
  */
8
- export declare const BsCardSubtitle: import('@lit/react').ReactWebComponent<MpCardSubtitleElement, {}>;
7
+ export declare const BsCardSubtitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
8
+ children?: React.ReactNode | undefined;
9
+ } & React.RefAttributes<HTMLDivElement>>;
@@ -1,8 +1,9 @@
1
- import { MpCardTextElement } from '@mintplayer/web-components/card';
1
+ import * as React from 'react';
2
2
  /**
3
- * React wrapper for `<mp-card-text>`. Side-effect-registers the WC via
4
- * the import above. Typed props/events extend off MpCardTextElement;
5
- * hand-edit this file to add an `events: { onXxx: 'xxx' as EventName<...> }`
6
- * block if you need typed event listeners.
3
+ * Plain React `card-text` element. Renders a `div.card-text` that gets
4
+ * slotted into `<mp-card>` and styled by mp-card's shadow + the global
5
+ * card sheet. Merges an incoming `className` and spreads remaining props.
7
6
  */
8
- export declare const BsCardText: import('@lit/react').ReactWebComponent<MpCardTextElement, {}>;
7
+ export declare const BsCardText: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
8
+ children?: React.ReactNode | undefined;
9
+ } & React.RefAttributes<HTMLDivElement>>;
@@ -1,8 +1,9 @@
1
- import { MpCardTitleElement } from '@mintplayer/web-components/card';
1
+ import * as React from 'react';
2
2
  /**
3
- * React wrapper for `<mp-card-title>`. Side-effect-registers the WC via
4
- * the import above. Typed props/events extend off MpCardTitleElement;
5
- * hand-edit this file to add an `events: { onXxx: 'xxx' as EventName<...> }`
6
- * block if you need typed event listeners.
3
+ * Plain React `card-title` element. Renders a `div.card-title` that gets
4
+ * slotted into `<mp-card>` and styled by mp-card's shadow + the global
5
+ * card sheet. Merges an incoming `className` and spreads remaining props.
7
6
  */
8
- export declare const BsCardTitle: import('@lit/react').ReactWebComponent<MpCardTitleElement, {}>;
7
+ export declare const BsCardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
8
+ children?: React.ReactNode | undefined;
9
+ } & React.RefAttributes<HTMLDivElement>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintplayer/react-bootstrap",
3
- "version": "19.2.0",
3
+ "version": "19.3.0",
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,94 @@
1
+ import { jsx as l, jsxs as O } from "react/jsx-runtime";
2
+ import * as x from "react";
3
+ import { createComponent as M } from "@lit/react";
4
+ import { MpTimelineItem as y, MpTimeline as F, resolveSides as R } from "@mintplayer/web-components/timeline";
5
+ const q = M({
6
+ react: x,
7
+ tagName: "mp-timeline-item",
8
+ elementClass: y
9
+ }), z = M({
10
+ react: x,
11
+ tagName: "mp-timeline",
12
+ elementClass: F,
13
+ events: {
14
+ onItemClick: "item-click",
15
+ onSelectionChange: "selection-change"
16
+ }
17
+ }), v = (c, n) => c.id ?? n;
18
+ function H(c) {
19
+ const {
20
+ items: n,
21
+ orientation: g = "vertical",
22
+ align: C = "start",
23
+ reverse: a = !1,
24
+ selectable: I = "none",
25
+ selection: f,
26
+ onSelectionChange: S,
27
+ onItemClick: u,
28
+ renderMarker: r,
29
+ renderTitle: d,
30
+ renderTimestamp: m,
31
+ renderOpposite: p,
32
+ renderContent: h,
33
+ className: b,
34
+ children: B
35
+ } = c, T = !!(r || d || m || p || h), k = !!n && !T, N = T && !!n, j = (e) => u?.(e.detail), w = (e) => {
36
+ const t = e.detail;
37
+ if (n && n.length) {
38
+ const o = new Map(n.map((s, i) => [String(v(s, i)), s]));
39
+ S?.(
40
+ t.selected.map((s) => o.get(String(s.id ?? "")) ?? s)
41
+ );
42
+ } else
43
+ S?.(t.selected);
44
+ }, D = R(n?.length ?? 0, C, a);
45
+ return /* @__PURE__ */ l(
46
+ z,
47
+ {
48
+ orientation: g,
49
+ align: C,
50
+ reverse: a,
51
+ selectable: I,
52
+ className: b,
53
+ onItemClick: j,
54
+ onSelectionChange: w,
55
+ ...k ? { items: n } : {},
56
+ ...I !== "none" ? { selectedIds: f ? f.map((e, t) => v(e, t)) : [] } : {},
57
+ children: N && n ? n.map((e, t) => {
58
+ const o = n.length, s = a ? o - 1 - t : t, i = {
59
+ index: t,
60
+ visualIndex: s,
61
+ isFirst: s === 0,
62
+ isLast: s === o - 1,
63
+ orientation: g,
64
+ side: D[t] ?? "start"
65
+ }, L = e.time instanceof Date ? e.time.toLocaleDateString() : e.time;
66
+ return /* @__PURE__ */ O(
67
+ q,
68
+ {
69
+ itemId: e.id,
70
+ title: e.title,
71
+ description: e.description,
72
+ time: L ?? void 0,
73
+ icon: e.icon,
74
+ color: e.color,
75
+ itemClass: e.cssClass,
76
+ disabled: e.disabled,
77
+ children: [
78
+ r && /* @__PURE__ */ l("span", { slot: "marker", children: r(e, i) }),
79
+ d && /* @__PURE__ */ l("span", { slot: "title", children: d(e, i) }),
80
+ m && /* @__PURE__ */ l("span", { slot: "opposite", children: m(e, i) }),
81
+ p && /* @__PURE__ */ l("span", { slot: "opposite", children: p(e, i) }),
82
+ h && /* @__PURE__ */ l("div", { slot: "content", children: h(e, i) })
83
+ ]
84
+ },
85
+ e.id ?? t
86
+ );
87
+ }) : k ? null : B
88
+ }
89
+ );
90
+ }
91
+ export {
92
+ H as BsTimeline,
93
+ q as BsTimelineItem
94
+ };
@@ -0,0 +1,33 @@
1
+ import { TimelineAlign, TimelineItem, TimelineItemClickDetail, TimelineItemContext, TimelineOrientation, TimelineSelectable } from '@mintplayer/web-components/timeline-core';
2
+ import * as React from 'react';
3
+ type RenderProp = (item: TimelineItem, ctx: TimelineItemContext) => React.ReactNode;
4
+ export interface BsTimelineProps {
5
+ items?: TimelineItem[];
6
+ orientation?: TimelineOrientation;
7
+ align?: TimelineAlign;
8
+ reverse?: boolean;
9
+ selectable?: TimelineSelectable;
10
+ /** Controlled selection (array of items, identity via `id`). */
11
+ selection?: TimelineItem[];
12
+ onSelectionChange?: (selected: TimelineItem[]) => void;
13
+ onItemClick?: (detail: TimelineItemClickDetail) => void;
14
+ /** Render-props — lowered into `<BsTimelineItem>` children. */
15
+ renderMarker?: RenderProp;
16
+ renderTitle?: RenderProp;
17
+ renderTimestamp?: RenderProp;
18
+ renderOpposite?: RenderProp;
19
+ renderContent?: RenderProp;
20
+ className?: string;
21
+ /** Declarative `<BsTimelineItem>` children (used when no render-props). */
22
+ children?: React.ReactNode;
23
+ }
24
+ /**
25
+ * `<BsTimeline>` — React wrapper around `<mp-timeline>`.
26
+ *
27
+ * Render-props lower into `<BsTimelineItem>` children with their output in the
28
+ * item's named slots (one shadow boundary). With no render-props, `items` is
29
+ * set as the WC property, or declarative `<BsTimelineItem>` children pass
30
+ * straight through.
31
+ */
32
+ export declare function BsTimeline(props: BsTimelineProps): React.ReactElement;
33
+ export {};
@@ -0,0 +1,11 @@
1
+ import { MpTimelineItem } from '@mintplayer/web-components/timeline';
2
+ /**
3
+ * `<BsTimelineItem>` — declarative row for `<BsTimeline>`. Renders the
4
+ * `<mp-timeline-item>` custom element directly (props map to element
5
+ * properties), so it projects cleanly into the timeline's default slot.
6
+ *
7
+ * Props mirror the element's properties: `itemId`, `title`, `description`,
8
+ * `time`, `icon`, `color`, `itemClass`, `disabled`, `selected`. Slot content is
9
+ * passed as children with `slot="marker|title|opposite|content|connector"`.
10
+ */
11
+ export declare const BsTimelineItem: import('@lit/react').ReactWebComponent<MpTimelineItem, {}>;
@@ -0,0 +1,4 @@
1
+ export { BsTimeline } from './BsTimeline';
2
+ export type { BsTimelineProps } from './BsTimeline';
3
+ export { BsTimelineItem } from './BsTimelineItem';
4
+ export type { TimelineItem, TimelineOrientation, TimelineAlign, TimelineSide, TimelineSelectable, TimelineItemContext, TimelineConnectorContext, TimelineItemClickDetail, TimelineSelectionChangeDetail, } from '@mintplayer/web-components/timeline-core';