@fibery/ui-kit 13.0.0 → 14.0.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.
Files changed (73) hide show
  1. package/lib/actions-menu/actions-menu-item.js +4 -3
  2. package/lib/actions-menu/actions-menu.js +2 -2
  3. package/lib/actions-menu/context-actions-menu.js +2 -2
  4. package/lib/banner/banner.wyw-in-js.css +2 -2
  5. package/lib/button/button.js +2 -1
  6. package/lib/color-picker/color-picker-or-loader.d.ts +5 -0
  7. package/lib/color-picker/color-picker-or-loader.js +18 -5
  8. package/lib/color-picker/color-picker-or-loader.wyw-in-js.css +1 -1
  9. package/lib/color-picker/index.js +5 -5
  10. package/lib/color-picker/index.wyw-in-js.css +4 -5
  11. package/lib/color-picker/swatch-grid.d.ts +11 -0
  12. package/lib/color-picker/swatch-grid.js +14 -0
  13. package/lib/color-picker/swatch-grid.wyw-in-js.css +1 -0
  14. package/lib/color-picker/swatch.js +2 -9
  15. package/lib/command-menu/index.js +1 -1
  16. package/lib/command-menu/nested-command-menu.js +1 -1
  17. package/lib/date-picker/contexts.d.ts +2 -0
  18. package/lib/date-picker/contexts.js +2 -1
  19. package/lib/date-picker/date-range-picker-popup-content.js +12 -8
  20. package/lib/date-picker/date-range-picker.js +3 -2
  21. package/lib/date-picker/day-with-start-end-buttons.js +13 -18
  22. package/lib/date-picker/single-date-picker-popup-content.js +1 -1
  23. package/lib/date-picker/single-date-picker.js +3 -2
  24. package/lib/emoji-picker/utils/store.js +3 -2
  25. package/lib/empty-state/empty-state.wyw-in-js.css +2 -2
  26. package/lib/file-item/file-item-preview.d.ts +7 -0
  27. package/lib/file-item/file-item-preview.js +31 -0
  28. package/lib/file-item/file-item-preview.wyw-in-js.css +4 -0
  29. package/lib/form-field-loader.d.ts +5 -6
  30. package/lib/form-field-loader.js +7 -10
  31. package/lib/form-field-loader.wyw-in-js.css +2 -1
  32. package/lib/lists/list-row-surface.wyw-in-js.css +1 -1
  33. package/lib/open-popover-tracker.d.ts +2 -4
  34. package/lib/open-popover-tracker.js +14 -22
  35. package/lib/popover/index.js +3 -3
  36. package/lib/preference-setting.d.ts +2 -1
  37. package/lib/preference-setting.js +4 -4
  38. package/lib/rich-text-skeleton.d.ts +9 -0
  39. package/lib/rich-text-skeleton.js +32 -0
  40. package/lib/rich-text-skeleton.wyw-in-js.css +2 -0
  41. package/lib/select/components/menu-list-virtua.js +2 -1
  42. package/lib/select/components/menu-list-virtualized.js +19 -12
  43. package/lib/select/components/menu.d.ts +1 -4
  44. package/lib/select/components/menu.js +2 -9
  45. package/lib/select/components/option.js +5 -2
  46. package/lib/select/select-loader.js +5 -2
  47. package/lib/select/select.d.ts +1 -1
  48. package/lib/select/select.js +3 -3
  49. package/lib/select/styles.js +4 -3
  50. package/lib/select/util.d.ts +2 -0
  51. package/lib/select/util.js +3 -1
  52. package/lib/storage-keys.d.ts +12 -0
  53. package/lib/storage-keys.js +20 -0
  54. package/lib/storage.d.ts +9 -0
  55. package/lib/storage.js +5 -0
  56. package/lib/tab-nav/tab-nav.js +1 -1
  57. package/lib/text.d.ts +5 -0
  58. package/lib/text.js +5 -0
  59. package/lib/thematic-cvd.js +2 -2
  60. package/lib/thematic-state.js +1 -0
  61. package/lib/thematic.js +8 -18
  62. package/lib/theme-bootstrap.js +3 -1
  63. package/lib/theme-css-fallback.d.ts +5 -0
  64. package/lib/theme-css-fallback.js +29 -0
  65. package/lib/theme-css-snapshot.d.ts +8 -1
  66. package/lib/theme-css-snapshot.js +34 -8
  67. package/lib/theme-settings-core.js +7 -8
  68. package/lib/theme-styles.js +5 -8
  69. package/lib/type-badge.js +3 -1
  70. package/package.json +4 -4
  71. package/lib/rich-input-loader.d.ts +0 -7
  72. package/lib/rich-input-loader.js +0 -34
  73. package/lib/rich-input-loader.wyw-in-js.css +0 -2
@@ -1,26 +1,22 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useCallback, useEffect, useId, useMemo, useState } from "react";
2
+ import { useCallback, useEffect, useId, useState } from "react";
3
3
  import { createContext as createContext$1 } from "@fibery/react/src/create-context";
4
4
  //#region src/open-popover-tracker.tsx
5
- var [Provider, useContext$1] = createContext$1("OpenPopoverTrackerContext", {
6
- openPopovers: /* @__PURE__ */ new Set(),
7
- setOpenPopovers: () => {}
8
- });
5
+ var [OpenPopoversProvider, useOpenPopovers] = createContext$1("OpenPopoversContext", /* @__PURE__ */ new Set());
6
+ var [SetOpenPopoversProvider, useSetOpenPopovers] = createContext$1("SetOpenPopoversContext", () => {});
9
7
  var OpenPopoverTrackerProvider = ({ children }) => {
10
8
  const [openPopovers, setOpenPopovers] = useState(/* @__PURE__ */ new Set());
11
- const value = useMemo(() => {
12
- return {
13
- openPopovers,
14
- setOpenPopovers
15
- };
16
- }, [openPopovers, setOpenPopovers]);
17
- return /* @__PURE__ */ jsx(Provider, {
18
- value,
19
- children
9
+ return /* @__PURE__ */ jsx(SetOpenPopoversProvider, {
10
+ value: setOpenPopovers,
11
+ children: /* @__PURE__ */ jsx(OpenPopoversProvider, {
12
+ value: openPopovers,
13
+ children
14
+ })
20
15
  });
21
16
  };
22
- var useOpenPopoverTracker = () => {
23
- const { openPopovers, setOpenPopovers } = useContext$1();
17
+ var useHasOpenPopover = () => useOpenPopovers().size > 0;
18
+ var useOpenPopoverChange = () => {
19
+ const setOpenPopovers = useSetOpenPopovers();
24
20
  const popoverId = useId();
25
21
  const cleanup = useCallback(() => {
26
22
  setOpenPopovers((prev) => {
@@ -35,7 +31,7 @@ var useOpenPopoverTracker = () => {
35
31
  cleanup();
36
32
  };
37
33
  }, []);
38
- const onOpenChange = useCallback((open) => {
34
+ return useCallback((open) => {
39
35
  setOpenPopovers((prev) => {
40
36
  if (open) {
41
37
  const next = new Set(prev);
@@ -48,10 +44,6 @@ var useOpenPopoverTracker = () => {
48
44
  } else return prev;
49
45
  });
50
46
  }, [popoverId, setOpenPopovers]);
51
- return {
52
- hasOpenPopover: openPopovers.size > 0,
53
- onOpenChange
54
- };
55
47
  };
56
48
  //#endregion
57
- export { OpenPopoverTrackerProvider, useOpenPopoverTracker };
49
+ export { OpenPopoverTrackerProvider, useHasOpenPopover, useOpenPopoverChange };
@@ -2,7 +2,7 @@ import "./index.wyw-in-js.css";
2
2
  import { useIsPhone } from "../use-is-phone.js";
3
3
  import { ThemeProvider } from "../theme-provider.js";
4
4
  import { space } from "../design-system/layout.js";
5
- import { useOpenPopoverTracker } from "../open-popover-tracker.js";
5
+ import { useOpenPopoverChange } from "../open-popover-tracker.js";
6
6
  import { getElementRef } from "./get-element-ref.js";
7
7
  import { MobilePopoverProvider } from "./mobile-popover-context.js";
8
8
  import { MobilePopover } from "./mobile-popover.js";
@@ -17,11 +17,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
17
17
  import { cloneElement, forwardRef, isValidElement, useCallback, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
18
18
  import { truthy } from "@fibery/helpers/src/_";
19
19
  import { createContext as createContext$1 } from "@fibery/react/src/create-context";
20
+ import { composeRefs, useComposedRefs } from "@fibery/react/src/use-composed-refs";
20
21
  import { composeEventHandlers } from "@fibery/react/src/compose-event-handlers";
21
22
  import { useControllableState } from "@fibery/react/src/use-controllable-state";
22
23
  import { createPortal } from "react-dom";
23
24
  import { stopPropagation } from "@fibery/react/src/stop-propagation";
24
- import { composeRefs, useComposedRefs } from "@fibery/react/src/use-composed-refs";
25
25
  import { usePointerDownOutside } from "@fibery/react/src/use-pointer-down-outside";
26
26
  import { createPopper } from "@popperjs/core";
27
27
  import { FocusScope } from "@radix-ui/react-focus-scope";
@@ -40,7 +40,7 @@ var PopoverRoot = (props) => {
40
40
  onOpenChange?.(false);
41
41
  onClose?.(event);
42
42
  }, [onOpenChange, onClose]);
43
- const { onOpenChange: onOpenPopoverChange } = useOpenPopoverTracker();
43
+ const onOpenPopoverChange = useOpenPopoverChange();
44
44
  useEffect(() => {
45
45
  onOpenPopoverChange(open);
46
46
  return () => onOpenPopoverChange(false);
@@ -1,6 +1,7 @@
1
+ import { UiKitStorageKey } from "./storage.js";
1
2
  //#region src/preference-setting.d.ts
2
3
  export declare function createPreferenceSetting<T>({ key, parse, stringify, defaultValue }: {
3
- key: string;
4
+ key: UiKitStorageKey;
4
5
  parse: (raw: string) => T | undefined;
5
6
  stringify: (value: T) => string;
6
7
  defaultValue: T;
@@ -1,3 +1,4 @@
1
+ import { localStorage } from "./storage.js";
1
2
  import { makeSubject } from "@fibery/helpers/src/subject";
2
3
  //#region src/preference-setting.ts
3
4
  function createPreferenceSetting({ key, parse, stringify, defaultValue }) {
@@ -34,16 +35,15 @@ function createPreferenceSetting({ key, parse, stringify, defaultValue }) {
34
35
  cb(value);
35
36
  };
36
37
  const unsubscribe = values.subscribe(tracked);
37
- const storageListener = () => {
38
+ const unsubscribeOtherTabs = localStorage.subscribe(key, () => {
38
39
  const next = load();
39
40
  if (prev !== next) {
40
41
  prev = next;
41
42
  cb(next);
42
43
  }
43
- };
44
- window.addEventListener("storage", storageListener);
44
+ });
45
45
  return () => {
46
- window.removeEventListener("storage", storageListener);
46
+ unsubscribeOtherTabs();
47
47
  unsubscribe();
48
48
  };
49
49
  }
@@ -0,0 +1,9 @@
1
+ //#region src/rich-text-skeleton.d.ts
2
+ declare const linesPerParagraph: {
3
+ readonly line: readonly [1];
4
+ readonly document: readonly [5, 4];
5
+ };
6
+ export declare function RichTextSkeleton({ variant }: {
7
+ variant?: keyof typeof linesPerParagraph;
8
+ }): import("react").JSX.Element;
9
+ //#endregion
@@ -0,0 +1,32 @@
1
+ import "./rich-text-skeleton.wyw-in-js.css";
2
+ import { Skeleton } from "./skeleton.js";
3
+ import { useLoaderGateDelayStyle } from "./loader-gate-start.js";
4
+ /* empty css */
5
+ import { jsx } from "react/jsx-runtime";
6
+ //#region src/rich-text-skeleton.tsx
7
+ var linesPerParagraph = {
8
+ line: [1],
9
+ document: [5, 4]
10
+ };
11
+ var paragraphStyle = "pwky6u0-paragraph";
12
+ var lineStyle = "l10yorx-line";
13
+ function RichTextSkeleton({ variant = "line" }) {
14
+ const paragraphs = linesPerParagraph[variant];
15
+ const firstLineIndexes = paragraphs.map((_, paragraph) => paragraphs.slice(0, paragraph).reduce((sum, lines) => sum + lines, 0));
16
+ return /* @__PURE__ */ jsx("div", {
17
+ style: useLoaderGateDelayStyle(),
18
+ children: paragraphs.map((lines, paragraph) => /* @__PURE__ */ jsx("div", {
19
+ className: paragraphStyle,
20
+ children: Array.from({ length: lines }, (_, line) => /* @__PURE__ */ jsx("div", {
21
+ className: lineStyle,
22
+ children: /* @__PURE__ */ jsx(Skeleton, {
23
+ margins: false,
24
+ width: lines > 1 && line === lines - 1 ? 300 : "fill",
25
+ index: firstLineIndexes[paragraph] + line
26
+ })
27
+ }, line))
28
+ }, paragraph))
29
+ });
30
+ }
31
+ //#endregion
32
+ export { RichTextSkeleton };
@@ -0,0 +1,2 @@
1
+ .pwky6u0-paragraph{margin-top:3px;margin-bottom:3px;padding-top:3px;padding-bottom:3px;}
2
+ .l10yorx-line{display:flex;align-items:center;height:24px;}
@@ -1,4 +1,5 @@
1
1
  import { ReactSelectRefContext } from "../util.js";
2
+ import { fitMenuListHeight } from "./menu.js";
2
3
  import { isGroupChild, isReactElementWithProps } from "../reflection.js";
3
4
  import { jsx } from "react/jsx-runtime";
4
5
  import { Children, useContext, useEffect, useMemo, useRef, useState } from "react";
@@ -45,7 +46,7 @@ function MenuListVirtua(props) {
45
46
  theme
46
47
  ]);
47
48
  const items = useMemo(() => flattenGroupChildren(children, renderGroup), [children, renderGroup]);
48
- const estimatedHeight = Math.min(items.length * DEFAULT_ITEM_SIZE_ESTIMATE, maxHeight);
49
+ const estimatedHeight = Math.min(items.length * DEFAULT_ITEM_SIZE_ESTIMATE, fitMenuListHeight(maxHeight));
49
50
  const focusedIndex = useMemo(() => {
50
51
  if (!focusedOption) return -1;
51
52
  return items.findIndex((child) => {
@@ -1,6 +1,7 @@
1
1
  import { useIsPhone } from "../../use-is-phone.js";
2
2
  import { layout } from "../../design-system/layout.js";
3
- import { ReactSelectRefContext } from "../util.js";
3
+ import { ReactSelectRefContext, VirtualizedMenuListContext } from "../util.js";
4
+ import { fitMenuListHeight } from "./menu.js";
4
5
  import { useSelectControlSettings } from "../select-control-settings-context.js";
5
6
  import { jsx } from "react/jsx-runtime";
6
7
  import { Children, useContext, useEffect, useMemo, useRef, useState } from "react";
@@ -54,11 +55,13 @@ function MenuListVirtualized(props) {
54
55
  theme
55
56
  ]);
56
57
  const flattenChildren = useMemo(() => flattenGroupChildren(children, renderGroup), [children, renderGroup]);
57
- const menuHeight = useMemo(() => Math.min(flattenChildren.length * itemHeight, maxHeight), [
58
+ const menuHeight = useMemo(() => Math.min(flattenChildren.length * itemHeight, fitMenuListHeight(maxHeight)), [
58
59
  flattenChildren.length,
59
60
  itemHeight,
60
61
  maxHeight
61
62
  ]);
63
+ const focusedOptionValue = focusedOption ? selectProps.getOptionValue(focusedOption) : null;
64
+ const { inputValue } = selectProps;
62
65
  const focusedIndex = useMemo(() => {
63
66
  if (!focusedOption) return -1;
64
67
  return flattenChildren.findIndex((child) => {
@@ -101,7 +104,7 @@ function MenuListVirtualized(props) {
101
104
  window.cancelAnimationFrame(scrollTimeoutRef.current);
102
105
  scrollTimeoutRef.current = void 0;
103
106
  }
104
- if (initialFocusedOption && focusedOption && focusedIndex >= 0 && virtuoso.current) scrollTimeoutRef.current = window.requestAnimationFrame(() => {
107
+ if (initialFocusedOption && focusedOptionValue !== null && focusedIndex >= 0 && virtuoso.current) scrollTimeoutRef.current = window.requestAnimationFrame(() => {
105
108
  if (!virtuoso.current) return;
106
109
  virtuoso.current.getState((state) => {
107
110
  const focusedItemTop = focusedIndex * itemHeight;
@@ -130,7 +133,8 @@ function MenuListVirtualized(props) {
130
133
  }
131
134
  };
132
135
  }, [
133
- focusedOption,
136
+ focusedOptionValue,
137
+ inputValue,
134
138
  focusedIndex,
135
139
  initialFocusedOption,
136
140
  itemHeight,
@@ -140,14 +144,17 @@ function MenuListVirtualized(props) {
140
144
  return /* @__PURE__ */ jsx("div", {
141
145
  ...innerProps,
142
146
  style: getStyles("menuList", props),
143
- children: /* @__PURE__ */ jsx(Virtuoso, {
144
- ref: virtuoso,
145
- scrollerRef: innerRef,
146
- style: isPhone && inPopover ? void 0 : { height: menuHeight },
147
- fixedItemHeight: itemHeight,
148
- data: flattenChildren,
149
- totalCount: flattenChildren.length,
150
- itemContent: drawListElement
147
+ children: /* @__PURE__ */ jsx(VirtualizedMenuListContext.Provider, {
148
+ value: true,
149
+ children: /* @__PURE__ */ jsx(Virtuoso, {
150
+ ref: virtuoso,
151
+ scrollerRef: innerRef,
152
+ style: isPhone && inPopover ? void 0 : { height: menuHeight },
153
+ fixedItemHeight: itemHeight,
154
+ data: flattenChildren,
155
+ totalCount: flattenChildren.length,
156
+ itemContent: drawListElement
157
+ })
151
158
  })
152
159
  });
153
160
  }
@@ -1,14 +1,11 @@
1
1
  import { GroupBase as GroupBase$1 } from "../util.js";
2
2
  import "../select.js";
3
- import { ComponentType } from "react";
4
3
  import { CSSObjectWithLabel, MenuProps } from "react-select";
5
4
  import { MenuPortalProps } from "react-select/dist/declarations/src/components/Menu";
6
5
  //#region src/select/components/menu.d.ts
7
6
  export declare const MenuListNulledStyles: CSSObjectWithLabel;
8
7
  export declare const MenuNulledStyles: CSSObjectWithLabel;
9
- export declare function fitMenuListIntoMenu<P extends {
10
- maxHeight: number;
11
- }>(MenuList: ComponentType<P>): ComponentType<P>;
8
+ export declare const fitMenuListHeight: (maxHeight: number) => number;
12
9
  export declare function Menu<T, U extends boolean, V extends GroupBase$1<T>>(props: MenuProps<T, U, V>): import("react").JSX.Element;
13
10
  export declare function MenuTransparent<T, U extends boolean, V extends GroupBase$1<T>>(props: MenuProps<T, U, V>): import("react").JSX.Element;
14
11
  export declare function MenuPortal<T, U extends boolean, V extends GroupBase$1<T>>(props: MenuPortalProps<T, U, V>): import("react").JSX.Element;
@@ -20,14 +20,7 @@ var MenuNulledStyles = {
20
20
  paddingBottom: menuPaddingBlock,
21
21
  borderRadius: border.radius8
22
22
  };
23
- function fitMenuListIntoMenu(MenuList) {
24
- return function MenuListFittedIntoMenu(props) {
25
- return /* @__PURE__ */ jsx(MenuList, {
26
- ...props,
27
- maxHeight: props.maxHeight - 2 * menuPaddingBlock
28
- });
29
- };
30
- }
23
+ var fitMenuListHeight = (maxHeight) => maxHeight - 2 * menuPaddingBlock;
31
24
  var menuCss = "m1kmibzm-menu";
32
25
  function Menu(props) {
33
26
  return /* @__PURE__ */ jsx(components.Menu, {
@@ -52,4 +45,4 @@ function MenuPortal(props) {
52
45
  });
53
46
  }
54
47
  //#endregion
55
- export { Menu, MenuListNulledStyles, MenuNulledStyles, MenuPortal, MenuTransparent, fitMenuListIntoMenu };
48
+ export { Menu, MenuListNulledStyles, MenuNulledStyles, MenuPortal, MenuTransparent, fitMenuListHeight };
@@ -2,12 +2,12 @@ import "./option.wyw-in-js.css";
2
2
  import { mobileRootSelector } from "../../mobile-styles.js";
3
3
  import { layout, space } from "../../design-system/layout.js";
4
4
  import { TooltipIfOverflown } from "../../tooltip-if-overflown.js";
5
- import { isPureTextChildren } from "../util.js";
5
+ import { VirtualizedMenuListContext, isPureTextChildren } from "../util.js";
6
6
  import { ListRowContent, ListRowSurface } from "../../lists/list-row-surface.js";
7
7
  /* empty css */
8
8
  import { cx } from "@linaria/core";
9
9
  import { jsx } from "react/jsx-runtime";
10
- import { useMemo } from "react";
10
+ import { useContext, useMemo } from "react";
11
11
  import { components } from "react-select";
12
12
  //#region src/select/components/option.tsx
13
13
  var OptionNulledVitualizedStyles = {
@@ -26,6 +26,7 @@ var OptionNulledStyles = {
26
26
  color: ""
27
27
  };
28
28
  var OptionRootClass = "o1eljpa1-OptionRoot";
29
+ var noopRef = () => {};
29
30
  var OptionWithTextContent = "o1wv774h-OptionWithTextContent";
30
31
  /**
31
32
  * Attention! Do not use this option for potentially long lists inside React Select
@@ -33,6 +34,7 @@ var OptionWithTextContent = "o1wv774h-OptionWithTextContent";
33
34
  * */
34
35
  function OptionSlow({ children, ...rest }) {
35
36
  const { isDisabled, isSelected, isFocused } = rest;
37
+ const innerRef = useContext(VirtualizedMenuListContext) ? noopRef : rest.innerRef;
36
38
  const isPureText = useMemo(() => isPureTextChildren(children), [children]);
37
39
  const surfaceProps = {
38
40
  focused: isFocused,
@@ -42,6 +44,7 @@ function OptionSlow({ children, ...rest }) {
42
44
  if ("onMouseOver" in rest.innerProps) surfaceProps.hovered = false;
43
45
  return /* @__PURE__ */ jsx(components.Option, {
44
46
  ...rest,
47
+ innerRef,
45
48
  className: cx(rest.className, OptionRootClass),
46
49
  children: jsx(ListRowSurface, {
47
50
  ...surfaceProps,
@@ -1,7 +1,10 @@
1
- import { SkeletonList } from "../skeleton.js";
1
+ import { Skeleton } from "../skeleton.js";
2
2
  import { FormFieldLoader } from "../form-field-loader.js";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  //#region src/select/select-loader.tsx
5
- var SelectLoader = () => /* @__PURE__ */ jsx(FormFieldLoader, { children: /* @__PURE__ */ jsx(SkeletonList, { amount: 1 }) });
5
+ var SelectLoader = () => /* @__PURE__ */ jsx(FormFieldLoader, {
6
+ control: "select",
7
+ children: /* @__PURE__ */ jsx(Skeleton, { margins: false })
8
+ });
6
9
  //#endregion
7
10
  export { SelectLoader };
@@ -6,7 +6,7 @@ import { ActionMeta, ControlProps, MenuListProps, MenuProps, MultiValue, MultiVa
6
6
  import { CreatableProps } from "react-select/creatable";
7
7
  //#region src/select/select.d.ts
8
8
  export declare function composeStyles<T, U extends boolean, V extends GroupBase<T>>(styles: StylesConfig<T, U, V>[]): StylesConfig<T, U, V>;
9
- export type SelectProps<T = unknown, U extends boolean = boolean, V extends GroupBase<T> = GroupBase<T>> = Omit<Omit<Omit<BaseSelectProps<T, U, V>, "isMulti">, "backspaceRemovesValue">, "isDisabled"> & {
9
+ export type SelectProps<T = unknown, U extends boolean = boolean, V extends GroupBase<T> = GroupBase<T>> = Omit<BaseSelectProps<T, U, V>, "isMulti" | "backspaceRemovesValue" | "isDisabled"> & {
10
10
  virtualized?: boolean;
11
11
  title?: string;
12
12
  isCollectionMode?: U;
@@ -1,7 +1,7 @@
1
1
  import { useIsPhone } from "../use-is-phone.js";
2
2
  import { ReactSelectRefContext, countOptions } from "./util.js";
3
3
  import { GroupHeading } from "./components/group-heading.js";
4
- import { Menu, MenuPortal, fitMenuListIntoMenu } from "./components/menu.js";
4
+ import { Menu, MenuPortal } from "./components/menu.js";
5
5
  import { Option, OptionSlow } from "./components/option.js";
6
6
  import { makeComponentsStyles, makeNonVirtualizedStyles, makeVirtualizedStyles, makeZIndexStyles } from "./styles.js";
7
7
  import { ClearIndicator, NoClearIndicator } from "./components/clear-indicator.js";
@@ -13,8 +13,8 @@ import { MenuListVirtua } from "./components/menu-list-virtua.js";
13
13
  import { jsx } from "react/jsx-runtime";
14
14
  import { forwardRef, useCallback, useMemo, useRef, useState } from "react";
15
15
  import { truthy } from "@fibery/helpers/src/_";
16
- import { composeEventHandlers } from "@fibery/react/src/compose-event-handlers";
17
16
  import { useComposedRefs } from "@fibery/react/src/use-composed-refs";
17
+ import { composeEventHandlers } from "@fibery/react/src/compose-event-handlers";
18
18
  import BaseSelect, { components as reactSelectComponents, createFilter, mergeStyles } from "react-select";
19
19
  import BaseCreatableSelect from "react-select/creatable";
20
20
  //#region src/select/select.tsx
@@ -39,7 +39,7 @@ function useSelectComponents({ components, optionsCount, virtualized, isCollecti
39
39
  Option: shouldUseFastOption ? Option : OptionSlow,
40
40
  ...components,
41
41
  Group: virtualized ? GroupVirtualized : components?.Group ? components.Group : reactSelectComponents.Group,
42
- MenuList: fitMenuListIntoMenu(virtualized ? MenuListVirtualized : components?.MenuList ? components.MenuList : reactSelectComponents.MenuList)
42
+ MenuList: virtualized ? MenuListVirtualized : components?.MenuList ? components.MenuList : reactSelectComponents.MenuList
43
43
  }), [
44
44
  components,
45
45
  shouldUseFastOption,
@@ -2,7 +2,7 @@ import "./styles.wyw-in-js.css";
2
2
  import { border, layout, space } from "../design-system/layout.js";
3
3
  import { inputOverrides } from "../antd/styles.js";
4
4
  import { groupHeadingNulledStyles } from "./components/group-heading.js";
5
- import { MenuListNulledStyles, MenuNulledStyles } from "./components/menu.js";
5
+ import { MenuListNulledStyles, MenuNulledStyles, fitMenuListHeight } from "./components/menu.js";
6
6
  import { OptionNulledStyles, OptionNulledVitualizedStyles } from "./components/option.js";
7
7
  import "./constants.js";
8
8
  /* empty css */
@@ -115,9 +115,10 @@ var makeComponentsStyles = () => ({
115
115
  ...provided,
116
116
  ...MenuNulledStyles
117
117
  }),
118
- menuList: (provided) => ({
118
+ menuList: (provided, props) => ({
119
119
  ...provided,
120
- ...MenuListNulledStyles
120
+ ...MenuListNulledStyles,
121
+ maxHeight: fitMenuListHeight(props.maxHeight)
121
122
  }),
122
123
  container: (provided, state) => ({
123
124
  ...provided,
@@ -5,6 +5,8 @@ import { GroupBase as GroupBase$1, OptionsOrGroups, SelectInstance } from "react
5
5
  * API used by ReactSelect internal partials (at least VirtualizedMenuList).
6
6
  */
7
7
  export declare const ReactSelectRefContext: import("react").Context<RefObject<SelectInstance | null>>;
8
+ /** Inside MenuListVirtualized, which scrolls the focused option into view itself. */
9
+ export declare const VirtualizedMenuListContext: import("react").Context<boolean>;
8
10
  export type GroupBase<T> = GroupBase$1<T> & {
9
11
  separator?: boolean;
10
12
  separatorMargin?: number;
@@ -5,6 +5,8 @@ import { isRecord } from "@fibery/helpers/src/_";
5
5
  * API used by ReactSelect internal partials (at least VirtualizedMenuList).
6
6
  */
7
7
  var ReactSelectRefContext = createContext({ current: null });
8
+ /** Inside MenuListVirtualized, which scrolls the focused option into view itself. */
9
+ var VirtualizedMenuListContext = createContext(false);
8
10
  function isGroup(optionOrGroup) {
9
11
  return isRecord(optionOrGroup) && "options" in optionOrGroup;
10
12
  }
@@ -19,4 +21,4 @@ function isPureTextChildren(children) {
19
21
  return !Children.toArray(children).some((child) => !(typeof child === "string" || typeof child === "number"));
20
22
  }
21
23
  //#endregion
22
- export { ReactSelectRefContext, countOptions, isGroup, isPureTextChildren };
24
+ export { ReactSelectRefContext, VirtualizedMenuListContext, countOptions, isGroup, isPureTextChildren };
@@ -0,0 +1,12 @@
1
+ //#region src/storage-keys.d.ts
2
+ export declare const uiKitStorageKeys: {
3
+ readonly localStorage: {
4
+ readonly keys: readonly ["theme-preference", "warm", "architect-mode", "thematic-palette", "thematic-pinned", "thematic-gamut"];
5
+ readonly prefixes: readonly ["emoji-mart."];
6
+ };
7
+ readonly sessionStorage: {
8
+ readonly keys: readonly [];
9
+ readonly prefixes: readonly [];
10
+ };
11
+ };
12
+ //#endregion
@@ -0,0 +1,20 @@
1
+ //#region src/storage-keys.ts
2
+ var uiKitStorageKeys = {
3
+ localStorage: {
4
+ keys: [
5
+ "theme-preference",
6
+ "warm",
7
+ "architect-mode",
8
+ "thematic-palette",
9
+ "thematic-pinned",
10
+ "thematic-gamut"
11
+ ],
12
+ prefixes: ["emoji-mart."]
13
+ },
14
+ sessionStorage: {
15
+ keys: [],
16
+ prefixes: []
17
+ }
18
+ };
19
+ //#endregion
20
+ export { uiKitStorageKeys };
@@ -0,0 +1,9 @@
1
+ import { uiKitStorageKeys } from "./storage-keys.js";
2
+ import { StorageKey } from "@fibery/helpers/src/storage-read";
3
+ //#region src/storage.d.ts
4
+ export type UiKitStorageKey = StorageKey<typeof uiKitStorageKeys.localStorage>;
5
+ export declare const localStorage: import("@fibery/helpers/src/storage").ManagedStorage<{
6
+ readonly keys: readonly ["theme-preference", "warm", "architect-mode", "thematic-palette", "thematic-pinned", "thematic-gamut"];
7
+ readonly prefixes: readonly ["emoji-mart."];
8
+ }>;
9
+ //#endregion
package/lib/storage.js ADDED
@@ -0,0 +1,5 @@
1
+ import { typedStorage } from "@fibery/helpers/src/storage";
2
+ //#region src/storage.ts
3
+ var { localStorage } = typedStorage();
4
+ //#endregion
5
+ export { localStorage };
@@ -5,9 +5,9 @@ import { cx } from "@linaria/core";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { forwardRef, useEffect, useLayoutEffect, useRef, useState } from "react";
7
7
  import { createContext as createContext$1 } from "@fibery/react/src/create-context";
8
+ import { useComposedRefs } from "@fibery/react/src/use-composed-refs";
8
9
  import { useResizeObserver } from "@fibery/react/src/use-resize-observer";
9
10
  import { useCallbackRef } from "@fibery/react/src/use-callback-ref";
10
- import { useComposedRefs } from "@fibery/react/src/use-composed-refs";
11
11
  import { NavigationMenu, NavigationMenuItem, NavigationMenuLink, NavigationMenuList } from "@radix-ui/react-navigation-menu";
12
12
  //#region src/tab-nav/tab-nav.tsx
13
13
  var positionIndicator = (indicator, activeItem) => {
package/lib/text.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ //#region src/text.d.ts
2
+ export declare const Text: ({ children }: {
3
+ children: string;
4
+ }) => import("react").JSX.Element;
5
+ //#endregion
package/lib/text.js ADDED
@@ -0,0 +1,5 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ //#region src/text.tsx
3
+ var Text = ({ children }) => /* @__PURE__ */ jsx("span", { children });
4
+ //#endregion
5
+ export { Text };
@@ -26,14 +26,14 @@ function CvdSection({ state }) {
26
26
  };
27
27
  return /* @__PURE__ */ jsxs(Fragment, { children: [
28
28
  /* @__PURE__ */ jsx("div", { className: sectionSeparatorCss }),
29
- /* @__PURE__ */ jsxs("div", {
29
+ /* @__PURE__ */ jsx("div", {
30
30
  className: sectionLabelCss,
31
31
  style: {
32
32
  fontWeight: 700,
33
33
  cursor: "pointer"
34
34
  },
35
35
  onClick: onCycle,
36
- children: ["cvd: ", currentChannel?.label ?? "none"]
36
+ children: `cvd: ${currentChannel?.label ?? "none"}`
37
37
  }),
38
38
  /* @__PURE__ */ jsx(Slider, {
39
39
  label: "amount",
@@ -5,6 +5,7 @@ import { themeModeOf } from "./theme-bootstrap.js";
5
5
  import { useDetectedDisplayGamut, useDisplayGamut } from "./use-display-gamut.js";
6
6
  import { useThematic, useThemeMode, useThemePreference } from "./theme-provider.js";
7
7
  import { common } from "./palettes/common.js";
8
+ import { localStorage } from "./storage.js";
8
9
  import { setThemePreference } from "./theme-settings-core.js";
9
10
  import { useWarmPreference } from "./theme-settings.js";
10
11
  import { DEFAULT_DARK_CURVES, DEFAULT_LIGHT_CURVES, generateColorScale } from "./scale-generator.js";
package/lib/thematic.js CHANGED
@@ -265,9 +265,9 @@ function Thematic() {
265
265
  style: { fontWeight: 700 },
266
266
  children: "palette"
267
267
  }),
268
- /* @__PURE__ */ jsxs("div", {
268
+ /* @__PURE__ */ jsx("div", {
269
269
  className: sectionLabelCss,
270
- children: ["base", state.prefs ? " *" : ""]
270
+ children: `base${state.prefs ? " *" : ""}`
271
271
  }),
272
272
  /* @__PURE__ */ jsx("div", {
273
273
  className: controlRowCss,
@@ -330,14 +330,9 @@ function Thematic() {
330
330
  setHue: (v) => state.update({ archAccentHue: v }),
331
331
  setChroma: (v) => state.update({ archAccentChroma: v })
332
332
  }].map((accent) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
333
- /* @__PURE__ */ jsxs("div", {
333
+ /* @__PURE__ */ jsx("div", {
334
334
  className: sectionLabelCss,
335
- children: [
336
- "accent ",
337
- accent.name,
338
- accent.active ? " •" : "",
339
- state.prefs ? " *" : ""
340
- ]
335
+ children: `accent ${accent.name}${accent.active ? " •" : ""}${state.prefs ? " *" : ""}`
341
336
  }),
342
337
  accent.active ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
343
338
  className: controlRowCss,
@@ -391,9 +386,9 @@ function Thematic() {
391
386
  onLabelLeave: accent.active ? inspOff : void 0
392
387
  })
393
388
  ] }, accent.name)),
394
- /* @__PURE__ */ jsxs("div", {
389
+ /* @__PURE__ */ jsx("div", {
395
390
  className: sectionLabelCss,
396
- children: ["hue shift", state.prefs?.hueShiftTargetHue !== void 0 || state.prefs?.hueShiftAmount !== void 0 ? " *" : ""]
391
+ children: `hue shift${state.prefs?.hueShiftTargetHue !== void 0 || state.prefs?.hueShiftAmount !== void 0 ? " *" : ""}`
397
392
  }),
398
393
  /* @__PURE__ */ jsx(Slider, {
399
394
  label: state.prefs?.hueShiftTargetHue !== void 0 ? "target H *" : "target H",
@@ -414,15 +409,10 @@ function Thematic() {
414
409
  onChange: (v) => state.updateHueShift({ hueShiftAmount: v })
415
410
  }),
416
411
  /* @__PURE__ */ jsx("div", { className: sectionSeparatorCss }),
417
- /* @__PURE__ */ jsxs("div", {
412
+ /* @__PURE__ */ jsx("div", {
418
413
  className: sectionLabelCss,
419
414
  style: { fontWeight: 700 },
420
- children: [
421
- "deneutralize (",
422
- state.showDark ? "dark" : "light",
423
- ")",
424
- state.prefs?.filter || state.customPalette?.deneutralize ? " *" : ""
425
- ]
415
+ children: `deneutralize (${state.showDark ? "dark" : "light"})${state.prefs?.filter || state.customPalette?.deneutralize ? " *" : ""}`
426
416
  }),
427
417
  /* @__PURE__ */ jsx(Slider, {
428
418
  label: "hue shift H",
@@ -1,4 +1,6 @@
1
+ import { storageReader } from "@fibery/helpers/src/storage-read";
1
2
  //#region src/theme-bootstrap.ts
3
+ var readStorage = storageReader();
2
4
  var themePreferenceStorageKey = "theme-preference";
3
5
  var darkModeQuery = "(prefers-color-scheme: dark)";
4
6
  var allowedThemePreferences = /* @__PURE__ */ new Set([
@@ -17,7 +19,7 @@ function getThemePreference() {
17
19
  try {
18
20
  const itemInUrl = new URLSearchParams(window.location.search).get("force-theme");
19
21
  if (itemInUrl && isThemePreference(itemInUrl)) return itemInUrl;
20
- const itemInStorage = localStorage.getItem(themePreferenceStorageKey);
22
+ const itemInStorage = readStorage("localStorage", themePreferenceStorageKey);
21
23
  if (itemInStorage && isThemePreference(itemInStorage)) return itemInStorage;
22
24
  } catch {}
23
25
  return "light";
@@ -0,0 +1,5 @@
1
+ import { CssGamut } from "./color-gamut.js";
2
+ import { ThemeCssSource } from "./theme-css-snapshot.js";
3
+ //#region src/theme-css-fallback.d.ts
4
+ export declare function themeStylesFallback({ warm, arch, mode }: ThemeCssSource, gamut: CssGamut): Map<string, string>;
5
+ //#endregion