@brightlocal/ui-components 2.24.1 → 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.
- package/README.md +3 -2
- package/component-meta.json +331 -91
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.js +2 -2
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.js +17 -17
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts +23 -9
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +95 -87
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +9 -9
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +43 -46
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.js +14 -14
- package/dist/brand-illustration-motif.cjs +1 -1
- package/dist/brand-illustration-motif.js +11 -11
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/button.cjs +1 -1
- package/dist/button.js +10 -10
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.js +12 -12
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +7 -7
- package/dist/chip.cjs +1 -1
- package/dist/chip.js +7 -7
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +1 -1
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +46 -1
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +8 -1
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +61 -61
- package/dist/field.cjs +1 -1
- package/dist/field.js +1 -1
- package/dist/height-transition.cjs +1 -0
- package/dist/height-transition.d.ts +44 -0
- package/dist/height-transition.d.ts.map +1 -0
- package/dist/height-transition.js +63 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +326 -324
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +2 -2
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.js +15 -15
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +1 -1
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/lib/motion.cjs +1 -0
- package/dist/lib/motion.d.ts +70 -0
- package/dist/lib/motion.d.ts.map +1 -0
- package/dist/lib/motion.js +25 -0
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +12 -4
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts +6 -5
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +69 -94
- package/dist/list.cjs +1 -1
- package/dist/list.js +10 -10
- package/dist/loading.cjs +1 -1
- package/dist/loading.d.ts.map +1 -1
- package/dist/loading.js +45 -47
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +2 -2
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.js +5 -5
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.js +13 -13
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.js +1 -1
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +21 -25
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +12 -12
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.js +11 -11
- package/dist/select.cjs +1 -1
- package/dist/select.js +12 -12
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +54 -50
- package/dist/slider.cjs +1 -1
- package/dist/slider.js +13 -13
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.js +4 -4
- package/dist/switch.cjs +1 -1
- package/dist/switch.js +5 -5
- package/dist/table.cjs +1 -1
- package/dist/table.js +2 -2
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-reveal-motion.cjs +1 -1
- package/dist/text-reveal-motion.d.ts.map +1 -1
- package/dist/text-reveal-motion.js +77 -79
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +11 -11
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +5 -5
- package/package.json +10 -4
- package/src/blocks/input-list.tsx +3 -6
- package/src/blocks/sidebar.tsx +14 -14
- package/src/components/accordion.tsx +2 -2
- package/src/components/alert-dialog.tsx +2 -2
- package/src/components/alert.tsx +68 -33
- package/src/components/badge.tsx +1 -1
- package/src/components/brand-illustration-motif.tsx +1 -1
- package/src/components/breadcrumb.tsx +1 -1
- package/src/components/button.tsx +2 -2
- package/src/components/card.tsx +1 -1
- package/src/components/carousel.tsx +1 -1
- package/src/components/checkbox.tsx +1 -1
- package/src/components/chip.tsx +2 -2
- package/src/components/combobox.tsx +1 -1
- package/src/components/data-table.tsx +54 -2
- package/src/components/dialog.tsx +3 -3
- package/src/components/field.tsx +1 -1
- package/src/components/height-transition.tsx +164 -0
- package/src/components/input-chip.tsx +2 -2
- package/src/components/input-group.tsx +2 -2
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input.tsx +1 -1
- package/src/components/link.tsx +59 -67
- package/src/components/list.tsx +1 -1
- package/src/components/loading.tsx +2 -15
- package/src/components/map.tsx +3 -2
- package/src/components/menubar.tsx +5 -5
- package/src/components/navigation-menu.tsx +6 -6
- package/src/components/pagination.tsx +1 -1
- package/src/components/progress.tsx +2 -10
- package/src/components/radio-group.tsx +1 -1
- package/src/components/scroll-area.tsx +2 -2
- package/src/components/select.tsx +1 -1
- package/src/components/sheet.tsx +9 -5
- package/src/components/slider.tsx +1 -1
- package/src/components/stepper.tsx +4 -4
- package/src/components/switch.tsx +2 -2
- package/src/components/table.tsx +2 -2
- package/src/components/tabs.tsx +1 -1
- package/src/components/text-reveal-motion.tsx +3 -8
- package/src/components/textarea.tsx +1 -1
- package/src/components/toggle.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/lib/motion.ts +75 -0
- package/src/lib/utils.ts +14 -2
- package/dist/browser-entry.d.ts +0 -19
- package/dist/browser-entry.d.ts.map +0 -1
- package/src/browser-entry.ts +0 -99
- package/src/browser-tokens.css +0 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared motion values for JS-driven (framer-motion) animation — the JS-side
|
|
3
|
+
* counterpart of the CSS motion token scale (`--ds-motion-*` in
|
|
4
|
+
* `@brightlocal/tokens`).
|
|
5
|
+
*
|
|
6
|
+
* Engine policy (DS-806): CSS is the default for predetermined state
|
|
7
|
+
* transitions and preset keyframes. framer-motion is allowed when animation
|
|
8
|
+
* behaviour requires runtime orchestration — progress-driven or
|
|
9
|
+
* gesture-interruptible motion, spring physics, layout measurement, or
|
|
10
|
+
* sequencing tied to React state — and every framer component must consume
|
|
11
|
+
* `usePrefersReducedMotion()` (the global CSS kill-switch cannot see
|
|
12
|
+
* JS-driven values).
|
|
13
|
+
*
|
|
14
|
+
* New framer code must use one of these presets. Introducing a new spring
|
|
15
|
+
* config means adding it here, which keeps drift reviewable.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export { SETTLE_REST_DELTA } from "./spring-settle";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Duration scale in milliseconds — mirrors --ds-motion-duration-fast/base/slow.
|
|
22
|
+
* fast: state changes (hover/focus color, shadow, opacity) + exits;
|
|
23
|
+
* press feedback is faster still (instant or ≤100ms)
|
|
24
|
+
* base: standard reveals + on-screen movement
|
|
25
|
+
* slow: large surfaces; the productive-motion ceiling
|
|
26
|
+
*/
|
|
27
|
+
export const MOTION_DURATION_FAST_MS = 150;
|
|
28
|
+
export const MOTION_DURATION_BASE_MS = 200;
|
|
29
|
+
export const MOTION_DURATION_SLOW_MS = 300;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Quick and controlled, no overshoot — list reorders and other
|
|
33
|
+
* small-element layout moves.
|
|
34
|
+
*
|
|
35
|
+
* Damping 45 keeps it at/above critical damping (2 × √500 ≈ 44.7, mass 1),
|
|
36
|
+
* so the "no overshoot" description physically holds — at the previous 35
|
|
37
|
+
* the spring was underdamped (ζ ≈ 0.78) and could overshoot.
|
|
38
|
+
*/
|
|
39
|
+
export const SPRING_SNAPPY = {
|
|
40
|
+
type: "spring",
|
|
41
|
+
stiffness: 500,
|
|
42
|
+
damping: 45,
|
|
43
|
+
} as const;
|
|
44
|
+
|
|
45
|
+
/** Balanced — text and content reveals. */
|
|
46
|
+
export const SPRING_SMOOTH = {
|
|
47
|
+
type: "spring",
|
|
48
|
+
stiffness: 180,
|
|
49
|
+
damping: 24,
|
|
50
|
+
mass: 1,
|
|
51
|
+
} as const;
|
|
52
|
+
|
|
53
|
+
/** Soft and value-tracking — progress bars and gauges. */
|
|
54
|
+
export const SPRING_GENTLE = {
|
|
55
|
+
type: "spring",
|
|
56
|
+
stiffness: 80,
|
|
57
|
+
damping: 20,
|
|
58
|
+
mass: 1,
|
|
59
|
+
} as const;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Slow, non-overshooting morph driver for shape-progress springs (Loading,
|
|
63
|
+
* TextRevealMotion). Always pair with `SETTLE_REST_DELTA` (aim the spring at
|
|
64
|
+
* `1 + SETTLE_REST_DELTA` with `restDelta: SETTLE_REST_DELTA`) so the
|
|
65
|
+
* terminal snap lands off-screen.
|
|
66
|
+
*
|
|
67
|
+
* Precondition for the settle trick: damping ≥ 2 × √(stiffness × mass)
|
|
68
|
+
* (9 ≥ 2 × √(30 × 0.5) ≈ 7.75) — the spring must never overshoot.
|
|
69
|
+
*/
|
|
70
|
+
export const SPRING_SETTLE = {
|
|
71
|
+
type: "spring",
|
|
72
|
+
stiffness: 30,
|
|
73
|
+
damping: 9,
|
|
74
|
+
mass: 0.5,
|
|
75
|
+
} as const;
|
package/src/lib/utils.ts
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import { clsx, type ClassValue } from "clsx";
|
|
2
|
-
import {
|
|
2
|
+
import { extendTailwindMerge } from "tailwind-merge";
|
|
3
|
+
|
|
4
|
+
// The motion scale adds named duration/ease utilities (tailwind-preset.css)
|
|
5
|
+
// that stock twMerge does not recognize — without registering them, a
|
|
6
|
+
// consumer's `duration-300` would not replace a baked-in `duration-fast`.
|
|
7
|
+
const twMerge = extendTailwindMerge({
|
|
8
|
+
extend: {
|
|
9
|
+
classGroups: {
|
|
10
|
+
duration: [{ duration: ["fast", "base", "slow"] }],
|
|
11
|
+
ease: [{ ease: ["emphasized", "overshoot"] }],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
});
|
|
3
15
|
|
|
4
16
|
export function cn(...inputs: ClassValue[]) {
|
|
5
17
|
return twMerge(clsx(inputs));
|
|
6
18
|
}
|
|
7
19
|
|
|
8
20
|
export const FLOATING_CONTENT_ANIMATION =
|
|
9
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2";
|
|
21
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 duration-base ease-out data-[state=closed]:duration-fast data-[state=closed]:ease-in";
|
package/dist/browser-entry.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import * as ReactDOM from "react-dom";
|
|
3
|
-
export * from './index';
|
|
4
|
-
export { React, ReactDOM };
|
|
5
|
-
export declare const h: typeof React.createElement;
|
|
6
|
-
export declare const useState: typeof React.useState;
|
|
7
|
-
export declare const useEffect: typeof React.useEffect;
|
|
8
|
-
export declare const useMemo: typeof React.useMemo;
|
|
9
|
-
export declare const useCallback: typeof React.useCallback;
|
|
10
|
-
export declare const useRef: typeof React.useRef;
|
|
11
|
-
export declare const useContext: typeof React.useContext;
|
|
12
|
-
export declare const useReducer: typeof React.useReducer;
|
|
13
|
-
export declare const useLayoutEffect: typeof React.useLayoutEffect;
|
|
14
|
-
export declare const Fragment: React.ExoticComponent<React.FragmentProps>;
|
|
15
|
-
export declare const version: string;
|
|
16
|
-
export declare const buildTime: string;
|
|
17
|
-
export declare function mount(name: string, container: HTMLElement, props?: Record<string, unknown>): () => void;
|
|
18
|
-
export declare function render(element: React.ReactNode, container: HTMLElement): () => void;
|
|
19
|
-
//# sourceMappingURL=browser-entry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browser-entry.d.ts","sourceRoot":"","sources":["../src/browser-entry.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AAKtC,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAE3B,eAAO,MAAM,CAAC,4BAAsB,CAAC;AACrC,eAAO,MAAM,QAAQ,uBAAiB,CAAC;AACvC,eAAO,MAAM,SAAS,wBAAkB,CAAC;AACzC,eAAO,MAAM,OAAO,sBAAgB,CAAC;AACrC,eAAO,MAAM,WAAW,0BAAoB,CAAC;AAC7C,eAAO,MAAM,MAAM,qBAAe,CAAC;AACnC,eAAO,MAAM,UAAU,yBAAmB,CAAC;AAC3C,eAAO,MAAM,UAAU,yBAAmB,CAAC;AAC3C,eAAO,MAAM,eAAe,8BAAwB,CAAC;AACrD,eAAO,MAAM,QAAQ,4CAAiB,CAAC;AAOvC,eAAO,MAAM,OAAO,QAC+C,CAAC;AACpE,eAAO,MAAM,SAAS,QAC0C,CAAC;AAmBjE,wBAAgB,KAAK,CACnB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,WAAW,EACtB,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAClC,MAAM,IAAI,CA0BZ;AAED,wBAAgB,MAAM,CACpB,OAAO,EAAE,KAAK,CAAC,SAAS,EACxB,SAAS,EAAE,WAAW,GACrB,MAAM,IAAI,CAaZ"}
|
package/src/browser-entry.ts
DELETED
|
@@ -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
|
-
}
|
package/src/browser-tokens.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@import "../../../packages/tokens/src/styles/tailwind-preset.css";
|