burne-ui 1.5.9 → 1.6.1

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 CHANGED
@@ -69,6 +69,41 @@ export function AppProviders({ children }: { children: React.ReactNode }) {
69
69
 
70
70
  Scaffold (`create-burne-app` / `burne-ui init`) уже кладёт `burne-theme.ts` с **`tokens`** (shared), **`colors.light` / `colors.dark`** и **`motion`**.
71
71
 
72
+ Проектные CSS-переменные можно описать в том же конфиге. Они применяются Provider и автоматически
73
+ появляются в `burne-ui-devtools`:
74
+
75
+ ```ts
76
+ const burneTheme = {
77
+ // tokens, colors, motion...
78
+ customTokens: {
79
+ "--app-brand": "#38bdf8",
80
+ "--app-sidebar-width": {
81
+ value: 320,
82
+ unit: "px",
83
+ label: "Sidebar width",
84
+ control: "slider",
85
+ min: 240,
86
+ max: 480,
87
+ step: 4,
88
+ },
89
+ },
90
+ } satisfies BurneThemeConfig;
91
+ ```
92
+
93
+ ### Devtools темы
94
+
95
+ Интерактивный редактор устанавливается отдельно и подключается только в development:
96
+
97
+ ```bash
98
+ npm install -D burne-ui-devtools
99
+ ```
100
+
101
+ Он показывает плавающую кнопку, позволяет менять токены и пресеты в браузере, а затем скопировать
102
+ или скачать готовый `burne-theme.ts`. Пресеты шрифтов подгружают Google Fonts лениво только в
103
+ devtools; в production выбранный face нужно подключить самим. Полная интеграция для Vite и Next.js —
104
+ в [`burne-ui-devtools`](https://www.npmjs.com/package/burne-ui-devtools) и
105
+ [docs/SETUP.md](./docs/SETUP.md).
106
+
72
107
 
73
108
  Только переключение `data-theme`: `ThemeProvider` + `useBurneTheme()`. Подробности — [docs/SETUP.md](./docs/SETUP.md).
74
109
 
@@ -1,5 +1,5 @@
1
1
  import { UseAlertDialogModalMotionProps } from './alertDialogTypes';
2
- export declare function useAlertDialogModalMotion({ open, variant }: UseAlertDialogModalMotionProps): {
2
+ export declare function useAlertDialogModalMotion({ open, variant, }: UseAlertDialogModalMotionProps): {
3
3
  mounted: boolean;
4
4
  dialogRef: import('react').RefObject<HTMLDialogElement | null>;
5
5
  overlayRef: import('react').RefObject<HTMLDivElement | null>;
@@ -1,7 +1,7 @@
1
1
  import { MouseEvent } from 'react';
2
2
  import { ButtonAsyncLayerKind, ButtonAsyncState, ExpandRipple, UseButtonAnimationsProps } from './buttonTypes';
3
3
  export declare function createButtonAsyncLayerRefCallback(ref: React.RefObject<HTMLElement | null>, initialState: ButtonAsyncState, layer: ButtonAsyncLayerKind): (node: HTMLElement | null) => void;
4
- export declare function useButtonAnimations({ variant, animated, asyncState, isControlled, blocked, userDisabled, groupSegment, forwardedRef, onPointerEnter, onPointerLeave, onPointerDown, }: UseButtonAnimationsProps): {
4
+ export declare function useButtonAnimations({ variant, animated, asyncState, isControlled, blocked, groupSegment, forwardedRef, onPointerEnter, onPointerLeave, onPointerDown, }: UseButtonAnimationsProps): {
5
5
  setRefs: (node: HTMLButtonElement | null) => void;
6
6
  contentMotionRef: import('react').RefObject<HTMLSpanElement | null>;
7
7
  bindLabelRef: (node: HTMLElement | null) => void;
@@ -82,7 +82,6 @@ export type UseButtonAnimationsProps = {
82
82
  asyncState: ButtonAsyncState;
83
83
  isControlled: boolean;
84
84
  blocked: boolean;
85
- userDisabled: boolean;
86
85
  groupSegment: ButtonGroupSegment | undefined;
87
86
  forwardedRef: React.ForwardedRef<HTMLButtonElement>;
88
87
  onPointerEnter?: React.PointerEventHandler<HTMLButtonElement>;
@@ -39,4 +39,4 @@ export declare function DialogPanel({ variant, dismissOnBackdrop, className, the
39
39
  export declare namespace DialogPanel {
40
40
  var displayName: string;
41
41
  }
42
- export declare function DialogPortalShell({ children, className, variant, sizePreset, portalTheme, lightUi, titleId, descriptionId, hasDescription, dialogRef, overlayRef, panelRef, bindGlossPanelRef, onBackdropMouseDown, onDialogClose, }: DialogPortalShellProps): import("react/jsx-runtime").JSX.Element;
42
+ export declare function DialogPortalShell({ children, className, variant, sizePreset, portalTheme, lightUi, titleId, descriptionId, hasDescription, dialogRef, overlayRef, panelRef, bindGlossPanelRef, onBackdropMouseDown, onDialogClose, onDialogCancel, }: DialogPortalShellProps): import("react/jsx-runtime").JSX.Element;
@@ -98,6 +98,7 @@ export type DialogPortalShellProps = {
98
98
  bindGlossPanelRef: (node: HTMLDivElement | null) => void;
99
99
  onBackdropMouseDown: (e: React.MouseEvent<HTMLDivElement>) => void;
100
100
  onDialogClose: () => void;
101
+ onDialogCancel: (e: React.SyntheticEvent<HTMLDialogElement>) => void;
101
102
  };
102
103
  export type DialogTriggerInternalProps = {
103
104
  triggerRef: React.RefObject<HTMLElement | null>;
@@ -47,4 +47,4 @@ export declare function DrawerPanel({ size, variant, className, themeAnchor, chi
47
47
  export declare namespace DrawerPanel {
48
48
  var displayName: string;
49
49
  }
50
- export declare function DrawerPortalShell({ className, variant, placement, size, portalTheme, lightUi, titleId, descriptionId, hasDescription, backdropIsDismissable, panelSegments, dialogRef, overlayRef, panelRef, bindGlossPanelRef, onBackdropMouseDown, onDialogClose, }: DrawerPortalShellProps): import("react/jsx-runtime").JSX.Element;
50
+ export declare function DrawerPortalShell({ className, variant, placement, size, portalTheme, lightUi, titleId, descriptionId, hasDescription, backdropIsDismissable, panelSegments, dialogRef, overlayRef, panelRef, bindGlossPanelRef, onBackdropMouseDown, onDialogClose, onDialogCancel, }: DrawerPortalShellProps): import("react/jsx-runtime").JSX.Element;
@@ -108,6 +108,7 @@ export type DrawerPortalShellProps = {
108
108
  bindGlossPanelRef: (node: HTMLDivElement | null) => void;
109
109
  onBackdropMouseDown: (e: React.MouseEvent<HTMLDivElement>) => void;
110
110
  onDialogClose: () => void;
111
+ onDialogCancel: (e: React.SyntheticEvent<HTMLDialogElement>) => void;
111
112
  };
112
113
  export type DrawerTriggerInternalProps = {
113
114
  triggerRef: React.RefObject<HTMLElement | null>;
@@ -2,4 +2,9 @@ import { InputHTMLAttributes } from 'react';
2
2
  export declare function radioInputId(idProp: string | undefined, autoId: string): string;
3
3
  export declare function radioHintId(inputId: string): string;
4
4
  export declare function radioErrorId(inputId: string): string;
5
- export declare function radioInputAriaLabel(value: InputHTMLAttributes<HTMLInputElement>["value"] | undefined): string;
5
+ /**
6
+ * Fallback accessible name when there is no visible label (icon-only / control-only).
7
+ * With a visible label (wrapping `<label>` text or `Radio.Label`), return `undefined`
8
+ * so `aria-label` does not override Label in Name (WCAG 2.5.3).
9
+ */
10
+ export declare function radioInputAriaLabel(value: InputHTMLAttributes<HTMLInputElement>["value"] | undefined, hasLabel: boolean): string | undefined;
@@ -61,6 +61,8 @@ export type RadioFieldContextValue = {
61
61
  hasCompoundError: boolean;
62
62
  hintConnected: boolean;
63
63
  errorConnected: boolean;
64
+ /** Visible label present (simple `label` or compound `Radio.Label`) — skips fallback `aria-label`. */
65
+ hasLabel: boolean;
64
66
  useInlineCompoundMotion: boolean;
65
67
  textMotionRef: RefObject<HTMLElement | null>;
66
68
  danger: boolean;
@@ -40,3 +40,18 @@ export declare function animatePortalClose({ surface, vars, onComplete, exit, }:
40
40
  onComplete?: () => void;
41
41
  exit?: GsapMotionVars;
42
42
  }): gsap.core.Tween;
43
+ /**
44
+ * Element to restore focus to after the modal closes.
45
+ * Call before `showModal()` — after that, focus moves into the dialog.
46
+ */
47
+ export declare function captureModalFocusReturn(dialog: HTMLDialogElement): HTMLElement | null;
48
+ /**
49
+ * Close the native dialog before unmounting its portal, then restore focus to
50
+ * the element that opened it. The dialog stays modal during its exit animation,
51
+ * so focus cannot legitimately leave it before this point.
52
+ */
53
+ export declare function completeModalDialogClose({ dialog, focusReturn, unmount, }: {
54
+ dialog: HTMLDialogElement | null;
55
+ focusReturn: HTMLElement | null;
56
+ unmount: () => void;
57
+ }): void;
@@ -28,12 +28,6 @@ export type UseFirstLevelInteractiveMotionProps = {
28
28
  * Called at the start of press-squeeze release phase (before restoring hover).
29
29
  */
30
30
  onPressReleaseStart?: () => void;
31
- /**
32
- * Optional override for the "still enabled?" check inside the async `afterPress` callback.
33
- * Useful when `enabled` might change between press and animation completion (e.g. Button async).
34
- * Default: returns the current `enabled` closure value.
35
- */
36
- afterPressEnabled?: () => boolean;
37
31
  };
38
32
  export declare function useFirstLevelInteractiveMotion({ isGloss, animated, enabled, hasHoverShadow, useContentRef, forwardedRef, onPointerEnter: onPointerEnterProp, onPointerLeave: onPointerLeaveProp, onPointerDown: onPointerDownProp, onPressReleaseStart, }: UseFirstLevelInteractiveMotionProps): {
39
33
  setRefs: (node: HTMLButtonElement | null) => void;