@fibery/ui-kit 8.0.0 → 9.0.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.
@@ -0,0 +1,15 @@
1
+ import { IconBaseProps } from "../icons/types.js";
2
+ import { FunctionComponent, ReactNode } from "react";
3
+ //#region src/actions-menu/actions-menu-toggle-item.d.ts
4
+ type ActionsMenuToggleItemProps = {
5
+ checked: boolean;
6
+ onCheckedChange: (checked: boolean) => void;
7
+ Icon?: FunctionComponent<IconBaseProps>;
8
+ iconColor?: string;
9
+ disabled?: boolean;
10
+ children: ReactNode;
11
+ className?: string;
12
+ };
13
+ declare const ActionsMenuToggleItem: React.FC<ActionsMenuToggleItemProps>;
14
+ //#endregion
15
+ export { ActionsMenuToggleItem, ActionsMenuToggleItemProps };
@@ -0,0 +1,54 @@
1
+ import "./actions-menu-toggle-item.wyw-in-js.css";
2
+ import { themeVars } from "../theming.generated.js";
3
+ import { useIsPhone } from "../use-is-phone.js";
4
+ import { ToggleOnOff } from "../toggle-on-off.js";
5
+ import { useActionsMenuContext } from "./contexts/actions-menu-context.js";
6
+ /* empty css */
7
+ import { noop } from "@fibery/helpers/src/_";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { memo } from "react";
10
+ import { cx } from "@linaria/core";
11
+ import { stopPropagation } from "@fibery/react/src/stop-propagation";
12
+ import { preventDefault } from "@fibery/react/src/prevent-default";
13
+ //#region src/actions-menu/actions-menu-toggle-item.tsx
14
+ var rowCss = "r13fgtxg-row";
15
+ var rowContentCss = "rn9ns5t-rowContent";
16
+ var cornerCss = "c1fv76hq-corner";
17
+ var toggleCornerCss = "tsyu910-toggleCorner";
18
+ var ActionsMenuToggleItem = memo(function ActionsMenuToggleItem({ checked, onCheckedChange, Icon, iconColor, disabled, children, className }) {
19
+ const { MenuPrimitive } = useActionsMenuContext();
20
+ const isPhone = useIsPhone();
21
+ return /* @__PURE__ */ jsxs(MenuPrimitive.CheckboxItem, {
22
+ checked,
23
+ onCheckedChange,
24
+ onSelect: preventDefault,
25
+ onClick: stopPropagation,
26
+ className: cx(rowCss, className),
27
+ disabled,
28
+ children: [
29
+ Icon && /* @__PURE__ */ jsx("div", {
30
+ className: cornerCss,
31
+ children: /* @__PURE__ */ jsx(Icon, {
32
+ color: `var(--actions-menu-item-icon-color, ${iconColor ?? themeVars.iconColor})`,
33
+ iconSize: isPhone ? 20 : 18
34
+ })
35
+ }),
36
+ /* @__PURE__ */ jsx("div", {
37
+ className: rowContentCss,
38
+ children
39
+ }),
40
+ /* @__PURE__ */ jsx("div", {
41
+ className: cx(cornerCss, toggleCornerCss),
42
+ "aria-hidden": true,
43
+ children: /* @__PURE__ */ jsx(ToggleOnOff, {
44
+ value: checked,
45
+ onChange: noop,
46
+ tabIndex: -1,
47
+ disabled
48
+ })
49
+ })
50
+ ]
51
+ });
52
+ });
53
+ //#endregion
54
+ export { ActionsMenuToggleItem };
@@ -0,0 +1,4 @@
1
+ .r13fgtxg-row{display:flex;align-items:center;min-height:var(--fibery-layout-menuItemHeight);gap:6px;}.fibery-mobile .r13fgtxg-row{gap:8px;}
2
+ .rn9ns5t-rowContent{flex-grow:1;}
3
+ .c1fv76hq-corner{display:flex;align-items:center;}
4
+ .tsyu910-toggleCorner{pointer-events:none;}
@@ -3,6 +3,7 @@ import { ActionsMenuItem } from "./actions-menu-item.js";
3
3
  import { $TSFixMe } from "../tsfixme.js";
4
4
  import { ActionsMenuSeparator } from "./actions-menu-separator.js";
5
5
  import { ActionsMenuSubMenu } from "./actions-menu-sub-menu.js";
6
+ import { ActionsMenuToggleItem } from "./actions-menu-toggle-item.js";
6
7
  import { ActionsMenu } from "./actions-menu.js";
7
8
  import { AsyncActionsMenuItem } from "./async-actions-menu-item.js";
8
9
  import { useActionsMenuContext } from "./contexts/actions-menu-context.js";
@@ -11,4 +12,4 @@ import { insertSeparators } from "./utils/insert-separators.js";
11
12
  declare const ActionsMenuGroup: (props: $TSFixMe) => import("react/jsx-runtime").JSX.Element;
12
13
  declare const ActionsMenuLabel: (props: $TSFixMe) => import("react/jsx-runtime").JSX.Element;
13
14
  //#endregion
14
- export { ActionsMenu, ActionsMenuCheckboxItem, ActionsMenuGroup, ActionsMenuItem, ActionsMenuLabel, ActionsMenuSeparator, ActionsMenuSubMenu, AsyncActionsMenuItem, insertSeparators, useActionsMenuContext };
15
+ export { ActionsMenu, ActionsMenuCheckboxItem, ActionsMenuGroup, ActionsMenuItem, ActionsMenuLabel, ActionsMenuSeparator, ActionsMenuSubMenu, ActionsMenuToggleItem, AsyncActionsMenuItem, insertSeparators, useActionsMenuContext };
@@ -2,6 +2,7 @@ import { useActionsMenuContext } from "./contexts/actions-menu-context.js";
2
2
  import { ActionsMenu } from "./actions-menu.js";
3
3
  import { ActionsMenuItem } from "./actions-menu-item.js";
4
4
  import { ActionsMenuCheckboxItem } from "./actions-menu-checkbox-item.js";
5
+ import { ActionsMenuToggleItem } from "./actions-menu-toggle-item.js";
5
6
  import { AsyncActionsMenuItem } from "./async-actions-menu-item.js";
6
7
  import { ActionsMenuSubMenu } from "./actions-menu-sub-menu.js";
7
8
  import { ActionsMenuSeparator } from "./actions-menu-separator.js";
@@ -17,4 +18,4 @@ var ActionsMenuLabel = (props) => {
17
18
  return /* @__PURE__ */ jsx(MenuPrimitive.Label, { ...props });
18
19
  };
19
20
  //#endregion
20
- export { ActionsMenu, ActionsMenuCheckboxItem, ActionsMenuGroup, ActionsMenuItem, ActionsMenuLabel, ActionsMenuSeparator, ActionsMenuSubMenu, AsyncActionsMenuItem, insertSeparators, useActionsMenuContext };
21
+ export { ActionsMenu, ActionsMenuCheckboxItem, ActionsMenuGroup, ActionsMenuItem, ActionsMenuLabel, ActionsMenuSeparator, ActionsMenuSubMenu, ActionsMenuToggleItem, AsyncActionsMenuItem, insertSeparators, useActionsMenuContext };
@@ -21,6 +21,7 @@ var PrefixedInputNumber = forwardRef(function PrefixedInputNumber(props, ref) {
21
21
  prefixCls: "ant-input-number",
22
22
  upHandler: upNode,
23
23
  downHandler: downNode,
24
+ wheel: false,
24
25
  ...props,
25
26
  ref
26
27
  });
@@ -50,6 +50,9 @@ declare function defsFromPalette({ key, whiteA, white, blackA, blackish, black,
50
50
  readonly colorBgAIFloatingLauncher: [string, string];
51
51
  readonly colorBgAIFloatingPanelContent: [string, string];
52
52
  readonly colorBgAISidebarContent: [string, string];
53
+ readonly gradientBgAIGeneration: readonly ["radial-gradient(50% 50% at 50% 50%, rgb(255, 102, 235) 0%, transparent 100%)", "radial-gradient(50% 50% at 50% 50%, rgba(255, 102, 235, 0.6) 0%, transparent 100%)"];
54
+ readonly gradientBgAIHighlight: readonly ["radial-gradient(ellipse at top, #c6b0ff40, transparent), radial-gradient(ellipse at bottom right, #c7d6fe60, transparent)", "radial-gradient(ellipse at top, #c6b0ff30, transparent), radial-gradient(ellipse at bottom right, #c7d6fe30, transparent)"];
55
+ readonly gradientBgAILoader: readonly ["linear-gradient(90deg, #8f36d2 0%, #e92eb4 50%, #c959dd 100%)", "linear-gradient(90deg, #8f36d2 0%, #e92eb4 50%, #c959dd 100%)"];
53
56
  readonly colorBgFloatingPanel: [string, string];
54
57
  readonly shadowFloatingPanel: [string, string];
55
58
  readonly pageContentBg: [string, string];
@@ -655,6 +658,9 @@ declare function sideFromDefs(defs: ThemeDefs, mode: ThemeMode): {
655
658
  readonly colorBgAIFloatingLauncher: string;
656
659
  readonly colorBgAIFloatingPanelContent: string;
657
660
  readonly colorBgAISidebarContent: string;
661
+ readonly gradientBgAIGeneration: "radial-gradient(50% 50% at 50% 50%, rgb(255, 102, 235) 0%, transparent 100%)" | "radial-gradient(50% 50% at 50% 50%, rgba(255, 102, 235, 0.6) 0%, transparent 100%)";
662
+ readonly gradientBgAIHighlight: "radial-gradient(ellipse at top, #c6b0ff30, transparent), radial-gradient(ellipse at bottom right, #c7d6fe30, transparent)" | "radial-gradient(ellipse at top, #c6b0ff40, transparent), radial-gradient(ellipse at bottom right, #c7d6fe60, transparent)";
663
+ readonly gradientBgAILoader: "linear-gradient(90deg, #8f36d2 0%, #e92eb4 50%, #c959dd 100%)";
658
664
  readonly colorBgFloatingPanel: string;
659
665
  readonly shadowFloatingPanel: string;
660
666
  readonly pageContentBg: string;
@@ -311,6 +311,9 @@ function defsFromPalette({ key, whiteA, white, blackA, blackish, black, base, ba
311
311
  colorBgAIFloatingLauncher: surface.level1_4,
312
312
  colorBgAIFloatingPanelContent: surface.level1_3,
313
313
  colorBgAISidebarContent: surface.level1,
314
+ gradientBgAIGeneration: ["radial-gradient(50% 50% at 50% 50%, rgb(255, 102, 235) 0%, transparent 100%)", "radial-gradient(50% 50% at 50% 50%, rgba(255, 102, 235, 0.6) 0%, transparent 100%)"],
315
+ gradientBgAIHighlight: ["radial-gradient(ellipse at top, #c6b0ff40, transparent), radial-gradient(ellipse at bottom right, #c7d6fe60, transparent)", "radial-gradient(ellipse at top, #c6b0ff30, transparent), radial-gradient(ellipse at bottom right, #c7d6fe30, transparent)"],
316
+ gradientBgAILoader: ["linear-gradient(90deg, #8f36d2 0%, #e92eb4 50%, #c959dd 100%)", "linear-gradient(90deg, #8f36d2 0%, #e92eb4 50%, #c959dd 100%)"],
314
317
  colorBgFloatingPanel: floatingPanel.bg,
315
318
  shadowFloatingPanel: floatingPanel.shadow,
316
319
  pageContentBg: surface.level0elevated,
@@ -54,6 +54,9 @@ declare function themeFromDefs(defs: ThemeDefs, mode: ThemeMode, ns?: string): {
54
54
  readonly colorBgAIFloatingLauncher: string;
55
55
  readonly colorBgAIFloatingPanelContent: string;
56
56
  readonly colorBgAISidebarContent: string;
57
+ readonly gradientBgAIGeneration: "radial-gradient(50% 50% at 50% 50%, rgb(255, 102, 235) 0%, transparent 100%)" | "radial-gradient(50% 50% at 50% 50%, rgba(255, 102, 235, 0.6) 0%, transparent 100%)";
58
+ readonly gradientBgAIHighlight: "radial-gradient(ellipse at top, #c6b0ff30, transparent), radial-gradient(ellipse at bottom right, #c7d6fe30, transparent)" | "radial-gradient(ellipse at top, #c6b0ff40, transparent), radial-gradient(ellipse at bottom right, #c7d6fe60, transparent)";
59
+ readonly gradientBgAILoader: "linear-gradient(90deg, #8f36d2 0%, #e92eb4 50%, #c959dd 100%)";
57
60
  readonly colorBgFloatingPanel: string;
58
61
  readonly shadowFloatingPanel: string;
59
62
  readonly pageContentBg: string;
@@ -662,6 +665,9 @@ declare function themeFromPaletteImpl(palette: ThemePalette, mode: ThemeMode, ns
662
665
  readonly colorBgAIFloatingLauncher: string;
663
666
  readonly colorBgAIFloatingPanelContent: string;
664
667
  readonly colorBgAISidebarContent: string;
668
+ readonly gradientBgAIGeneration: "radial-gradient(50% 50% at 50% 50%, rgb(255, 102, 235) 0%, transparent 100%)" | "radial-gradient(50% 50% at 50% 50%, rgba(255, 102, 235, 0.6) 0%, transparent 100%)";
669
+ readonly gradientBgAIHighlight: "radial-gradient(ellipse at top, #c6b0ff30, transparent), radial-gradient(ellipse at bottom right, #c7d6fe30, transparent)" | "radial-gradient(ellipse at top, #c6b0ff40, transparent), radial-gradient(ellipse at bottom right, #c7d6fe60, transparent)";
670
+ readonly gradientBgAILoader: "linear-gradient(90deg, #8f36d2 0%, #e92eb4 50%, #c959dd 100%)";
665
671
  readonly colorBgFloatingPanel: string;
666
672
  readonly shadowFloatingPanel: string;
667
673
  readonly pageContentBg: string;
@@ -1269,6 +1275,9 @@ declare const themeFromPalette: typeof themeFromPaletteImpl & import("@fibery/he
1269
1275
  readonly colorBgAIFloatingLauncher: string;
1270
1276
  readonly colorBgAIFloatingPanelContent: string;
1271
1277
  readonly colorBgAISidebarContent: string;
1278
+ readonly gradientBgAIGeneration: "radial-gradient(50% 50% at 50% 50%, rgb(255, 102, 235) 0%, transparent 100%)" | "radial-gradient(50% 50% at 50% 50%, rgba(255, 102, 235, 0.6) 0%, transparent 100%)";
1279
+ readonly gradientBgAIHighlight: "radial-gradient(ellipse at top, #c6b0ff30, transparent), radial-gradient(ellipse at bottom right, #c7d6fe30, transparent)" | "radial-gradient(ellipse at top, #c6b0ff40, transparent), radial-gradient(ellipse at bottom right, #c7d6fe60, transparent)";
1280
+ readonly gradientBgAILoader: "linear-gradient(90deg, #8f36d2 0%, #e92eb4 50%, #c959dd 100%)";
1272
1281
  readonly colorBgFloatingPanel: string;
1273
1282
  readonly shadowFloatingPanel: string;
1274
1283
  readonly pageContentBg: string;
@@ -1877,6 +1886,9 @@ declare const stylesFromTheme: ((arg: Pick<{
1877
1886
  readonly colorBgAIFloatingLauncher: string;
1878
1887
  readonly colorBgAIFloatingPanelContent: string;
1879
1888
  readonly colorBgAISidebarContent: string;
1889
+ readonly gradientBgAIGeneration: "radial-gradient(50% 50% at 50% 50%, rgb(255, 102, 235) 0%, transparent 100%)" | "radial-gradient(50% 50% at 50% 50%, rgba(255, 102, 235, 0.6) 0%, transparent 100%)";
1890
+ readonly gradientBgAIHighlight: "radial-gradient(ellipse at top, #c6b0ff30, transparent), radial-gradient(ellipse at bottom right, #c7d6fe30, transparent)" | "radial-gradient(ellipse at top, #c6b0ff40, transparent), radial-gradient(ellipse at bottom right, #c7d6fe60, transparent)";
1891
+ readonly gradientBgAILoader: "linear-gradient(90deg, #8f36d2 0%, #e92eb4 50%, #c959dd 100%)";
1880
1892
  readonly colorBgFloatingPanel: string;
1881
1893
  readonly shadowFloatingPanel: string;
1882
1894
  readonly pageContentBg: string;
@@ -2483,6 +2495,9 @@ declare const stylesFromTheme: ((arg: Pick<{
2483
2495
  readonly colorBgAIFloatingLauncher: string;
2484
2496
  readonly colorBgAIFloatingPanelContent: string;
2485
2497
  readonly colorBgAISidebarContent: string;
2498
+ readonly gradientBgAIGeneration: "radial-gradient(50% 50% at 50% 50%, rgb(255, 102, 235) 0%, transparent 100%)" | "radial-gradient(50% 50% at 50% 50%, rgba(255, 102, 235, 0.6) 0%, transparent 100%)";
2499
+ readonly gradientBgAIHighlight: "radial-gradient(ellipse at top, #c6b0ff30, transparent), radial-gradient(ellipse at bottom right, #c7d6fe30, transparent)" | "radial-gradient(ellipse at top, #c6b0ff40, transparent), radial-gradient(ellipse at bottom right, #c7d6fe60, transparent)";
2500
+ readonly gradientBgAILoader: "linear-gradient(90deg, #8f36d2 0%, #e92eb4 50%, #c959dd 100%)";
2486
2501
  readonly colorBgFloatingPanel: string;
2487
2502
  readonly shadowFloatingPanel: string;
2488
2503
  readonly pageContentBg: string;
package/lib/embed.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ import { ThemePalette } from "./design-system/types.js";
2
+ import { ThemeMode } from "./theme-settings-core.js";
3
+ import { PropsWithChildren } from "react";
4
+ //#region src/embed.d.ts
5
+ type RootProps = PropsWithChildren<{
6
+ mode: ThemeMode;
7
+ palette: ThemePalette;
8
+ }>;
9
+ /**
10
+ * Establishes the UI-kit environment for one embedded React root.
11
+ * Server output uses the standalone fallback; host variables are adopted during the first client layout.
12
+ */
13
+ declare function Root({ mode, palette, children }: RootProps): import("react/jsx-runtime").JSX.Element;
14
+ /** Carries the current embedded UI-kit environment into a consumer-owned DOM portal. */
15
+ declare function PortalBridge({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
16
+ declare const FiberyEmbed: {
17
+ readonly Root: typeof Root;
18
+ readonly PortalBridge: typeof PortalBridge;
19
+ };
20
+ //#endregion
21
+ export { FiberyEmbed };
package/lib/embed.js ADDED
@@ -0,0 +1,150 @@
1
+ import "./embed.wyw-in-js.css";
2
+ import { stylesFromTheme, themeFromPalette } from "./design-system/theme.js";
3
+ import "./mobile-styles.js";
4
+ import { EmbedPortalBoundaryContext, ThematicContext, ThemeContext, ThemePaletteContext, ThemePreferenceContext, ThemeStylesContext } from "./theme-provider.js";
5
+ import { defaultLayoutVariables, mobileLayoutVariables } from "./layout-variables.js";
6
+ /* empty css */
7
+ import { jsx } from "react/jsx-runtime";
8
+ import { useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
9
+ import invariant from "invariant";
10
+ //#region src/embed.tsx
11
+ var useIsomorphicLayoutEffect = typeof document === "undefined" ? useEffect : useLayoutEffect;
12
+ function layoutStylesFor(element) {
13
+ if (element?.closest(`.fibery-mobile`)) return {
14
+ ...defaultLayoutVariables,
15
+ ...mobileLayoutVariables
16
+ };
17
+ return defaultLayoutVariables;
18
+ }
19
+ function stylesForEmbedTheme(theme, element) {
20
+ return {
21
+ ...stylesFromTheme(theme),
22
+ ...layoutStylesFor(element)
23
+ };
24
+ }
25
+ function mergeStyles(...styles) {
26
+ const merged = Object.assign({}, ...styles);
27
+ return Object.keys(merged).length === 0 ? void 0 : merged;
28
+ }
29
+ function resolveEmbedTheme(element, theme, styles, portal) {
30
+ const computedStyles = element.ownerDocument.defaultView?.getComputedStyle(element);
31
+ const effectiveColors = { ...theme.colors };
32
+ const effectiveStyles = {};
33
+ const inlineStyles = {};
34
+ const colorKeys = new Map(Object.keys(theme.colors).map((key) => [theme.varname(key), key]));
35
+ for (const [variableName, ownValue] of Object.entries(styles)) {
36
+ const inheritedValue = computedStyles?.getPropertyValue(variableName).trim() ?? "";
37
+ const colorKey = colorKeys.get(variableName);
38
+ if (inheritedValue.length === 0) {
39
+ effectiveStyles[variableName] = ownValue;
40
+ inlineStyles[variableName] = ownValue;
41
+ continue;
42
+ }
43
+ if (portal) {
44
+ effectiveStyles[variableName] = colorKey ? ownValue : inheritedValue;
45
+ if (inheritedValue !== ownValue) inlineStyles[variableName] = ownValue;
46
+ continue;
47
+ }
48
+ if (colorKey) effectiveColors[colorKey] = inheritedValue;
49
+ effectiveStyles[variableName] = inheritedValue;
50
+ }
51
+ return {
52
+ sourceTheme: theme,
53
+ theme: portal ? theme : {
54
+ ...theme,
55
+ colors: effectiveColors
56
+ },
57
+ styles: effectiveStyles,
58
+ stylesDiff: mergeStyles(inlineStyles)
59
+ };
60
+ }
61
+ function measureWithoutFallback(element, styles, measure) {
62
+ for (const variableName of Object.keys(styles)) element.style.removeProperty(variableName);
63
+ try {
64
+ return measure();
65
+ } finally {
66
+ for (const [variableName, value] of Object.entries(styles)) element.style.setProperty(variableName, value);
67
+ }
68
+ }
69
+ function EmbedThemeBoundary({ theme, portal = false, children }) {
70
+ const elementRef = useRef(null);
71
+ const styles = useMemo(() => stylesForEmbedTheme(theme), [theme]);
72
+ const [resolution, setResolution] = useState();
73
+ const currentResolution = resolution?.sourceTheme === theme ? resolution : void 0;
74
+ useIsomorphicLayoutEffect(() => {
75
+ const element = elementRef.current;
76
+ if (element) {
77
+ const resolvedStyles = stylesForEmbedTheme(theme, element);
78
+ setResolution(measureWithoutFallback(element, styles, () => resolveEmbedTheme(element, theme, resolvedStyles, portal)));
79
+ }
80
+ }, [
81
+ portal,
82
+ theme,
83
+ styles
84
+ ]);
85
+ const effectiveTheme = currentResolution?.theme ?? theme;
86
+ const effectiveStyles = currentResolution?.styles ?? styles;
87
+ return /* @__PURE__ */ jsx(ThemeContext.Provider, {
88
+ value: effectiveTheme,
89
+ children: jsx(ThemeStylesContext.Provider, {
90
+ value: effectiveStyles,
91
+ children: /* @__PURE__ */ jsx("div", {
92
+ ref: elementRef,
93
+ style: currentResolution ? currentResolution.stylesDiff : styles,
94
+ className: "c3a7pha",
95
+ children
96
+ })
97
+ })
98
+ });
99
+ }
100
+ function EmbedPortalThemeBoundary(props) {
101
+ return /* @__PURE__ */ jsx(EmbedThemeBoundary, {
102
+ ...props,
103
+ portal: true
104
+ });
105
+ }
106
+ var ignorePaletteOverride = () => {};
107
+ /**
108
+ * Establishes the UI-kit environment for one embedded React root.
109
+ * Server output uses the standalone fallback; host variables are adopted during the first client layout.
110
+ */
111
+ function Root({ mode, palette, children }) {
112
+ const theme = themeFromPalette(palette, mode);
113
+ const thematicContextValue = useMemo(() => ({
114
+ palette,
115
+ truePalette: palette,
116
+ setPalette: ignorePaletteOverride
117
+ }), [palette]);
118
+ return /* @__PURE__ */ jsx(ThemePreferenceContext.Provider, {
119
+ value: mode,
120
+ children: jsx(ThematicContext.Provider, {
121
+ value: thematicContextValue,
122
+ children: /* @__PURE__ */ jsx(ThemePaletteContext.Provider, {
123
+ value: palette,
124
+ children: /* @__PURE__ */ jsx(EmbedPortalBoundaryContext.Provider, {
125
+ value: EmbedPortalThemeBoundary,
126
+ children: /* @__PURE__ */ jsx(EmbedThemeBoundary, {
127
+ theme,
128
+ children
129
+ })
130
+ })
131
+ })
132
+ })
133
+ });
134
+ }
135
+ /** Carries the current embedded UI-kit environment into a consumer-owned DOM portal. */
136
+ function PortalBridge({ children }) {
137
+ const EmbedPortalBoundary = useContext(EmbedPortalBoundaryContext);
138
+ const theme = useContext(ThemeContext);
139
+ invariant(EmbedPortalBoundary, `<FiberyEmbed.PortalBridge> must be inside <FiberyEmbed.Root>`);
140
+ return /* @__PURE__ */ jsx(EmbedPortalBoundary, {
141
+ theme,
142
+ children
143
+ });
144
+ }
145
+ var FiberyEmbed = {
146
+ Root,
147
+ PortalBridge
148
+ };
149
+ //#endregion
150
+ export { FiberyEmbed };
@@ -0,0 +1 @@
1
+ .c3a7pha{display:contents;}
@@ -0,0 +1,21 @@
1
+ //#region src/layout-variables.d.ts
2
+ declare const defaultLayoutVariables: {
3
+ readonly "--safe-area-inset-left": "var(--app-safe-area-inset-left, env(safe-area-inset-left))";
4
+ readonly "--safe-area-inset-right": "var(--app-safe-area-inset-right, env(safe-area-inset-right))";
5
+ readonly "--safe-area-inset-top": "var(--app-safe-area-inset-top, env(safe-area-inset-top))";
6
+ readonly "--safe-area-inset-bottom": "var(--app-safe-area-inset-bottom, env(safe-area-inset-bottom))";
7
+ readonly "--keyboard-inset-bottom": "var(--app-current-keyboard-height, 0px)";
8
+ readonly "--fibery-on-screen-keyboard-height": "350px";
9
+ readonly "--fibery-layout-menuItemHeight": "32px";
10
+ readonly "--fibery-layout-sidebarMenuItemHeight": "28px";
11
+ readonly "--fibery-layout-sidebarMenuIconSize": "18px";
12
+ readonly "--fibery-layout-listRowSurfaceFontSize": "14px";
13
+ };
14
+ declare const mobileLayoutVariables: {
15
+ readonly "--fibery-layout-menuItemHeight": "44px";
16
+ readonly "--fibery-layout-sidebarMenuItemHeight": "44px";
17
+ readonly "--fibery-layout-sidebarMenuIconSize": "20px";
18
+ readonly "--fibery-layout-listRowSurfaceFontSize": "16px";
19
+ };
20
+ //#endregion
21
+ export { defaultLayoutVariables, mobileLayoutVariables };
@@ -0,0 +1,25 @@
1
+ import { listRowSurfaceFontSizeVar, menuItemHeightVar, sidebarMenuIconSizeVar, sidebarMenuItemHeightVar } from "./theming.generated.js";
2
+ import { layout } from "./design-system/layout.js";
3
+ import { fontSize } from "./design-system/typography.js";
4
+ import { keyboardHeightVar, keyboardInsetBottomVar, safeAreaInsetBottomVar, safeAreaInsetLeftVar, safeAreaInsetRightVar, safeAreaInsetTopVar } from "./mobile-styles.js";
5
+ //#region src/layout-variables.ts
6
+ var defaultLayoutVariables = {
7
+ [safeAreaInsetLeftVar]: "var(--app-safe-area-inset-left, env(safe-area-inset-left))",
8
+ [safeAreaInsetRightVar]: "var(--app-safe-area-inset-right, env(safe-area-inset-right))",
9
+ [safeAreaInsetTopVar]: "var(--app-safe-area-inset-top, env(safe-area-inset-top))",
10
+ [safeAreaInsetBottomVar]: "var(--app-safe-area-inset-bottom, env(safe-area-inset-bottom))",
11
+ [keyboardInsetBottomVar]: "var(--app-current-keyboard-height, 0px)",
12
+ [keyboardHeightVar]: "350px",
13
+ [menuItemHeightVar]: `${layout.menuItemHeight}px`,
14
+ [sidebarMenuItemHeightVar]: `${layout.newMenuItemHeight}px`,
15
+ [sidebarMenuIconSizeVar]: `${layout.newMenuIconSize}px`,
16
+ [listRowSurfaceFontSizeVar]: `${fontSize.sm}px`
17
+ };
18
+ var mobileLayoutVariables = {
19
+ [menuItemHeightVar]: `${layout.mobileMenuItemHeight}px`,
20
+ [sidebarMenuItemHeightVar]: `${layout.mobileSidebarMenuItemHeight}px`,
21
+ [sidebarMenuIconSizeVar]: `${layout.mobileSidebarIconSize}px`,
22
+ [listRowSurfaceFontSizeVar]: `${fontSize.md}px`
23
+ };
24
+ //#endregion
25
+ export { defaultLayoutVariables, mobileLayoutVariables };
@@ -80,6 +80,7 @@ var NumberInputInlineWithAutosize = ({ value, numberFormat, numberPrecision, for
80
80
  }),
81
81
  onStep: handleStep,
82
82
  onClick: stopPropagation,
83
+ wheel: false,
83
84
  ...rest,
84
85
  className: cx(inputCss, pill && pillCss, invalid && invalidCss)
85
86
  })
@@ -58,6 +58,7 @@ var NumberInputInline = forwardRef(({ value, numberFormat, numberPrecision, form
58
58
  onKeyDown,
59
59
  onStep: handleStep,
60
60
  onClick: stopPropagation,
61
+ wheel: false,
61
62
  ...rest
62
63
  })
63
64
  });
@@ -0,0 +1,11 @@
1
+ import { ThemeMode, ThemePreference } from "./theme-settings-core.js";
2
+ import { ReactNode } from "react";
3
+ //#region src/root-theme-provider.d.ts
4
+ declare function RootThemeProvider({ initialThemeMode, initialPreference, isArchitect, children }: {
5
+ initialThemeMode: ThemeMode;
6
+ initialPreference: ThemePreference;
7
+ isArchitect?: boolean;
8
+ children: ReactNode;
9
+ }): JSX.Element;
10
+ //#endregion
11
+ export { RootThemeProvider };
@@ -0,0 +1,107 @@
1
+ import "./root-theme-provider.wyw-in-js.css";
2
+ import { selectPalette } from "./palette-generator.js";
3
+ import { neutralStyles, warmStyles } from "./theming.generated.js";
4
+ import { themeFromPalette } from "./design-system/theme.js";
5
+ import { locateThemeBundle } from "./theme-styles.js";
6
+ import { RootThemeStylesContext, ThematicContext, ThemeContext, ThemePaletteContext, ThemePreferenceContext, ThemeProvider, ThemeStylesContext } from "./theme-provider.js";
7
+ import { subscribeOnThemeModeChange, subscribeOnThemePreferenceChange } from "./theme-settings-core.js";
8
+ import { useWarmPreference } from "./theme-settings.js";
9
+ import { globalOverrides } from "./antd/global-overrides.js";
10
+ import { layoutStyles } from "./layout-styles.js";
11
+ /* empty css */
12
+ import { jsx } from "react/jsx-runtime";
13
+ import { useEffect, useInsertionEffect, useLayoutEffect, useMemo, useState } from "react";
14
+ //#region src/root-theme-provider.tsx
15
+ var darkClassName = "dark-theme";
16
+ var warmClassName = "warm-palette";
17
+ var warmStickyClassName = "warm-palette-sticky";
18
+ /**
19
+ * Document-level theming. Kept out of `theme-provider.tsx` so that importing a context or a
20
+ * `ThemeProvider` never drags these `:global()` blocks into an embedding host's document.
21
+ */
22
+ var globals = "g16cgj2y-globals";
23
+ function chooseGlobalStyles(themeMode, warm) {
24
+ const htmlElement = document.documentElement;
25
+ htmlElement.classList.toggle(darkClassName, themeMode === "dark");
26
+ htmlElement.classList.toggle(warmClassName, warm || htmlElement.classList.contains(warmStickyClassName));
27
+ const colorScheme = themeMode === "dark" ? "dark" : "light";
28
+ htmlElement.style.colorScheme = colorScheme;
29
+ document.querySelector("meta[name=\"color-scheme\"]")?.setAttribute("content", colorScheme);
30
+ htmlElement.classList.add(globals);
31
+ htmlElement.classList.add(globalOverrides);
32
+ }
33
+ function useUpdateBrowserThemeColor(light, dark) {
34
+ useEffect(() => {
35
+ const lightEl = document.querySelector("meta[name=\"theme-color\"][media*=\"light\"]");
36
+ const darkEl = document.querySelector("meta[name=\"theme-color\"][media*=\"dark\"]");
37
+ lightEl?.setAttribute("content", light.colors.mainBg);
38
+ darkEl?.setAttribute("content", dark.colors.mainBg);
39
+ }, [light.colors.mainBg, dark.colors.mainBg]);
40
+ }
41
+ function RootThemeProvider({ initialThemeMode, initialPreference, isArchitect = false, children }) {
42
+ const [mode, setMode] = useState(initialThemeMode);
43
+ useEffect(() => subscribeOnThemeModeChange(setMode), []);
44
+ const dark = mode === "dark";
45
+ const [warm] = useWarmPreference();
46
+ useInsertionEffect(() => chooseGlobalStyles(mode, warm), [mode, warm]);
47
+ const [paletteOverride, setPaletteOverride] = useState(null);
48
+ const truePalette = useMemo(() => selectPalette({
49
+ warmLook: warm,
50
+ isArchitect
51
+ }), [warm, isArchitect]);
52
+ const palette = useMemo(() => paletteOverride ?? truePalette, [paletteOverride, truePalette]);
53
+ let res = /* @__PURE__ */ jsx(ThemeProvider, {
54
+ theme: themeFromPalette(palette, mode),
55
+ children
56
+ });
57
+ const { themes: [lightThemeColors, darkThemeColors] } = locateThemeBundle(warm);
58
+ const styleBundle = warm ? warmStyles : neutralStyles;
59
+ const cssThemeColors = dark ? darkThemeColors : lightThemeColors;
60
+ const cssThemeStyles = dark ? styleBundle.dark : styleBundle.light;
61
+ res = /* @__PURE__ */ jsx(ThemeStylesContext.Provider, {
62
+ value: cssThemeStyles,
63
+ children: res
64
+ });
65
+ res = /* @__PURE__ */ jsx(RootThemeStylesContext.Provider, {
66
+ value: cssThemeStyles,
67
+ children: res
68
+ });
69
+ res = /* @__PURE__ */ jsx(ThemeContext.Provider, {
70
+ value: cssThemeColors,
71
+ children: res
72
+ });
73
+ useUpdateBrowserThemeColor(lightThemeColors, darkThemeColors);
74
+ res = /* @__PURE__ */ jsx(ThemePaletteContext.Provider, {
75
+ value: palette,
76
+ children: res
77
+ });
78
+ const thematicContextValue = useMemo(() => ({
79
+ palette,
80
+ truePalette,
81
+ setPalette: setPaletteOverride
82
+ }), [
83
+ palette,
84
+ truePalette,
85
+ setPaletteOverride
86
+ ]);
87
+ res = /* @__PURE__ */ jsx(ThematicContext.Provider, {
88
+ value: thematicContextValue,
89
+ children: res
90
+ });
91
+ const [themePreference, setThemePreference] = useState(initialPreference);
92
+ useEffect(() => subscribeOnThemePreferenceChange(setThemePreference), []);
93
+ res = /* @__PURE__ */ jsx(ThemePreferenceContext.Provider, {
94
+ value: themePreference,
95
+ children: res
96
+ });
97
+ useLayoutEffect(() => {
98
+ const documentElement = document.documentElement;
99
+ documentElement.classList.add(layoutStyles);
100
+ return () => {
101
+ documentElement.classList.remove(layoutStyles);
102
+ };
103
+ }, []);
104
+ return res;
105
+ }
106
+ //#endregion
107
+ export { RootThemeProvider };