@fibery/ui-kit 13.0.1 → 14.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.
Files changed (73) hide show
  1. package/lib/actions-menu/actions-menu-item.js +4 -3
  2. package/lib/actions-menu/actions-menu-sub-command-menu.d.ts +2 -0
  3. package/lib/actions-menu/actions-menu-sub-command-menu.js +3 -2
  4. package/lib/actions-menu/actions-menu.js +2 -2
  5. package/lib/actions-menu/context-actions-menu.js +2 -2
  6. package/lib/banner/banner.wyw-in-js.css +2 -2
  7. package/lib/button/button.js +2 -1
  8. package/lib/color-picker/color-picker-or-loader.d.ts +5 -0
  9. package/lib/color-picker/color-picker-or-loader.js +18 -5
  10. package/lib/color-picker/color-picker-or-loader.wyw-in-js.css +1 -1
  11. package/lib/color-picker/index.js +5 -5
  12. package/lib/color-picker/index.wyw-in-js.css +4 -5
  13. package/lib/color-picker/swatch-grid.d.ts +11 -0
  14. package/lib/color-picker/swatch-grid.js +14 -0
  15. package/lib/color-picker/swatch-grid.wyw-in-js.css +1 -0
  16. package/lib/color-picker/swatch.js +2 -9
  17. package/lib/command-menu/nested-command-menu.js +1 -1
  18. package/lib/date-picker/date-range-picker-popup-content.js +7 -3
  19. package/lib/date-picker/date-range-picker.js +3 -2
  20. package/lib/date-picker/single-date-picker-popup-content.js +1 -1
  21. package/lib/date-picker/single-date-picker.js +3 -2
  22. package/lib/emoji-picker/utils/store.js +3 -2
  23. package/lib/file-item/file-item-preview.d.ts +7 -0
  24. package/lib/file-item/file-item-preview.js +31 -0
  25. package/lib/file-item/file-item-preview.wyw-in-js.css +4 -0
  26. package/lib/form-field-loader.d.ts +5 -6
  27. package/lib/form-field-loader.js +7 -10
  28. package/lib/form-field-loader.wyw-in-js.css +2 -1
  29. package/lib/lists/list-row-surface.wyw-in-js.css +1 -1
  30. package/lib/open-popover-tracker.d.ts +2 -4
  31. package/lib/open-popover-tracker.js +14 -22
  32. package/lib/popover/index.js +2 -2
  33. package/lib/preference-setting.d.ts +2 -1
  34. package/lib/preference-setting.js +4 -4
  35. package/lib/reactions/get-word-divider.d.ts +1 -1
  36. package/lib/reactions/get-word-divider.js +7 -6
  37. package/lib/rich-text-skeleton.d.ts +9 -0
  38. package/lib/rich-text-skeleton.js +32 -0
  39. package/lib/rich-text-skeleton.wyw-in-js.css +2 -0
  40. package/lib/select/components/menu-list-virtua.js +2 -1
  41. package/lib/select/components/menu-list-virtualized.js +37 -44
  42. package/lib/select/components/menu.d.ts +1 -4
  43. package/lib/select/components/menu.js +2 -9
  44. package/lib/select/components/option.js +5 -2
  45. package/lib/select/select-loader.js +5 -2
  46. package/lib/select/select.d.ts +1 -1
  47. package/lib/select/select.js +2 -2
  48. package/lib/select/styles.js +4 -3
  49. package/lib/select/util.d.ts +2 -0
  50. package/lib/select/util.js +3 -1
  51. package/lib/storage-keys.d.ts +12 -0
  52. package/lib/storage-keys.js +20 -0
  53. package/lib/storage.d.ts +9 -0
  54. package/lib/storage.js +5 -0
  55. package/lib/text.d.ts +5 -0
  56. package/lib/text.js +5 -0
  57. package/lib/thematic-cvd.js +2 -2
  58. package/lib/thematic-state.js +1 -0
  59. package/lib/thematic.js +8 -18
  60. package/lib/theme-bootstrap.js +3 -1
  61. package/lib/theme-css-fallback.d.ts +5 -0
  62. package/lib/theme-css-fallback.js +29 -0
  63. package/lib/theme-css-snapshot.d.ts +8 -1
  64. package/lib/theme-css-snapshot.js +34 -8
  65. package/lib/theme-settings-core.js +7 -8
  66. package/lib/theme-styles.js +5 -8
  67. package/lib/unit/labeled-unit.d.ts +2 -0
  68. package/lib/unit/labeled-unit.js +3 -3
  69. package/lib/unit/labeled-unit.wyw-in-js.css +1 -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,3 +1,3 @@
1
1
  //#region src/reactions/get-word-divider.d.ts
2
- export declare function getWordDivider(length: number, index: number, trailDivider?: string): string | import("react").JSX.Element;
2
+ export declare function getWordDivider(length: number, index: number, trailDivider?: string): "" | import("react").JSX.Element;
3
3
  //#endregion
@@ -1,11 +1,12 @@
1
- import { Fragment, jsx } from "react/jsx-runtime";
1
+ import { Text } from "../text.js";
2
+ import { jsx } from "react/jsx-runtime";
2
3
  //#region src/reactions/get-word-divider.tsx
3
4
  function getWordDivider(length, index, trailDivider = " ") {
4
- if (length === 1) return trailDivider;
5
- if (length === 2 && index === 0) return /* @__PURE__ */ jsx(Fragment, { children: "\xA0and " });
6
- if (length > 2 && length === index + 2) return /* @__PURE__ */ jsx(Fragment, { children: ",\xA0and " });
7
- if (length === index + 1) return trailDivider;
8
- return ", ";
5
+ if (length === 1) return trailDivider && /* @__PURE__ */ jsx(Text, { children: trailDivider });
6
+ if (length === 2 && index === 0) return /* @__PURE__ */ jsx(Text, { children: "\xA0and " });
7
+ if (length > 2 && length === index + 2) return /* @__PURE__ */ jsx(Text, { children: ",\xA0and " });
8
+ if (length === index + 1) return trailDivider && /* @__PURE__ */ jsx(Text, { children: trailDivider });
9
+ return /* @__PURE__ */ jsx(Text, { children: ", " });
9
10
  }
10
11
  //#endregion
11
12
  export { getWordDivider };
@@ -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,9 +1,10 @@
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
- import { Children, useContext, useEffect, useMemo, useRef, useState } from "react";
7
+ import { Children, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
7
8
  import { isRecord, truthy } from "@fibery/helpers/src/_";
8
9
  import { Virtuoso } from "react-virtuoso";
9
10
  //#region src/select/components/menu-list-virtualized.tsx
@@ -32,7 +33,6 @@ function MenuListVirtualized(props) {
32
33
  const virtuoso = useRef(null);
33
34
  const select = useContext(ReactSelectRefContext);
34
35
  const [initialFocusedOption, setInitialFocusedOption] = useState(null);
35
- const scrollTimeoutRef = useRef(void 0);
36
36
  const itemHeight = isPhone ? layout.mobileMenuItemHeight : layout.menuItemHeight;
37
37
  const scrollThreshold = itemHeight * MINIMAL_VISIBLE_PORTION_TO_SCROLL_INTO_VIEW;
38
38
  const renderGroup = useMemo(() => (Component, headingProps) => {
@@ -54,11 +54,13 @@ function MenuListVirtualized(props) {
54
54
  theme
55
55
  ]);
56
56
  const flattenChildren = useMemo(() => flattenGroupChildren(children, renderGroup), [children, renderGroup]);
57
- const menuHeight = useMemo(() => Math.min(flattenChildren.length * itemHeight, maxHeight), [
57
+ const menuHeight = useMemo(() => Math.min(flattenChildren.length * itemHeight, fitMenuListHeight(maxHeight)), [
58
58
  flattenChildren.length,
59
59
  itemHeight,
60
60
  maxHeight
61
61
  ]);
62
+ const focusedOptionValue = focusedOption ? selectProps.getOptionValue(focusedOption) : null;
63
+ const { inputValue } = selectProps;
62
64
  const focusedIndex = useMemo(() => {
63
65
  if (!focusedOption) return -1;
64
66
  return flattenChildren.findIndex((child) => {
@@ -96,41 +98,28 @@ function MenuListVirtualized(props) {
96
98
  initialFocusedOption,
97
99
  select
98
100
  ]);
99
- useEffect(() => {
100
- if (scrollTimeoutRef.current) {
101
- window.cancelAnimationFrame(scrollTimeoutRef.current);
102
- scrollTimeoutRef.current = void 0;
103
- }
104
- if (initialFocusedOption && focusedOption && focusedIndex >= 0 && virtuoso.current) scrollTimeoutRef.current = window.requestAnimationFrame(() => {
105
- if (!virtuoso.current) return;
106
- virtuoso.current.getState((state) => {
107
- const focusedItemTop = focusedIndex * itemHeight;
108
- const focusedItemBottom = focusedItemTop + itemHeight;
109
- const viewportTop = state.scrollTop;
110
- const viewportBottom = state.scrollTop + menuHeight;
111
- const isTopCutOff = focusedItemTop < viewportTop;
112
- const isBottomCutOff = focusedItemBottom > viewportBottom;
113
- const visibleHeight = Math.max(0, Math.min(focusedItemBottom, viewportBottom) - Math.max(focusedItemTop, viewportTop));
114
- if (isTopCutOff && visibleHeight < itemHeight - scrollThreshold) virtuoso.current?.scrollToIndex({
115
- index: focusedIndex,
116
- align: "start",
117
- behavior: "auto"
118
- });
119
- else if (isBottomCutOff && visibleHeight < itemHeight - scrollThreshold) virtuoso.current?.scrollToIndex({
120
- index: focusedIndex,
121
- align: "end",
122
- behavior: "auto"
123
- });
101
+ useLayoutEffect(() => {
102
+ if (!initialFocusedOption || focusedOptionValue === null || focusedIndex < 0 || !virtuoso.current) return;
103
+ virtuoso.current.getState((state) => {
104
+ const focusedItemTop = focusedIndex * itemHeight;
105
+ const focusedItemBottom = focusedItemTop + itemHeight;
106
+ const viewportTop = state.scrollTop;
107
+ const viewportBottom = state.scrollTop + menuHeight;
108
+ const hiddenEnough = Math.max(0, Math.min(focusedItemBottom, viewportBottom) - Math.max(focusedItemTop, viewportTop)) < itemHeight - scrollThreshold;
109
+ if (focusedItemTop < viewportTop && hiddenEnough) virtuoso.current?.scrollToIndex({
110
+ index: focusedIndex,
111
+ align: "start",
112
+ behavior: "auto"
113
+ });
114
+ else if (focusedItemBottom > viewportBottom && hiddenEnough) virtuoso.current?.scrollToIndex({
115
+ index: focusedIndex,
116
+ align: "end",
117
+ behavior: "auto"
124
118
  });
125
119
  });
126
- return () => {
127
- if (scrollTimeoutRef.current) {
128
- window.cancelAnimationFrame(scrollTimeoutRef.current);
129
- scrollTimeoutRef.current = void 0;
130
- }
131
- };
132
120
  }, [
133
- focusedOption,
121
+ focusedOptionValue,
122
+ inputValue,
134
123
  focusedIndex,
135
124
  initialFocusedOption,
136
125
  itemHeight,
@@ -140,14 +129,18 @@ function MenuListVirtualized(props) {
140
129
  return /* @__PURE__ */ jsx("div", {
141
130
  ...innerProps,
142
131
  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
132
+ children: /* @__PURE__ */ jsx(VirtualizedMenuListContext.Provider, {
133
+ value: true,
134
+ children: /* @__PURE__ */ jsx(Virtuoso, {
135
+ ref: virtuoso,
136
+ scrollerRef: innerRef,
137
+ style: isPhone && inPopover ? void 0 : { height: menuHeight },
138
+ fixedItemHeight: itemHeight,
139
+ overscan: itemHeight * 3,
140
+ data: flattenChildren,
141
+ totalCount: flattenChildren.length,
142
+ itemContent: drawListElement
143
+ })
151
144
  })
152
145
  });
153
146
  }
@@ -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";
@@ -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 };
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
@@ -0,0 +1,29 @@
1
+ import { wideGamutStyles } from "./styles.generated.js";
2
+ import { neutralArchDark, neutralUserDark } from "./styles.neutral-dark.generated.js";
3
+ import { neutralArchLight, neutralUserLight } from "./styles.neutral-light.generated.js";
4
+ import { warmArchDark, warmUserDark } from "./styles.warm-dark.generated.js";
5
+ import { warmArchLight, warmUserLight } from "./styles.warm-light.generated.js";
6
+ //#region src/theme-css-fallback.ts
7
+ var baseStyles = {
8
+ neutralUserLight,
9
+ neutralUserDark,
10
+ warmUserLight,
11
+ warmUserDark,
12
+ neutralArchLight,
13
+ neutralArchDark,
14
+ warmArchLight,
15
+ warmArchDark
16
+ };
17
+ var wideTiers = {
18
+ rgb: [],
19
+ p3: ["p3"],
20
+ rec2020: ["p3", "rec2020"]
21
+ };
22
+ function themeStylesFallback({ warm, arch, mode }, gamut) {
23
+ const look = warm ? "warm" : "neutral";
24
+ const suffix = mode === "dark" ? "Dark" : "Light";
25
+ const names = arch ? [`${look}User${suffix}`, `${look}Arch${suffix}`] : [`${look}User${suffix}`];
26
+ return new Map(names.flatMap((name) => [baseStyles[name], ...wideTiers[gamut].map((tier) => wideGamutStyles[tier][name])].flatMap((styles) => Object.entries(styles))));
27
+ }
28
+ //#endregion
29
+ export { themeStylesFallback };
@@ -1,6 +1,13 @@
1
+ import { ThemeMode } from "./theme-bootstrap.js";
1
2
  import { CssGamut, Gamut } from "./color-gamut.js";
2
3
  import { ThemeVariable } from "./theme-values.js";
3
4
  //#region src/theme-css-snapshot.d.ts
5
+ export type ThemeCssSource = {
6
+ warm: boolean;
7
+ arch: boolean;
8
+ mode: ThemeMode;
9
+ };
10
+ export declare function ensureThemeValues(): Promise<boolean>;
4
11
  export declare const themeCssSnapshotTrace: {
5
12
  enabled: boolean;
6
13
  count: number;
@@ -9,7 +16,7 @@ export declare const themeCssSnapshotTrace: {
9
16
  computedStylesDuration: number;
10
17
  duration: number;
11
18
  };
12
- export declare function themeCssValues(key: string, className: string, gamut: CssGamut): {
19
+ export declare function themeCssValues(key: string, source: ThemeCssSource, gamut: CssGamut): {
13
20
  names: readonly ThemeVariable[];
14
21
  read: (name: ThemeVariable) => string;
15
22
  gamut?: Gamut;