@mintplayer/react-bootstrap 19.19.0 → 19.21.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/datatable/index.mjs +4 -1
- package/datatable/src/BsDatatable.d.ts +16 -1
- package/dropdown-menu/index.mjs +13 -13
- package/dropdown-menu/src/BsDropdownItem.d.ts +4 -2
- package/package.json +6 -2
- package/theming/index.mjs +49 -0
- package/theming/src/BsThemeToggle.d.ts +22 -0
- package/theming/src/index.d.ts +3 -0
- package/theming/src/useBsTheme.d.ts +19 -0
package/datatable/index.mjs
CHANGED
|
@@ -15,7 +15,10 @@ const l = e({
|
|
|
15
15
|
onSelectionChange: "mp-datatable-selection-change",
|
|
16
16
|
onRowExpand: "mp-datatable-row-expand",
|
|
17
17
|
onRowCollapse: "mp-datatable-row-collapse",
|
|
18
|
-
onExpandedIdsChange: "mp-datatable-expanded-ids-change"
|
|
18
|
+
onExpandedIdsChange: "mp-datatable-expanded-ids-change",
|
|
19
|
+
onFilterOpen: "mp-datatable-filter-open",
|
|
20
|
+
onFilterClose: "mp-datatable-filter-close",
|
|
21
|
+
onFilterChange: "mp-datatable-filter-change"
|
|
19
22
|
}
|
|
20
23
|
});
|
|
21
24
|
export {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventName } from '@lit/react';
|
|
2
|
-
import { MpDatatable, RowEventDetail, SortChangeEventDetail, SelectionChangeEventDetail, TreeRowExpandDetail, TreeExpandedIdsChangeDetail } from '@mintplayer/web-components/datatable';
|
|
2
|
+
import { MpDatatable, RowEventDetail, SortChangeEventDetail, SelectionChangeEventDetail, TreeRowExpandDetail, TreeExpandedIdsChangeDetail, FilterChangeDetail } from '@mintplayer/web-components/datatable';
|
|
3
3
|
/**
|
|
4
4
|
* React wrapper for `<mp-datatable>`. Side-effect-registers the WC via
|
|
5
5
|
* the import above. The `events` map surfaces each CustomEvent the WC
|
|
@@ -17,6 +17,14 @@ import { MpDatatable, RowEventDetail, SortChangeEventDetail, SelectionChangeEven
|
|
|
17
17
|
* on-demand windows, tree children, pagination, sort/perPage reloads. The
|
|
18
18
|
* consumer wires nothing else (no `totalRecords`, no event bridge). Selected
|
|
19
19
|
* row objects arrive on `onSelectionChange`'s `detail.selectedRows`.
|
|
20
|
+
*
|
|
21
|
+
* Filtering: mark a column `filterable` and it gets the built-in panel — search,
|
|
22
|
+
* include/exclude, checkbox list, clear — with no wrapper code, because the
|
|
23
|
+
* panel lives in the web component. `distincts` supplies the value lists when
|
|
24
|
+
* the element does not hold every row; `onFilterChange` reports the selection,
|
|
25
|
+
* which the consumer applies. A column's `filterRenderer` replaces the panel
|
|
26
|
+
* entirely, and must return a STABLE node: it is mounted once per open, and
|
|
27
|
+
* repainting it is the renderer's job via `context.onChange`.
|
|
20
28
|
*/
|
|
21
29
|
export declare const BsDatatable: import('@lit/react').ReactWebComponent<MpDatatable, {
|
|
22
30
|
onPageChange: EventName<CustomEvent<{
|
|
@@ -33,4 +41,11 @@ export declare const BsDatatable: import('@lit/react').ReactWebComponent<MpDatat
|
|
|
33
41
|
onRowExpand: EventName<CustomEvent<TreeRowExpandDetail>>;
|
|
34
42
|
onRowCollapse: EventName<CustomEvent<TreeRowExpandDetail>>;
|
|
35
43
|
onExpandedIdsChange: EventName<CustomEvent<TreeExpandedIdsChangeDetail>>;
|
|
44
|
+
onFilterOpen: EventName<CustomEvent<{
|
|
45
|
+
column: string;
|
|
46
|
+
}>>;
|
|
47
|
+
onFilterClose: EventName<CustomEvent<{
|
|
48
|
+
column: string;
|
|
49
|
+
}>>;
|
|
50
|
+
onFilterChange: EventName<CustomEvent<FilterChangeDetail>>;
|
|
36
51
|
}>;
|
package/dropdown-menu/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
2
|
import * as n from "react";
|
|
3
3
|
import { createComponent as f } from "@lit/react";
|
|
4
4
|
import { MpDropdownMenu as u } from "@mintplayer/web-components/dropdown-menu";
|
|
@@ -9,8 +9,8 @@ const m = f({
|
|
|
9
9
|
events: {
|
|
10
10
|
onSelect: "select"
|
|
11
11
|
}
|
|
12
|
-
}),
|
|
13
|
-
return /* @__PURE__ */
|
|
12
|
+
}), R = n.forwardRef(function({ maxHeight: e, ...o }, r) {
|
|
13
|
+
return /* @__PURE__ */ d(
|
|
14
14
|
m,
|
|
15
15
|
{
|
|
16
16
|
ref: r,
|
|
@@ -18,29 +18,29 @@ const m = f({
|
|
|
18
18
|
...o
|
|
19
19
|
}
|
|
20
20
|
);
|
|
21
|
-
}),
|
|
22
|
-
function({ active: e, disabled: o, value: r, className: t, children: i, ...c },
|
|
21
|
+
}), v = n.forwardRef(
|
|
22
|
+
function({ active: e, disabled: o, value: r, className: t, children: i, ...c }, p) {
|
|
23
23
|
const s = n.useRef(null);
|
|
24
|
-
n.useImperativeHandle(
|
|
25
|
-
s.current && (s.current.
|
|
24
|
+
n.useImperativeHandle(p, () => s.current), n.useEffect(() => {
|
|
25
|
+
s.current && (s.current.dropdownValue = r);
|
|
26
26
|
}, [r]);
|
|
27
|
-
const
|
|
28
|
-
return /* @__PURE__ */
|
|
27
|
+
const l = ["dropdown-item", e ? "active" : "", o ? "disabled" : "", t ?? ""].filter(Boolean).join(" ");
|
|
28
|
+
return /* @__PURE__ */ d("li", { ref: s, className: l, "aria-disabled": o ? !0 : void 0, ...c, children: i });
|
|
29
29
|
}
|
|
30
30
|
), M = n.forwardRef(
|
|
31
31
|
function({ className: e, ...o }, r) {
|
|
32
32
|
const t = ["dropdown-divider", e ?? ""].filter(Boolean).join(" ");
|
|
33
|
-
return /* @__PURE__ */
|
|
33
|
+
return /* @__PURE__ */ d("li", { ref: r, role: "separator", className: t, ...o });
|
|
34
34
|
}
|
|
35
35
|
), j = n.forwardRef(
|
|
36
36
|
function({ className: e, children: o, ...r }, t) {
|
|
37
37
|
const i = ["dropdown-header", e ?? ""].filter(Boolean).join(" ");
|
|
38
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ d("li", { ref: t, className: i, ...r, children: o });
|
|
39
39
|
}
|
|
40
40
|
);
|
|
41
41
|
export {
|
|
42
42
|
M as BsDropdownDivider,
|
|
43
43
|
j as BsDropdownHeader,
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
v as BsDropdownItem,
|
|
45
|
+
R as BsDropdownMenu
|
|
46
46
|
};
|
|
@@ -13,7 +13,9 @@ export interface BsDropdownItemProps extends Omit<React.LiHTMLAttributes<HTMLLIE
|
|
|
13
13
|
* light-DOM `<li class="dropdown-item">` that the menu WC styles via its shadow
|
|
14
14
|
* `::slotted(.dropdown-item)` rule. Put the navigable content inside, e.g.
|
|
15
15
|
* `<BsDropdownItem><a href="/x">Action</a></BsDropdownItem>` (the companion
|
|
16
|
-
* stylesheet resets the nested link). The opaque `value` is assigned as
|
|
17
|
-
* property on the `<li>` so the menu can carry it in its `select`
|
|
16
|
+
* stylesheet resets the nested link). The opaque `value` is assigned as the
|
|
17
|
+
* `dropdownValue` property on the `<li>` so the menu can carry it in its `select`
|
|
18
|
+
* event — not as `value`, which `HTMLLIElement` owns as a native long (an object
|
|
19
|
+
* or a string written there becomes 0).
|
|
18
20
|
*/
|
|
19
21
|
export declare const BsDropdownItem: React.ForwardRefExoticComponent<BsDropdownItemProps & React.RefAttributes<HTMLLIElement>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintplayer/react-bootstrap",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.21.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": {
|
|
@@ -150,6 +150,10 @@
|
|
|
150
150
|
"types": "./tab-control/src/index.d.ts",
|
|
151
151
|
"import": "./tab-control/index.mjs"
|
|
152
152
|
},
|
|
153
|
+
"./theming": {
|
|
154
|
+
"types": "./theming/src/index.d.ts",
|
|
155
|
+
"import": "./theming/index.mjs"
|
|
156
|
+
},
|
|
153
157
|
"./tile-manager": {
|
|
154
158
|
"types": "./tile-manager/src/index.d.ts",
|
|
155
159
|
"import": "./tile-manager/index.mjs"
|
|
@@ -179,7 +183,7 @@
|
|
|
179
183
|
"react": "^19.0.0",
|
|
180
184
|
"react-dom": "^19.0.0",
|
|
181
185
|
"@lit/react": "^1.0.0",
|
|
182
|
-
"@mintplayer/web-components": "^2.
|
|
186
|
+
"@mintplayer/web-components": "^2.17.0"
|
|
183
187
|
},
|
|
184
188
|
"dependencies": {
|
|
185
189
|
"tslib": "^2.3.0"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as f from "react";
|
|
2
|
+
import { useSyncExternalStore as c, useMemo as d } from "react";
|
|
3
|
+
import { getBsThemeStore as s, resolveMode as M, MpThemeToggle as T, BS_THEME_DEFAULT_MODES as a } from "@mintplayer/web-components/theming";
|
|
4
|
+
import { BS_THEME_COOKIE_NAME as w, BS_THEME_DEFAULT_MODES as H, BS_THEME_DEFAULT_MODE_META as x, configureBsTheme as R, getBsThemeStore as j, injectThemeAttribute as F, isValidThemeMode as L, readDefaultModeMeta as N, readThemeCookie as U, resolveMode as k, resolveServerTheme as y, writeThemeCookie as V } from "@mintplayer/web-components/theming";
|
|
5
|
+
import { jsx as E } from "react/jsx-runtime";
|
|
6
|
+
import { createComponent as h } from "@lit/react";
|
|
7
|
+
const m = Object.freeze({
|
|
8
|
+
mode: "auto",
|
|
9
|
+
effectiveMode: M("auto", !1)
|
|
10
|
+
}), n = () => typeof window < "u", u = (e) => n() ? s().subscribe(e) : () => {
|
|
11
|
+
};
|
|
12
|
+
let r = m;
|
|
13
|
+
const S = () => {
|
|
14
|
+
if (!n()) return m;
|
|
15
|
+
const e = s(), o = e.getMode(), t = e.effectiveMode();
|
|
16
|
+
return (r.mode !== o || r.effectiveMode !== t) && (r = { mode: o, effectiveMode: t }), r;
|
|
17
|
+
}, g = () => m, p = (e) => {
|
|
18
|
+
n() && s().setMode(e);
|
|
19
|
+
};
|
|
20
|
+
function D() {
|
|
21
|
+
const e = c(u, S, g);
|
|
22
|
+
return d(
|
|
23
|
+
() => ({ mode: e.mode, effectiveMode: e.effectiveMode, setMode: p }),
|
|
24
|
+
[e]
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
const l = h({
|
|
28
|
+
react: f,
|
|
29
|
+
tagName: "mp-theme-toggle",
|
|
30
|
+
elementClass: T
|
|
31
|
+
}), O = f.forwardRef(function({ modes: o, ...t }, i) {
|
|
32
|
+
return /* @__PURE__ */ E(l, { ref: i, modes: o ?? a, ...t });
|
|
33
|
+
});
|
|
34
|
+
export {
|
|
35
|
+
w as BS_THEME_COOKIE_NAME,
|
|
36
|
+
H as BS_THEME_DEFAULT_MODES,
|
|
37
|
+
x as BS_THEME_DEFAULT_MODE_META,
|
|
38
|
+
O as BsThemeToggle,
|
|
39
|
+
R as configureBsTheme,
|
|
40
|
+
j as getBsThemeStore,
|
|
41
|
+
F as injectThemeAttribute,
|
|
42
|
+
L as isValidThemeMode,
|
|
43
|
+
N as readDefaultModeMeta,
|
|
44
|
+
U as readThemeCookie,
|
|
45
|
+
k as resolveMode,
|
|
46
|
+
y as resolveServerTheme,
|
|
47
|
+
D as useBsTheme,
|
|
48
|
+
V as writeThemeCookie
|
|
49
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MpThemeToggle, BsThemeToggleMode } from '@mintplayer/web-components/theming';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export interface BsThemeToggleProps extends React.HTMLAttributes<MpThemeToggle> {
|
|
4
|
+
/**
|
|
5
|
+
* The modes the toggle cycles through, in order. Defaults to
|
|
6
|
+
* `BS_THEME_DEFAULT_MODES` (auto, light, dark). Assigned to the element as a
|
|
7
|
+
* JS property: an array cannot travel as an attribute.
|
|
8
|
+
*/
|
|
9
|
+
modes?: readonly BsThemeToggleMode[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* React wrapper for `<mp-theme-toggle>`, the colour-mode toggle button.
|
|
13
|
+
* Side-effect-registers the WC on import.
|
|
14
|
+
*
|
|
15
|
+
* The toggle talks to the shared theme store itself, so it needs no props to
|
|
16
|
+
* work; read or drive the same state from code with `useBsTheme()`. Any other
|
|
17
|
+
* prop (`aria-label`, `id`, `className`, ...) is forwarded to the element.
|
|
18
|
+
*
|
|
19
|
+
* <BsThemeToggle />
|
|
20
|
+
* <BsThemeToggle modes={[...BS_THEME_DEFAULT_MODES, sepia]} />
|
|
21
|
+
*/
|
|
22
|
+
export declare const BsThemeToggle: React.ForwardRefExoticComponent<BsThemeToggleProps & React.RefAttributes<MpThemeToggle>>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { useBsTheme, type UseBsThemeResult } from './useBsTheme';
|
|
2
|
+
export { BsThemeToggle, type BsThemeToggleProps } from './BsThemeToggle';
|
|
3
|
+
export { BS_THEME_COOKIE_NAME, BS_THEME_DEFAULT_MODE_META, BS_THEME_DEFAULT_MODES, configureBsTheme, getBsThemeStore, injectThemeAttribute, isValidThemeMode, readDefaultModeMeta, readThemeCookie, resolveMode, resolveServerTheme, writeThemeCookie, type BsEffectiveThemeMode, type BsThemeConfig, type BsThemeMode, type BsThemeStore, type BsThemeToggleMode, type ResolveServerThemeOptions, type WriteThemeCookieOptions, } from '@mintplayer/web-components/theming';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BsEffectiveThemeMode, BsThemeMode } from '@mintplayer/web-components/theming';
|
|
2
|
+
export interface UseBsThemeResult {
|
|
3
|
+
/** The mode the user picked: `auto`, `light`, `dark` or a custom mode. */
|
|
4
|
+
mode: BsThemeMode;
|
|
5
|
+
/** The mode applied to `<html data-bs-theme>`: `auto` resolved against the OS preference. */
|
|
6
|
+
effectiveMode: BsEffectiveThemeMode;
|
|
7
|
+
/** Set, persist and apply a mode. An invalid mode is a no-op with a warning; a no-op on the server. */
|
|
8
|
+
setMode: (mode: BsThemeMode) => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The document's colour mode, backed by the shared browser store
|
|
12
|
+
* (`@mintplayer/web-components/theming`). Re-renders when the mode changes
|
|
13
|
+
* from anywhere: this hook, a `<BsThemeToggle>`, another framework's adapter
|
|
14
|
+
* on the same page, another tab, or the OS preference while in `auto`.
|
|
15
|
+
*
|
|
16
|
+
* SSR-safe: on the server the store is never touched and the hook returns
|
|
17
|
+
* the server snapshot documented on `SERVER_SNAPSHOT`.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useBsTheme(): UseBsThemeResult;
|