@molecule/app-ui-react 4.14.0 → 4.15.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/README.md +96 -118
- package/dist/components/Accordion.d.ts +1 -11
- package/dist/components/Accordion.d.ts.map +1 -1
- package/dist/components/Accordion.js +1 -82
- package/dist/components/Accordion.js.map +1 -1
- package/dist/components/Alert.d.ts +1 -25
- package/dist/components/Alert.d.ts.map +1 -1
- package/dist/components/Alert.js +1 -60
- package/dist/components/Alert.js.map +1 -1
- package/dist/components/Avatar.d.ts +1 -11
- package/dist/components/Avatar.d.ts.map +1 -1
- package/dist/components/Avatar.js +1 -28
- package/dist/components/Avatar.js.map +1 -1
- package/dist/components/Checkbox.d.ts +1 -11
- package/dist/components/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox.js +1 -27
- package/dist/components/Checkbox.js.map +1 -1
- package/dist/components/Pagination.d.ts +1 -11
- package/dist/components/Pagination.d.ts.map +1 -1
- package/dist/components/Pagination.js +1 -79
- package/dist/components/Pagination.js.map +1 -1
- package/dist/components/RadioGroup.d.ts +1 -11
- package/dist/components/RadioGroup.d.ts.map +1 -1
- package/dist/components/RadioGroup.js +1 -35
- package/dist/components/RadioGroup.js.map +1 -1
- package/dist/components/Select.d.ts +1 -26
- package/dist/components/Select.d.ts.map +1 -1
- package/dist/components/Select.js +1 -71
- package/dist/components/Select.js.map +1 -1
- package/dist/components/Spinner.d.ts +1 -16
- package/dist/components/Spinner.d.ts.map +1 -1
- package/dist/components/Spinner.js +1 -29
- package/dist/components/Spinner.js.map +1 -1
- package/dist/components/Switch.d.ts +1 -11
- package/dist/components/Switch.d.ts.map +1 -1
- package/dist/components/Switch.js +1 -32
- package/dist/components/Switch.js.map +1 -1
- package/dist/components/Table.d.ts +1 -11
- package/dist/components/Table.d.ts.map +1 -1
- package/dist/components/Table.js +1 -57
- package/dist/components/Table.js.map +1 -1
- package/dist/components/Tabs.d.ts +1 -11
- package/dist/components/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs.js +1 -75
- package/dist/components/Tabs.js.map +1 -1
- package/dist/components/Textarea.d.ts +1 -10
- package/dist/components/Textarea.d.ts.map +1 -1
- package/dist/components/Textarea.js +1 -27
- package/dist/components/Textarea.js.map +1 -1
- package/dist/components/Toast.d.ts +2 -14
- package/dist/components/Toast.d.ts.map +1 -1
- package/dist/components/Toast.js +8 -89
- package/dist/components/Toast.js.map +1 -1
- package/dist/elements/Anchor.d.ts +1 -1
- package/dist/elements/Box.d.ts +1 -15
- package/dist/elements/Box.d.ts.map +1 -1
- package/dist/elements/Box.js +1 -55
- package/dist/elements/Box.js.map +1 -1
- package/dist/elements/CheckField.d.ts +1 -16
- package/dist/elements/CheckField.d.ts.map +1 -1
- package/dist/elements/CheckField.js +1 -52
- package/dist/elements/CheckField.js.map +1 -1
- package/dist/elements/Image.d.ts +1 -16
- package/dist/elements/Image.d.ts.map +1 -1
- package/dist/elements/Image.js +1 -21
- package/dist/elements/Image.js.map +1 -1
- package/dist/elements/Pressable.d.ts +1 -16
- package/dist/elements/Pressable.d.ts.map +1 -1
- package/dist/elements/Pressable.js +1 -41
- package/dist/elements/Pressable.js.map +1 -1
- package/dist/elements/ScrollArea.d.ts +1 -15
- package/dist/elements/ScrollArea.d.ts.map +1 -1
- package/dist/elements/ScrollArea.js +1 -41
- package/dist/elements/ScrollArea.js.map +1 -1
- package/dist/elements/SelectField.d.ts +1 -10
- package/dist/elements/SelectField.d.ts.map +1 -1
- package/dist/elements/SelectField.js +1 -63
- package/dist/elements/SelectField.js.map +1 -1
- package/dist/elements/Svg.d.ts +1 -123
- package/dist/elements/Svg.d.ts.map +1 -1
- package/dist/elements/Svg.js +1 -179
- package/dist/elements/Svg.js.map +1 -1
- package/dist/elements/TableBox.d.ts +1 -15
- package/dist/elements/TableBox.d.ts.map +1 -1
- package/dist/elements/TableBox.js +1 -17
- package/dist/elements/TableBox.js.map +1 -1
- package/dist/elements/TableCell.d.ts +1 -15
- package/dist/elements/TableCell.d.ts.map +1 -1
- package/dist/elements/TableCell.js +1 -17
- package/dist/elements/TableCell.js.map +1 -1
- package/dist/elements/Text.d.ts +1 -18
- package/dist/elements/Text.d.ts.map +1 -1
- package/dist/elements/Text.js +1 -20
- package/dist/elements/Text.js.map +1 -1
- package/dist/elements/TextField.d.ts +1 -17
- package/dist/elements/TextField.d.ts.map +1 -1
- package/dist/elements/TextField.js +1 -104
- package/dist/elements/TextField.js.map +1 -1
- package/dist/elements/drag.d.ts +1 -14
- package/dist/elements/drag.d.ts.map +1 -1
- package/dist/elements/drag.js +1 -27
- package/dist/elements/drag.js.map +1 -1
- package/dist/elements/flow.d.ts +1 -16
- package/dist/elements/flow.d.ts.map +1 -1
- package/dist/elements/flow.js +1 -17
- package/dist/elements/flow.js.map +1 -1
- package/dist/elements/hover.d.ts +1 -9
- package/dist/elements/hover.d.ts.map +1 -1
- package/dist/elements/hover.js +1 -22
- package/dist/elements/hover.js.map +1 -1
- package/dist/elements/measure.d.ts +1 -24
- package/dist/elements/measure.d.ts.map +1 -1
- package/dist/elements/measure.js +1 -19
- package/dist/elements/measure.js.map +1 -1
- package/dist/elements/paste.d.ts +1 -4
- package/dist/elements/paste.d.ts.map +1 -1
- package/dist/elements/paste.js +1 -14
- package/dist/elements/paste.js.map +1 -1
- package/dist/elements/ref.d.ts +1 -15
- package/dist/elements/ref.d.ts.map +1 -1
- package/dist/elements/ref.js +1 -17
- package/dist/elements/ref.js.map +1 -1
- package/dist/elements/style.d.ts +1 -34
- package/dist/elements/style.d.ts.map +1 -1
- package/dist/elements/style.js +1 -50
- package/dist/elements/style.js.map +1 -1
- package/dist/elements/types.d.ts +1 -22
- package/dist/elements/types.d.ts.map +1 -1
- package/dist/elements/types.js +1 -6
- package/dist/elements/types.js.map +1 -1
- package/dist/elements/viewport.d.ts +1 -52
- package/dist/elements/viewport.d.ts.map +1 -1
- package/dist/elements/viewport.js +1 -103
- package/dist/elements/viewport.js.map +1 -1
- package/dist/index.native.d.ts +1 -0
- package/dist/index.native.d.ts.map +1 -1
- package/dist/index.native.js +1 -0
- package/dist/index.native.js.map +1 -1
- package/dist/kit.native.d.ts +12 -0
- package/dist/kit.native.d.ts.map +1 -0
- package/dist/kit.native.js +11 -0
- package/dist/kit.native.js.map +1 -0
- package/dist/kit.web.d.ts +39 -0
- package/dist/kit.web.d.ts.map +1 -0
- package/dist/kit.web.js +34 -0
- package/dist/kit.web.js.map +1 -0
- package/dist/platform/index.d.ts +1 -28
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/index.js +1 -179
- package/dist/platform/index.js.map +1 -1
- package/dist/utilities/initials.d.ts +1 -12
- package/dist/utilities/initials.d.ts.map +1 -1
- package/dist/utilities/initials.js +1 -22
- package/dist/utilities/initials.js.map +1 -1
- package/dist/utilities/isReactNode.d.ts +1 -15
- package/dist/utilities/isReactNode.d.ts.map +1 -1
- package/dist/utilities/isReactNode.js +1 -26
- package/dist/utilities/isReactNode.js.map +1 -1
- package/dist/utilities/mergeRefs.d.ts +1 -19
- package/dist/utilities/mergeRefs.d.ts.map +1 -1
- package/dist/utilities/mergeRefs.js +1 -33
- package/dist/utilities/mergeRefs.js.map +1 -1
- package/dist/utilities/renderIcon.d.ts +3 -17
- package/dist/utilities/renderIcon.d.ts.map +1 -1
- package/dist/utilities/renderIcon.js +6 -31
- package/dist/utilities/renderIcon.js.map +1 -1
- package/dist/utilities/rootProps.d.ts +1 -19
- package/dist/utilities/rootProps.d.ts.map +1 -1
- package/dist/utilities/rootProps.js +1 -18
- package/dist/utilities/rootProps.js.map +1 -1
- package/package.json +16 -8
- package/dist/platform/arrow.d.ts +0 -5
- package/dist/platform/arrow.d.ts.map +0 -1
- package/dist/platform/arrow.js +0 -49
- package/dist/platform/arrow.js.map +0 -1
package/dist/elements/types.d.ts
CHANGED
|
@@ -1,23 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* React types of the renderer-neutral elements' children and refs.
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
|
-
import type { ReactElement, ReactNode, Ref } from 'react';
|
|
7
|
-
import type { ElementHandle } from '@molecule/app-ui';
|
|
8
|
-
/**
|
|
9
|
-
* What an element holds: anything React renders. A native container puts bare text in a `Text`,
|
|
10
|
-
* as the web puts it in an anonymous box, with the text classes the container hands down.
|
|
11
|
-
*/
|
|
12
|
-
export type ElementNode = ReactNode;
|
|
13
|
-
/**
|
|
14
|
-
* What an `Svg` or `G` holds: shapes, groups and `SvgText`. A string is not accepted, because
|
|
15
|
-
* an SVG draws text only inside a text element.
|
|
16
|
-
*/
|
|
17
|
-
export type ShapeNode = ReactElement | null | undefined | false | readonly ShapeNode[];
|
|
18
|
-
/** The `ref` every element takes: the element itself on the web, the host view on native. */
|
|
19
|
-
export interface ElementRefProps {
|
|
20
|
-
/** Receives the rendered element (see {@link ElementHandle}). */
|
|
21
|
-
ref?: Ref<ElementHandle>;
|
|
22
|
-
}
|
|
1
|
+
export * from '@molecule/app-react-ui-kit-components/elements/types.js';
|
|
23
2
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/elements/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/elements/types.ts"],"names":[],"mappings":"AAAA,cAAc,yDAAyD,CAAA"}
|
package/dist/elements/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/elements/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/elements/types.ts"],"names":[],"mappings":"AAAA,cAAc,yDAAyD,CAAA"}
|
|
@@ -1,53 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Window operations for registered browser elements.
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
|
-
import { useEffect } from 'react';
|
|
7
|
-
import type { ElementHandle, ElementViewport, KitFocusEvent } from '@molecule/app-ui';
|
|
8
|
-
/** Runs after committing host refs and before painting. Server rendering has no layout. */
|
|
9
|
-
export declare const useElementLayoutEffect: typeof useEffect;
|
|
10
|
-
/**
|
|
11
|
-
* Identifies the window containing a handle. Browser documents keep their own overlay state.
|
|
12
|
-
*
|
|
13
|
-
* @param handle - The registered element.
|
|
14
|
-
* @returns An opaque identity usable as a weak map key.
|
|
15
|
-
*/
|
|
16
|
-
export declare function elementWindowScope(handle: ElementHandle): object;
|
|
17
|
-
/**
|
|
18
|
-
* Reads the viewport containing an element without consulting the ambient document.
|
|
19
|
-
*
|
|
20
|
-
* @param handle - The registered element.
|
|
21
|
-
* @returns The owning viewport, if mounted.
|
|
22
|
-
*/
|
|
23
|
-
export declare function readElementViewport(handle: ElementHandle): ElementViewport | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Reports the current viewport immediately and coalesces resize and scroll updates per frame.
|
|
26
|
-
*
|
|
27
|
-
* @param handle - The registered element. Scrolls in its document, including nested scrollers, are observed.
|
|
28
|
-
* @param update - Receives the viewport and whether its size may have changed.
|
|
29
|
-
* @returns Unsubscribes and cancels queued measurements.
|
|
30
|
-
*/
|
|
31
|
-
export declare function observeElementViewport(handle: ElementHandle, update: (viewport: ElementViewport, resized: boolean) => void): () => void;
|
|
32
|
-
/**
|
|
33
|
-
* Reads the document portal's positioning origin in the same coordinates as measureElement.
|
|
34
|
-
*
|
|
35
|
-
* @param handle - The positioned surface in the portal.
|
|
36
|
-
* @param _position - The applied absolute position, needed by the native renderer.
|
|
37
|
-
* @param onMeasure - Receives the window coordinates of the positioning origin.
|
|
38
|
-
*/
|
|
39
|
-
export declare function measurePositionedOrigin(handle: ElementHandle, _position: {
|
|
40
|
-
left: number;
|
|
41
|
-
top: number;
|
|
42
|
-
}, onMeasure: (origin: {
|
|
43
|
-
x: number;
|
|
44
|
-
y: number;
|
|
45
|
-
}) => void): void;
|
|
46
|
-
/**
|
|
47
|
-
* Whether focus should reveal supplemental tooltip content.
|
|
48
|
-
*
|
|
49
|
-
* @param event - The focus event from the trigger or one of its children.
|
|
50
|
-
* @returns Whether the browser considers the focused element focus-visible.
|
|
51
|
-
*/
|
|
52
|
-
export declare function isElementFocusVisible(event: KitFocusEvent): boolean;
|
|
1
|
+
export * from '@molecule/app-react-ui-kit-components/elements/viewport.js';
|
|
53
2
|
//# sourceMappingURL=viewport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewport.d.ts","sourceRoot":"","sources":["../../src/elements/viewport.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"viewport.d.ts","sourceRoot":"","sources":["../../src/elements/viewport.ts"],"names":[],"mappings":"AAAA,cAAc,4DAA4D,CAAA"}
|
|
@@ -1,104 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Window operations for registered browser elements.
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
|
-
import { useEffect, useLayoutEffect } from 'react';
|
|
7
|
-
import { domElement } from '@molecule/app-overlay-dom';
|
|
8
|
-
const detachedWindow = {};
|
|
9
|
-
/** Runs after committing host refs and before painting. Server rendering has no layout. */
|
|
10
|
-
export const useElementLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;
|
|
11
|
-
/**
|
|
12
|
-
* Identifies the window containing a handle. Browser documents keep their own overlay state.
|
|
13
|
-
*
|
|
14
|
-
* @param handle - The registered element.
|
|
15
|
-
* @returns An opaque identity usable as a weak map key.
|
|
16
|
-
*/
|
|
17
|
-
export function elementWindowScope(handle) {
|
|
18
|
-
return domElement(handle)?.ownerDocument ?? detachedWindow;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Reads the viewport containing an element without consulting the ambient document.
|
|
22
|
-
*
|
|
23
|
-
* @param handle - The registered element.
|
|
24
|
-
* @returns The owning viewport, if mounted.
|
|
25
|
-
*/
|
|
26
|
-
export function readElementViewport(handle) {
|
|
27
|
-
const doc = domElement(handle)?.ownerDocument;
|
|
28
|
-
const view = doc?.defaultView;
|
|
29
|
-
if (!doc || !view)
|
|
30
|
-
return;
|
|
31
|
-
return {
|
|
32
|
-
width: doc.documentElement.clientWidth,
|
|
33
|
-
height: view.innerHeight,
|
|
34
|
-
contentHeight: doc.documentElement.clientHeight,
|
|
35
|
-
scrollOwner: 'document',
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Reports the current viewport immediately and coalesces resize and scroll updates per frame.
|
|
40
|
-
*
|
|
41
|
-
* @param handle - The registered element. Scrolls in its document, including nested scrollers, are observed.
|
|
42
|
-
* @param update - Receives the viewport and whether its size may have changed.
|
|
43
|
-
* @returns Unsubscribes and cancels queued measurements.
|
|
44
|
-
*/
|
|
45
|
-
export function observeElementViewport(handle, update) {
|
|
46
|
-
const view = domElement(handle)?.ownerDocument.defaultView;
|
|
47
|
-
if (!view)
|
|
48
|
-
return () => undefined;
|
|
49
|
-
let frame;
|
|
50
|
-
let resized = false;
|
|
51
|
-
const read = () => {
|
|
52
|
-
frame = undefined;
|
|
53
|
-
const viewport = readElementViewport(handle);
|
|
54
|
-
const changedSize = resized;
|
|
55
|
-
resized = false;
|
|
56
|
-
if (viewport)
|
|
57
|
-
update(viewport, changedSize);
|
|
58
|
-
};
|
|
59
|
-
const schedule = () => {
|
|
60
|
-
frame ??= view.requestAnimationFrame(read);
|
|
61
|
-
};
|
|
62
|
-
const resize = () => {
|
|
63
|
-
resized = true;
|
|
64
|
-
schedule();
|
|
65
|
-
};
|
|
66
|
-
view.addEventListener('scroll', schedule, { capture: true, passive: true });
|
|
67
|
-
view.addEventListener('resize', resize);
|
|
68
|
-
resized = true;
|
|
69
|
-
read();
|
|
70
|
-
return () => {
|
|
71
|
-
view.removeEventListener('scroll', schedule, true);
|
|
72
|
-
view.removeEventListener('resize', resize);
|
|
73
|
-
if (frame !== undefined)
|
|
74
|
-
view.cancelAnimationFrame(frame);
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Reads the document portal's positioning origin in the same coordinates as measureElement.
|
|
79
|
-
*
|
|
80
|
-
* @param handle - The positioned surface in the portal.
|
|
81
|
-
* @param _position - The applied absolute position, needed by the native renderer.
|
|
82
|
-
* @param onMeasure - Receives the window coordinates of the positioning origin.
|
|
83
|
-
*/
|
|
84
|
-
export function measurePositionedOrigin(handle, _position, onMeasure) {
|
|
85
|
-
const view = domElement(handle)?.ownerDocument.defaultView;
|
|
86
|
-
if (view)
|
|
87
|
-
onMeasure({ x: -view.scrollX, y: -view.scrollY });
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Whether focus should reveal supplemental tooltip content.
|
|
91
|
-
*
|
|
92
|
-
* @param event - The focus event from the trigger or one of its children.
|
|
93
|
-
* @returns Whether the browser considers the focused element focus-visible.
|
|
94
|
-
*/
|
|
95
|
-
export function isElementFocusVisible(event) {
|
|
96
|
-
try {
|
|
97
|
-
return domElement(event.target)?.matches(':focus-visible') ?? false;
|
|
98
|
-
}
|
|
99
|
-
catch (_error) {
|
|
100
|
-
// Older selector engines do not implement :focus-visible. Hover remains available.
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
1
|
+
export * from '@molecule/app-react-ui-kit-components/elements/viewport.js';
|
|
104
2
|
//# sourceMappingURL=viewport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewport.js","sourceRoot":"","sources":["../../src/elements/viewport.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"viewport.js","sourceRoot":"","sources":["../../src/elements/viewport.ts"],"names":[],"mappings":"AAAA,cAAc,4DAA4D,CAAA"}
|
package/dist/index.native.d.ts
CHANGED
|
@@ -4,5 +4,6 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
export { FileField } from './elements/native.js';
|
|
7
|
+
export { Accordion, Alert, Avatar, Checkbox, Pagination, RadioGroup, Select, Spinner, Switch, Table, Tabs, Textarea, } from './kit.native.js';
|
|
7
8
|
export * from './shared.js';
|
|
8
9
|
//# sourceMappingURL=index.native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../src/index.native.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,cAAc,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../src/index.native.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EACL,SAAS,EACT,KAAK,EACL,MAAM,EACN,QAAQ,EACR,UAAU,EACV,UAAU,EACV,MAAM,EACN,OAAO,EACP,MAAM,EACN,KAAK,EACL,IAAI,EACJ,QAAQ,GACT,MAAM,iBAAiB,CAAA;AACxB,cAAc,aAAa,CAAA"}
|
package/dist/index.native.js
CHANGED
|
@@ -4,5 +4,6 @@
|
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
6
|
export { FileField } from './elements/native.js';
|
|
7
|
+
export { Accordion, Alert, Avatar, Checkbox, Pagination, RadioGroup, Select, Spinner, Switch, Table, Tabs, Textarea, } from './kit.native.js';
|
|
7
8
|
export * from './shared.js';
|
|
8
9
|
//# sourceMappingURL=index.native.js.map
|
package/dist/index.native.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","sourceRoot":"","sources":["../src/index.native.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,cAAc,aAAa,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.native.js","sourceRoot":"","sources":["../src/index.native.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EACL,SAAS,EACT,KAAK,EACL,MAAM,EACN,QAAQ,EACR,UAAU,EACV,UAAU,EACV,MAAM,EACN,OAAO,EACP,MAAM,EACN,KAAK,EACL,IAAI,EACJ,QAAQ,GACT,MAAM,iBAAiB,CAAA;AACxB,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Native's binding of the shared component trees.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/** Kit components bound to React Native's elements and the React kit's icon bond. */
|
|
7
|
+
export declare const Accordion: import("@molecule/app-react-ui-kit-components").KitComponent<import("@molecule/app-ui").AccordionProps<string>>, Alert: import("@molecule/app-react-ui-kit-components").KitComponent<import("@molecule/app-ui").AlertProps & {
|
|
8
|
+
live?: boolean;
|
|
9
|
+
}>, Avatar: import("@molecule/app-react-ui-kit-components").KitComponent<import("@molecule/app-ui").AvatarProps>, Checkbox: import("@molecule/app-react-ui-kit-components").KitComponent<import("@molecule/app-ui").CheckboxProps, import("@molecule/app-ui").CheckFieldHandle>, Pagination: import("@molecule/app-react-ui-kit-components").KitComponent<import("@molecule/app-ui").PaginationProps>, RadioGroup: import("@molecule/app-react-ui-kit-components").KitComponent<import("@molecule/app-ui").RadioGroupProps<string>>, Select: import("@molecule/app-react-ui-kit-components").KitComponent<import("@molecule/app-react-ui-kit-components").ReactSelectProps>, Spinner: import("@molecule/app-react-ui-kit-components").KitComponent<import("@molecule/app-ui").SpinnerProps & {
|
|
10
|
+
'data-mol-id'?: string;
|
|
11
|
+
}>, Switch: import("@molecule/app-react-ui-kit-components").KitComponent<import("@molecule/app-ui").SwitchProps>, Table: import("@molecule/app-react-ui-kit-components").KitComponent<import("@molecule/app-ui").TableProps<Record<string, unknown>>>, Tabs: import("@molecule/app-react-ui-kit-components").KitComponent<import("@molecule/app-ui").TabsProps<string>>, Textarea: import("@molecule/app-react-ui-kit-components").KitComponent<import("@molecule/app-ui").TextareaProps>, Toast: import("react").NamedExoticComponent<import("@molecule/app-ui").ToastProps & import("react").RefAttributes<import("@molecule/app-ui").ElementHandle>>;
|
|
12
|
+
//# sourceMappingURL=kit.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit.native.d.ts","sourceRoot":"","sources":["../src/kit.native.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,qFAAqF;AACrF,eAAO,MACL,SAAS,mHACT,KAAK;;IACL,MAAM,wGACN,QAAQ,uJACR,UAAU,4GACV,UAAU,oHACV,MAAM,kIACN,OAAO;;IACP,MAAM,wGACN,KAAK,gIACL,IAAI,8GACJ,QAAQ,0GACR,KAAK,uJACyC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Native's binding of the shared component trees.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { createKit } from '@molecule/app-react-ui-kit-components';
|
|
7
|
+
import { nativeKitHosts } from '@molecule/app-ui-react-native/kit-hosts';
|
|
8
|
+
import { renderIcon } from './utilities/renderIcon.js';
|
|
9
|
+
/** Kit components bound to React Native's elements and the React kit's icon bond. */
|
|
10
|
+
export const { Accordion, Alert, Avatar, Checkbox, Pagination, RadioGroup, Select, Spinner, Switch, Table, Tabs, Textarea, Toast, } = createKit({ ...nativeKitHosts, renderIcon });
|
|
11
|
+
//# sourceMappingURL=kit.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit.native.js","sourceRoot":"","sources":["../src/kit.native.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAA;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAA;AAExE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAEtD,qFAAqF;AACrF,MAAM,CAAC,MAAM,EACX,SAAS,EACT,KAAK,EACL,MAAM,EACN,QAAQ,EACR,UAAU,EACV,UAAU,EACV,MAAM,EACN,OAAO,EACP,MAAM,EACN,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,KAAK,GACN,GAAG,SAAS,CAAC,EAAE,GAAG,cAAc,EAAE,UAAU,EAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React DOM's binding of the shared component trees.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import type { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
7
|
+
import type { ReactSelectProps } from '@molecule/app-react-ui-kit-components';
|
|
8
|
+
import type { AccordionProps, AlertProps, AvatarProps, CheckboxProps, PaginationProps, RadioGroupProps, SpinnerProps, SwitchProps, TableProps, TabsProps, TextareaProps } from '@molecule/app-ui';
|
|
9
|
+
/** Accordion with its browser root ref. */
|
|
10
|
+
export declare const Accordion: ForwardRefExoticComponent<AccordionProps & RefAttributes<HTMLDivElement>>;
|
|
11
|
+
/** Alert with its browser root ref. */
|
|
12
|
+
export declare const Alert: ForwardRefExoticComponent<AlertProps & {
|
|
13
|
+
live?: boolean;
|
|
14
|
+
} & RefAttributes<HTMLDivElement>>;
|
|
15
|
+
/** Avatar with its browser root ref. */
|
|
16
|
+
export declare const Avatar: ForwardRefExoticComponent<AvatarProps & RefAttributes<HTMLDivElement>>;
|
|
17
|
+
/** Checkbox with its browser input ref. */
|
|
18
|
+
export declare const Checkbox: ForwardRefExoticComponent<CheckboxProps & RefAttributes<HTMLInputElement>>;
|
|
19
|
+
/** Pagination with its navigation element ref. */
|
|
20
|
+
export declare const Pagination: ForwardRefExoticComponent<PaginationProps & RefAttributes<HTMLElement>>;
|
|
21
|
+
/** Radio group with its browser root ref. */
|
|
22
|
+
export declare const RadioGroup: ForwardRefExoticComponent<RadioGroupProps & RefAttributes<HTMLDivElement>>;
|
|
23
|
+
/** Select with its browser select element ref. */
|
|
24
|
+
export declare const Select: ForwardRefExoticComponent<ReactSelectProps & RefAttributes<HTMLSelectElement>>;
|
|
25
|
+
/** Loading indicator with its browser root ref. */
|
|
26
|
+
export declare const Spinner: ForwardRefExoticComponent<SpinnerProps & {
|
|
27
|
+
'data-mol-id'?: string;
|
|
28
|
+
} & RefAttributes<HTMLDivElement>>;
|
|
29
|
+
/** Switch with its browser button ref. */
|
|
30
|
+
export declare const Switch: ForwardRefExoticComponent<SwitchProps & RefAttributes<HTMLButtonElement>>;
|
|
31
|
+
/** Data table with its browser table element ref. */
|
|
32
|
+
export declare const Table: ForwardRefExoticComponent<TableProps<Record<string, unknown>> & RefAttributes<HTMLTableElement>>;
|
|
33
|
+
/** Tabs with their browser root ref. */
|
|
34
|
+
export declare const Tabs: ForwardRefExoticComponent<TabsProps & RefAttributes<HTMLDivElement>>;
|
|
35
|
+
/** Textarea with its browser textarea element ref. */
|
|
36
|
+
export declare const Textarea: ForwardRefExoticComponent<TextareaProps & RefAttributes<HTMLTextAreaElement>>;
|
|
37
|
+
/** The shared notification tree. */
|
|
38
|
+
export declare const Toast: import("react").NamedExoticComponent<import("@molecule/app-ui").ToastProps & RefAttributes<import("@molecule/app-ui").ElementHandle>>;
|
|
39
|
+
//# sourceMappingURL=kit.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit.web.d.ts","sourceRoot":"","sources":["../src/kit.web.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,yBAAyB,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAErE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAA;AAE7E,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,WAAW,EACX,aAAa,EACb,eAAe,EACf,eAAe,EACf,YAAY,EACZ,WAAW,EACX,UAAU,EACV,SAAS,EACT,aAAa,EACd,MAAM,kBAAkB,CAAA;AAIzB,2CAA2C;AAC3C,eAAO,MAAM,SAAS,EAAE,yBAAyB,CAAC,cAAc,GAAG,aAAa,CAAC,cAAc,CAAC,CACjF,CAAA;AACf,uCAAuC;AACvC,eAAO,MAAM,KAAK,EAAE,yBAAyB,CAC3C,UAAU,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,aAAa,CAAC,cAAc,CAAC,CACpD,CAAA;AACb,wCAAwC;AACxC,eAAO,MAAM,MAAM,EAAE,yBAAyB,CAAC,WAAW,GAAG,aAAa,CAAC,cAAc,CAAC,CAC9E,CAAA;AACZ,2CAA2C;AAC3C,eAAO,MAAM,QAAQ,EAAE,yBAAyB,CAAC,aAAa,GAAG,aAAa,CAAC,gBAAgB,CAAC,CAClF,CAAA;AACd,kDAAkD;AAClD,eAAO,MAAM,UAAU,EAAE,yBAAyB,CAAC,eAAe,GAAG,aAAa,CAAC,WAAW,CAAC,CAC/E,CAAA;AAChB,6CAA6C;AAC7C,eAAO,MAAM,UAAU,EAAE,yBAAyB,CAChD,eAAe,GAAG,aAAa,CAAC,cAAc,CAAC,CAC/B,CAAA;AAClB,kDAAkD;AAClD,eAAO,MAAM,MAAM,EAAE,yBAAyB,CAC5C,gBAAgB,GAAG,aAAa,CAAC,iBAAiB,CAAC,CACvC,CAAA;AACd,mDAAmD;AACnD,eAAO,MAAM,OAAO,EAAE,yBAAyB,CAC7C,YAAY,GAAG;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,aAAa,CAAC,cAAc,CAAC,CAC5D,CAAA;AACf,0CAA0C;AAC1C,eAAO,MAAM,MAAM,EAAE,yBAAyB,CAAC,WAAW,GAAG,aAAa,CAAC,iBAAiB,CAAC,CACjF,CAAA;AACZ,qDAAqD;AACrD,eAAO,MAAM,KAAK,EAAE,yBAAyB,CAC3C,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,aAAa,CAAC,gBAAgB,CAAC,CAC1D,CAAA;AACb,wCAAwC;AACxC,eAAO,MAAM,IAAI,EAAE,yBAAyB,CAAC,SAAS,GAAG,aAAa,CAAC,cAAc,CAAC,CAAY,CAAA;AAClG,sDAAsD;AACtD,eAAO,MAAM,QAAQ,EAAE,yBAAyB,CAC9C,aAAa,GAAG,aAAa,CAAC,mBAAmB,CAAC,CACpC,CAAA;AAChB,oCAAoC;AACpC,eAAO,MAAM,KAAK,uIAAY,CAAA"}
|
package/dist/kit.web.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React DOM's binding of the shared component trees.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { createDomKit } from '@molecule/app-react-ui-kit-components/dom';
|
|
7
|
+
const kit = createDomKit();
|
|
8
|
+
/** Accordion with its browser root ref. */
|
|
9
|
+
export const Accordion = kit.Accordion;
|
|
10
|
+
/** Alert with its browser root ref. */
|
|
11
|
+
export const Alert = kit.Alert;
|
|
12
|
+
/** Avatar with its browser root ref. */
|
|
13
|
+
export const Avatar = kit.Avatar;
|
|
14
|
+
/** Checkbox with its browser input ref. */
|
|
15
|
+
export const Checkbox = kit.Checkbox;
|
|
16
|
+
/** Pagination with its navigation element ref. */
|
|
17
|
+
export const Pagination = kit.Pagination;
|
|
18
|
+
/** Radio group with its browser root ref. */
|
|
19
|
+
export const RadioGroup = kit.RadioGroup;
|
|
20
|
+
/** Select with its browser select element ref. */
|
|
21
|
+
export const Select = kit.Select;
|
|
22
|
+
/** Loading indicator with its browser root ref. */
|
|
23
|
+
export const Spinner = kit.Spinner;
|
|
24
|
+
/** Switch with its browser button ref. */
|
|
25
|
+
export const Switch = kit.Switch;
|
|
26
|
+
/** Data table with its browser table element ref. */
|
|
27
|
+
export const Table = kit.Table;
|
|
28
|
+
/** Tabs with their browser root ref. */
|
|
29
|
+
export const Tabs = kit.Tabs;
|
|
30
|
+
/** Textarea with its browser textarea element ref. */
|
|
31
|
+
export const Textarea = kit.Textarea;
|
|
32
|
+
/** The shared notification tree. */
|
|
33
|
+
export const Toast = kit.Toast;
|
|
34
|
+
//# sourceMappingURL=kit.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kit.web.js","sourceRoot":"","sources":["../src/kit.web.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAA;AAexE,MAAM,GAAG,GAAG,YAAY,EAAE,CAAA;AAE1B,2CAA2C;AAC3C,MAAM,CAAC,MAAM,SAAS,GACpB,GAAG,CAAC,SAAS,CAAA;AACf,uCAAuC;AACvC,MAAM,CAAC,MAAM,KAAK,GAEd,GAAG,CAAC,KAAK,CAAA;AACb,wCAAwC;AACxC,MAAM,CAAC,MAAM,MAAM,GACjB,GAAG,CAAC,MAAM,CAAA;AACZ,2CAA2C;AAC3C,MAAM,CAAC,MAAM,QAAQ,GACnB,GAAG,CAAC,QAAQ,CAAA;AACd,kDAAkD;AAClD,MAAM,CAAC,MAAM,UAAU,GACrB,GAAG,CAAC,UAAU,CAAA;AAChB,6CAA6C;AAC7C,MAAM,CAAC,MAAM,UAAU,GAEnB,GAAG,CAAC,UAAU,CAAA;AAClB,kDAAkD;AAClD,MAAM,CAAC,MAAM,MAAM,GAEf,GAAG,CAAC,MAAM,CAAA;AACd,mDAAmD;AACnD,MAAM,CAAC,MAAM,OAAO,GAEhB,GAAG,CAAC,OAAO,CAAA;AACf,0CAA0C;AAC1C,MAAM,CAAC,MAAM,MAAM,GACjB,GAAG,CAAC,MAAM,CAAA;AACZ,qDAAqD;AACrD,MAAM,CAAC,MAAM,KAAK,GAEd,GAAG,CAAC,KAAK,CAAA;AACb,wCAAwC;AACxC,MAAM,CAAC,MAAM,IAAI,GAAyE,GAAG,CAAC,IAAI,CAAA;AAClG,sDAAsD;AACtD,MAAM,CAAC,MAAM,QAAQ,GAEjB,GAAG,CAAC,QAAQ,CAAA;AAChB,oCAAoC;AACpC,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAA"}
|
package/dist/platform/index.d.ts
CHANGED
|
@@ -1,29 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* React DOM implementation of the renderer-neutral overlay platform.
|
|
3
|
-
* @module
|
|
4
|
-
*/
|
|
5
|
-
import type { OverlayPlatform, ToastMessageProps } from '@molecule/app-react/overlay';
|
|
6
|
-
import type { ElementHandle } from '@molecule/app-ui';
|
|
7
|
-
export { OverlayArrow } from './arrow.js';
|
|
8
|
-
export { focusStaysWithin } from '@molecule/app-overlay-dom';
|
|
9
|
-
export type * from '@molecule/app-react/overlay';
|
|
10
|
-
export type { OverlayAnchorGeometry, OverlayDismissReason, OverlayFocusOptions, OverlayLayerKind, OverlayLayerOptions, OverlayTarget, } from '@molecule/app-ui';
|
|
11
|
-
/** A host sets document ownership without introducing a DOM element. */
|
|
12
|
-
export declare const OverlayHost: OverlayPlatform['OverlayHost'];
|
|
13
|
-
/** Registers the layer's stable identity and publishes the options from each commit. */
|
|
14
|
-
export declare const useOverlayLayer: OverlayPlatform['useOverlayLayer'];
|
|
15
|
-
/** Renders into the owner document's body while retaining the declaring React context. */
|
|
16
|
-
export declare const OverlayPortal: OverlayPlatform['OverlayPortal'];
|
|
17
|
-
/** The same presentation div handles a backdrop click and contains clicks on its children. */
|
|
18
|
-
export declare const OverlayBackdrop: OverlayPlatform['OverlayBackdrop'];
|
|
19
|
-
/** Evaluates CSS media queries in the host's window, with numeric queries in CSS pixels. */
|
|
20
|
-
export declare const useViewportMatch: OverlayPlatform['useViewportMatch'];
|
|
21
|
-
/** Listens for actual browser history traversal, including traversal to an identical URL. */
|
|
22
|
-
export declare const useHistoryPop: OverlayPlatform['useHistoryPop'];
|
|
23
|
-
/** Measures a Tooltip before paint and defers Dropdown coordinates to its next frame. */
|
|
24
|
-
export declare const useAnchoredPosition: OverlayPlatform['useAnchoredPosition'];
|
|
25
|
-
/** Web assistive technology reads the toast's existing role and live attributes. */
|
|
26
|
-
export declare const ToastMessage: import("react").ForwardRefExoticComponent<Omit<ToastMessageProps, "ref"> & import("react").RefAttributes<ElementHandle>>;
|
|
27
|
-
/** Web descriptions are attached to the trigger while the visible tooltip exists. */
|
|
28
|
-
export declare const useTooltipDescription: OverlayPlatform['useTooltipDescription'];
|
|
1
|
+
export * from '@molecule/app-react-ui-kit-components/platform';
|
|
29
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/platform/index.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/platform/index.tsx"],"names":[],"mappings":"AAAA,cAAc,gDAAgD,CAAA"}
|
package/dist/platform/index.js
CHANGED
|
@@ -1,180 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* React DOM implementation of the renderer-neutral overlay platform.
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
|
-
import { createContext, forwardRef, useContext, useEffect, useState, useSyncExternalStore, } from 'react';
|
|
7
|
-
import { createPortal } from 'react-dom';
|
|
8
|
-
import { domElement, measureOverlayPosition, OverlayLayer as DomOverlayLayer, readOverlayAnchorWidth, } from '@molecule/app-overlay-dom';
|
|
9
|
-
import { Box } from '../elements/Box.js';
|
|
10
|
-
import { useElementLayoutEffect } from '../elements/viewport.js';
|
|
11
|
-
export { OverlayArrow } from './arrow.js';
|
|
12
|
-
export { focusStaysWithin } from '@molecule/app-overlay-dom';
|
|
13
|
-
const Owner = createContext(undefined);
|
|
14
|
-
const Parent = createContext(undefined);
|
|
15
|
-
/** The viewport and portal document belonging to a layer or host. */
|
|
16
|
-
function ownerDocument(anchor, owner) {
|
|
17
|
-
return domElement(anchor?.current)?.ownerDocument ?? domElement(owner?.current)?.ownerDocument;
|
|
18
|
-
}
|
|
19
|
-
/** The legacy document used by standalone components. */
|
|
20
|
-
function ambientDocument() {
|
|
21
|
-
return typeof document === 'undefined' ? undefined : document;
|
|
22
|
-
}
|
|
23
|
-
/** Retains the owner document and committed options for an overlay token. */
|
|
24
|
-
class Registration {
|
|
25
|
-
options;
|
|
26
|
-
parent;
|
|
27
|
-
layer = new DomOverlayLayer();
|
|
28
|
-
listeners = new Set();
|
|
29
|
-
portalDocument;
|
|
30
|
-
constructor(options, parent, owner) {
|
|
31
|
-
this.options = options;
|
|
32
|
-
this.parent = parent;
|
|
33
|
-
this.portalDocument = ownerDocument(options.anchor, owner);
|
|
34
|
-
if (!options.anchor && !owner)
|
|
35
|
-
this.portalDocument ??= ambientDocument();
|
|
36
|
-
}
|
|
37
|
-
subscribe = (listener) => {
|
|
38
|
-
this.listeners.add(listener);
|
|
39
|
-
return () => this.listeners.delete(listener);
|
|
40
|
-
};
|
|
41
|
-
document = () => this.portalDocument;
|
|
42
|
-
/** Applies each commit while keeping a still-open layer's original stack position. */
|
|
43
|
-
update(options, parent, owner) {
|
|
44
|
-
this.options = options;
|
|
45
|
-
this.parent = parent;
|
|
46
|
-
const next = ownerDocument(options.anchor, owner) ?? ambientDocument();
|
|
47
|
-
if (this.portalDocument !== next) {
|
|
48
|
-
this.portalDocument = next;
|
|
49
|
-
for (const listener of this.listeners)
|
|
50
|
-
listener();
|
|
51
|
-
}
|
|
52
|
-
this.syncSurface();
|
|
53
|
-
}
|
|
54
|
-
/** Registers once the portal's surface exists in its real document. */
|
|
55
|
-
syncSurface() {
|
|
56
|
-
this.layer.sync(this.options, this.parent);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
const registrations = new WeakMap();
|
|
60
|
-
/** Resolves a layer token issued by this renderer. */
|
|
61
|
-
function registration(layer) {
|
|
62
|
-
const entry = registrations.get(layer);
|
|
63
|
-
if (!entry)
|
|
64
|
-
throw new Error('OverlayPortal and OverlayBackdrop require a layer from useOverlayLayer');
|
|
65
|
-
return entry;
|
|
66
|
-
}
|
|
67
|
-
/** A host sets document ownership without introducing a DOM element. */
|
|
68
|
-
export const OverlayHost = ({ children, owner }) => {
|
|
69
|
-
const inherited = useContext(Owner);
|
|
70
|
-
return _jsx(Owner.Provider, { value: owner ?? inherited, children: children });
|
|
71
|
-
};
|
|
72
|
-
/** Registers the layer's stable identity and publishes the options from each commit. */
|
|
73
|
-
export const useOverlayLayer = (options) => {
|
|
74
|
-
const owner = useContext(Owner);
|
|
75
|
-
const parent = useContext(Parent);
|
|
76
|
-
const [layer] = useState(() => {
|
|
77
|
-
const token = { token: Symbol() };
|
|
78
|
-
registrations.set(token, new Registration(options, parent, owner));
|
|
79
|
-
return token;
|
|
80
|
-
});
|
|
81
|
-
const entry = registration(layer);
|
|
82
|
-
useEffect(() => entry.update(options, parent, owner));
|
|
83
|
-
useEffect(() => () => entry.layer.release(), [entry]);
|
|
84
|
-
return layer;
|
|
85
|
-
};
|
|
86
|
-
/** An SSR render has no portal destination, even during hydration. */
|
|
87
|
-
function serverDocument() {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
/** Renders into the owner document's body while retaining the declaring React context. */
|
|
91
|
-
export const OverlayPortal = ({ layer, presentation, server, children, }) => {
|
|
92
|
-
const entry = registration(layer);
|
|
93
|
-
const doc = useSyncExternalStore(entry.subscribe, entry.document, serverDocument);
|
|
94
|
-
useEffect(() => entry.syncSurface());
|
|
95
|
-
const content = _jsx(Parent.Provider, { value: entry.layer, children: children });
|
|
96
|
-
if (doc === null)
|
|
97
|
-
return server === 'inline' ? content : null;
|
|
98
|
-
if (presentation === 'inline')
|
|
99
|
-
return content;
|
|
100
|
-
return doc?.body ? createPortal(content, doc.body) : null;
|
|
101
|
-
};
|
|
102
|
-
/** The same presentation div handles a backdrop click and contains clicks on its children. */
|
|
103
|
-
export const OverlayBackdrop = ({ layer, ...props }) => (_jsx(Box, { as: "div", ...props, onClick: (event) => {
|
|
104
|
-
if (event.target === event.currentTarget)
|
|
105
|
-
registration(layer).layer.dismissBackdrop();
|
|
106
|
-
else
|
|
107
|
-
event.stopPropagation();
|
|
108
|
-
} }));
|
|
109
|
-
/** Reads media queries from the owner's window or the standalone document. */
|
|
110
|
-
function mediaQuery(owner, query) {
|
|
111
|
-
const view = ownerDocument(undefined, owner)?.defaultView ?? ambientDocument()?.defaultView;
|
|
112
|
-
return typeof view?.matchMedia === 'function' ? view.matchMedia(query) : undefined;
|
|
113
|
-
}
|
|
114
|
-
/** Evaluates CSS media queries in the host's window, with numeric queries in CSS pixels. */
|
|
115
|
-
export const useViewportMatch = (query) => {
|
|
116
|
-
const owner = useContext(Owner);
|
|
117
|
-
const css = typeof query === 'number' ? `(min-width: ${query}px)` : query;
|
|
118
|
-
const [matches, setMatches] = useState(() => mediaQuery(owner, css)?.matches ?? false);
|
|
119
|
-
useEffect(() => {
|
|
120
|
-
const mq = mediaQuery(owner, css);
|
|
121
|
-
setMatches(mq?.matches ?? false);
|
|
122
|
-
if (!mq)
|
|
123
|
-
return;
|
|
124
|
-
const onChange = (event) => setMatches(event.matches);
|
|
125
|
-
mq.addEventListener('change', onChange);
|
|
126
|
-
return () => mq.removeEventListener('change', onChange);
|
|
127
|
-
}, [owner, css]);
|
|
128
|
-
return matches;
|
|
129
|
-
};
|
|
130
|
-
/** Listens for actual browser history traversal, including traversal to an identical URL. */
|
|
131
|
-
export const useHistoryPop = (onPop, target) => {
|
|
132
|
-
const owner = useContext(Owner);
|
|
133
|
-
useEffect(() => {
|
|
134
|
-
const view = (ownerDocument(target, owner) ?? ambientDocument())?.defaultView;
|
|
135
|
-
view?.addEventListener('popstate', onPop);
|
|
136
|
-
return () => view?.removeEventListener('popstate', onPop);
|
|
137
|
-
}, [onPop, owner, target]);
|
|
138
|
-
};
|
|
139
|
-
/** Measures a Tooltip before paint and defers Dropdown coordinates to its next frame. */
|
|
140
|
-
export const useAnchoredPosition = ({ open, anchor, surface, placement, align, offset, padding, collision, timing, matchAnchorWidth, contentKey, }) => {
|
|
141
|
-
const [sample, setSample] = useState();
|
|
142
|
-
const [anchorWidth, setAnchorWidth] = useState();
|
|
143
|
-
useElementLayoutEffect(() => {
|
|
144
|
-
const trigger = domElement(anchor.current);
|
|
145
|
-
setAnchorWidth(open && matchAnchorWidth && trigger ? readOverlayAnchorWidth(trigger) : undefined);
|
|
146
|
-
});
|
|
147
|
-
useElementLayoutEffect(() => {
|
|
148
|
-
const trigger = domElement(anchor.current);
|
|
149
|
-
const panel = domElement(surface);
|
|
150
|
-
const view = trigger?.ownerDocument.defaultView;
|
|
151
|
-
if (!open || !trigger || !panel || !surface || !view)
|
|
152
|
-
return;
|
|
153
|
-
const measure = () => {
|
|
154
|
-
const position = measureOverlayPosition(trigger, panel, {
|
|
155
|
-
placement,
|
|
156
|
-
align,
|
|
157
|
-
offset,
|
|
158
|
-
padding,
|
|
159
|
-
collision,
|
|
160
|
-
});
|
|
161
|
-
setSample({ surface, position: { ...position, ready: true } });
|
|
162
|
-
};
|
|
163
|
-
if (timing === 'layout') {
|
|
164
|
-
measure();
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
const frame = view.requestAnimationFrame(measure);
|
|
168
|
-
return () => view.cancelAnimationFrame(frame);
|
|
169
|
-
}, [open, anchor, surface, placement, align, offset, padding, collision, timing, contentKey]);
|
|
170
|
-
return open && sample && sample.surface === surface
|
|
171
|
-
? { ...sample.position, anchorWidth }
|
|
172
|
-
: { top: 0, left: 0, placement, ready: open, anchorWidth };
|
|
173
|
-
};
|
|
174
|
-
/** Web assistive technology reads the toast's existing role and live attributes. */
|
|
175
|
-
export const ToastMessage = forwardRef(function ToastMessage({ spokenContent: _spokenContent, ...props }, ref) {
|
|
176
|
-
return _jsx(Box, { as: "div", ...props, ref: ref });
|
|
177
|
-
});
|
|
178
|
-
/** Web descriptions are attached to the trigger while the visible tooltip exists. */
|
|
179
|
-
export const useTooltipDescription = () => false;
|
|
1
|
+
export * from '@molecule/app-react-ui-kit-components/platform';
|
|
180
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platform/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platform/index.tsx"],"names":[],"mappings":"AAAA,cAAc,gDAAgD,CAAA"}
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Initials derivation for avatar fallbacks.
|
|
3
|
-
*
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Compute up-to-two-letter initials from a display name or email.
|
|
8
|
-
*
|
|
9
|
-
* @param value - The name or email to derive initials from.
|
|
10
|
-
* @returns The uppercased initials, or `'?'` when no usable input is given.
|
|
11
|
-
*/
|
|
12
|
-
export declare function getInitials(value: string | null | undefined): string;
|
|
1
|
+
export { getInitials } from '@molecule/app-react-ui-kit-components/helpers';
|
|
13
2
|
//# sourceMappingURL=initials.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initials.d.ts","sourceRoot":"","sources":["../../src/utilities/initials.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"initials.d.ts","sourceRoot":"","sources":["../../src/utilities/initials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAA"}
|