@brightlocal/ui-components 2.25.0 → 2.26.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.
@@ -1,99 +0,0 @@
1
- import "./browser-tokens.css";
2
-
3
- import * as React from "react";
4
- import * as ReactDOM from "react-dom";
5
- import { createRoot, type Root } from "react-dom/client";
6
- import * as allExports from "./index";
7
-
8
- // Re-export everything from the barrel
9
- export * from "./index";
10
-
11
- export { React, ReactDOM };
12
-
13
- export const h = React.createElement;
14
- export const useState = React.useState;
15
- export const useEffect = React.useEffect;
16
- export const useMemo = React.useMemo;
17
- export const useCallback = React.useCallback;
18
- export const useRef = React.useRef;
19
- export const useContext = React.useContext;
20
- export const useReducer = React.useReducer;
21
- export const useLayoutEffect = React.useLayoutEffect;
22
- export const Fragment = React.Fragment;
23
-
24
- // --- Build metadata ---
25
- // Injected by vite.config.browser.ts at build time. Lets consumers read
26
- // window.BrightLocalDS.version to verify which release a bundle was built from.
27
- declare const __DS_VERSION__: string;
28
- declare const __DS_BUILD_TIME__: string;
29
- export const version =
30
- typeof __DS_VERSION__ === "string" ? __DS_VERSION__ : "0.0.0-dev";
31
- export const buildTime =
32
- typeof __DS_BUILD_TIME__ === "string" ? __DS_BUILD_TIME__ : "";
33
-
34
- // --- Mount API for IIFE consumers ---
35
-
36
- const roots = new WeakMap<HTMLElement, Root>();
37
-
38
- const PASCAL_CASE = /^[A-Z][a-zA-Z0-9]+$/;
39
-
40
- function isComponent(
41
- key: string,
42
- value: unknown
43
- ): value is React.ComponentType<Record<string, unknown>> {
44
- if (!PASCAL_CASE.test(key)) return false;
45
- if (typeof value === "function") return true;
46
- if (typeof value === "object" && value !== null && "$$typeof" in value)
47
- return true;
48
- return false;
49
- }
50
-
51
- export function mount(
52
- name: string,
53
- container: HTMLElement,
54
- props: Record<string, unknown> = {}
55
- ): () => void {
56
- const Component = (allExports as Record<string, unknown>)[name] as
57
- | React.ComponentType<Record<string, unknown>>
58
- | undefined;
59
-
60
- if (!Component || !isComponent(name, Component)) {
61
- const available = Object.keys(allExports)
62
- .filter((k) => isComponent(k, (allExports as Record<string, unknown>)[k]))
63
- .join(", ");
64
- throw new Error(
65
- `BrightLocalDS: Unknown component "${name}". Available: ${available}`
66
- );
67
- }
68
-
69
- let root = roots.get(container);
70
- if (!root) {
71
- root = createRoot(container);
72
- roots.set(container, root);
73
- }
74
-
75
- root.render(React.createElement(Component, props));
76
-
77
- return () => {
78
- root!.unmount();
79
- roots.delete(container);
80
- };
81
- }
82
-
83
- export function render(
84
- element: React.ReactNode,
85
- container: HTMLElement
86
- ): () => void {
87
- let root = roots.get(container);
88
- if (!root) {
89
- root = createRoot(container);
90
- roots.set(container, root);
91
- }
92
-
93
- root.render(element);
94
-
95
- return () => {
96
- root!.unmount();
97
- roots.delete(container);
98
- };
99
- }
@@ -1 +0,0 @@
1
- @import "../../../packages/tokens/src/styles/tailwind-preset.css";