@fibery/ui-kit 9.0.2 → 9.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/a11y-color.js +12 -10
- package/lib/actions-menu/actions-menu-props.d.ts +2 -0
- package/lib/actions-menu/actions-menu-sub-command-menu.js +5 -4
- package/lib/actions-menu/actions-menu.d.ts +1 -1
- package/lib/actions-menu/actions-menu.js +2 -1
- package/lib/actions-menu/contexts/actions-menu-context.js +12 -11
- package/lib/ai/max-tokens.js +6 -5
- package/lib/antd/ant-modal.d.ts +1 -1
- package/lib/antd/ant-modal.js +28 -1
- package/lib/antd/ant-upload.d.ts +1 -1
- package/lib/antd/ant-upload.js +23 -18
- package/lib/antd/input.js +5 -4
- package/lib/antd/utils.js +2 -1
- package/lib/avatar-colors.js +1 -1
- package/lib/avatar.d.ts +1 -10
- package/lib/avatar.js +48 -38
- package/lib/avatar.wyw-in-js.css +1 -1
- package/lib/banner/banner-action.js +2 -1
- package/lib/button/button.js +1 -1
- package/lib/button/icon-button.js +1 -1
- package/lib/canvas-colors.js +2 -2
- package/lib/card-container.d.ts +2 -6
- package/lib/card-container.js +4 -4
- package/lib/color-filter.js +2 -2
- package/lib/color-inspect.js +1 -1
- package/lib/color-picker/color-picker-or-loader.d.ts +2 -2
- package/lib/color-utils.js +1 -1
- package/lib/comment.d.ts +2 -1
- package/lib/comment.js +44 -27
- package/lib/comment.wyw-in-js.css +11 -8
- package/lib/context-menu/index.js +1 -0
- package/lib/context-menu/index.wyw-in-js.css +1 -1
- package/lib/date-picker/autocomplete.js +12 -10
- package/lib/date-picker/date-range-input.js +8 -6
- package/lib/date-picker/day-with-start-end-buttons.js +0 -2
- package/lib/date-picker/get-weekends-for-month.js +4 -2
- package/lib/date-picker/single-date-input.js +8 -6
- package/lib/day-select/day-select.js +2 -1
- package/lib/day-select/week-day-select.d.ts +2 -2
- package/lib/day-select/week-day-select.js +4 -3
- package/lib/design-system/alpha.js +5 -7
- package/lib/design-system/colors-charts.d.ts +4 -0
- package/lib/design-system/colors-charts.js +14 -0
- package/lib/design-system/colors-js.d.ts +2 -4
- package/lib/design-system/colors-js.js +8 -10
- package/lib/design-system/fns.enum.js +7 -4
- package/lib/design-system/fns.icon.js +1 -1
- package/lib/design-system/fns.js +7 -4
- package/lib/design-system/theme.d.ts +7 -7
- package/lib/design-system/theme.js +7 -12
- package/lib/design-system/vars.js +1 -2
- package/lib/design-system.d.ts +3 -2
- package/lib/design-system.js +3 -2
- package/lib/emoji-picker/primitives/content.js +10 -9
- package/lib/emoji-picker/primitives/emoji.js +22 -14
- package/lib/emoji-picker/primitives/emoji.wyw-in-js.css +4 -3
- package/lib/emoji-picker/primitives/grid.js +0 -1
- package/lib/emoji-picker/primitives/preview-provider.js +4 -3
- package/lib/emoji-picker/primitives/root.js +10 -9
- package/lib/emoji-picker/primitives/skin-provider.js +5 -4
- package/lib/emoji-picker/stores/emoji-data-store.d.ts +2 -2
- package/lib/emoji-picker/stores/emoji-data-store.js +8 -8
- package/lib/emoji-picker/stores/static-emoji-data-store.js +2 -1
- package/lib/emoji.js +5 -2
- package/lib/fibermoji-placeholder.js +5 -7
- package/lib/field-type-icon.js +2 -1
- package/lib/file-item/file-icon.js +2 -1
- package/lib/file-item.js +3 -10
- package/lib/highlight-colors.js +2 -1
- package/lib/hotkey-scope.js +2 -1
- package/lib/icons/ast/index.d.ts +1 -4
- package/lib/icons/ast/index.js +2 -5
- package/lib/icons/ast/spinner.js +1 -14
- package/lib/icons/icon.js +4 -3
- package/lib/icons/react/index.d.ts +1 -4
- package/lib/icons/react/index.js +2 -5
- package/lib/images-gallery/get-gallery-src.js +1 -1
- package/lib/images-gallery/slide-buttons.js +8 -4
- package/lib/images-gallery/thumbnails-mime-types-white-list.js +1 -1
- package/lib/integration-compact-info-button.js +1 -1
- package/lib/loading-sausage.js +7 -6
- package/lib/mobile-drawer.d.ts +2 -1
- package/lib/mobile-drawer.js +24 -12
- package/lib/mobile-drawer.wyw-in-js.css +3 -2
- package/lib/mobile-keyboard-aware-popup.js +6 -5
- package/lib/modal-menu/contexts/modal-menu-context.d.ts +1 -0
- package/lib/modal-menu/modal-menu-content.d.ts +1 -1
- package/lib/modal-menu/modal-menu-content.js +16 -6
- package/lib/modal-menu/modal-menu-drawer-content.d.ts +7 -0
- package/lib/modal-menu/modal-menu-drawer-content.js +13 -0
- package/lib/modal-menu/modal-menu-root.d.ts +2 -1
- package/lib/modal-menu/modal-menu-root.js +24 -21
- package/lib/modal-menu/modal-submenu.js +10 -9
- package/lib/nested-menu-item.d.ts +1 -1
- package/lib/number-input/number-input-inline-with-autosize.d.ts +1 -2
- package/lib/number-input/number-input-inline-with-autosize.js +9 -6
- package/lib/number-input/number-input-inline-with-autosize.wyw-in-js.css +0 -1
- package/lib/number-input/number-input.js +13 -11
- package/lib/number-input/styles.d.ts +1 -9
- package/lib/number-input/styles.js +3 -9
- package/lib/number-input/styles.wyw-in-js.css +2 -3
- package/lib/number-input/text-area-auto-sized.d.ts +1 -2
- package/lib/number-input/text-area-auto-sized.js +2 -2
- package/lib/number-input/text-input-auto-sized.d.ts +1 -2
- package/lib/number-input/text-input-auto-sized.js +2 -2
- package/lib/online-users.js +2 -2
- package/lib/open-popover-tracker.js +7 -6
- package/lib/palettes/neutral.js +1 -1
- package/lib/palettes/warm.js +1 -1
- package/lib/phone.js +1 -1
- package/lib/popover/index.d.ts +4 -2
- package/lib/popover/index.js +61 -59
- package/lib/popover/mobile-popover-context.js +12 -11
- package/lib/popover/mobile-popover.js +16 -15
- package/lib/popover/modifiers.js +4 -4
- package/lib/preference-setting.js +6 -8
- package/lib/reactions/reaction-button.js +36 -25
- package/lib/reactions/reaction-button.wyw-in-js.css +16 -16
- package/lib/reactions/reaction-picker.js +22 -10
- package/lib/reactions/reaction-picker.wyw-in-js.css +1 -0
- package/lib/reactions/tootltip.js +2 -1
- package/lib/select/components/option.js +2 -1
- package/lib/select/index.d.ts +2 -1
- package/lib/select/select-trigger.d.ts +4 -0
- package/lib/select/select-trigger.js +25 -0
- package/lib/select/select-trigger.wyw-in-js.css +1 -0
- package/lib/select/select.d.ts +6 -2
- package/lib/select/select.js +10 -5
- package/lib/spinner.d.ts +2 -6
- package/lib/spinner.js +11 -7
- package/lib/spinner.wyw-in-js.css +1 -0
- package/lib/tab-nav/tab-nav.d.ts +4 -2
- package/lib/tab-nav/tab-nav.js +2 -2
- package/lib/thematic.js +322 -321
- package/lib/theme-provider.d.ts +1 -3
- package/lib/toast/toast-action.js +2 -1
- package/lib/toast/toast-provider.d.ts +1 -2
- package/lib/toast/toast-queue.d.ts +1 -2
- package/lib/toast/toast-queue.js +7 -8
- package/lib/toast/toast.js +7 -6
- package/lib/toggle.js +3 -3
- package/lib/tooltip-if-overflown.js +2 -1
- package/lib/tooltip.js +1 -1
- package/lib/type-badge.d.ts +8 -28
- package/lib/type-badge.js +39 -50
- package/lib/type-badge.wyw-in-js.css +11 -10
- package/lib/unit/container.d.ts +12 -0
- package/lib/unit/container.js +50 -0
- package/lib/unit/context.d.ts +29 -0
- package/lib/unit/context.js +9 -0
- package/lib/unit/index.d.ts +4 -2
- package/lib/unit/index.js +2 -1
- package/lib/unit/nav-button.d.ts +12 -0
- package/lib/unit/nav-button.js +18 -0
- package/lib/unit/styles.d.ts +6 -9
- package/lib/unit/styles.js +13 -16
- package/lib/unit/styles.wyw-in-js.css +10 -16
- package/lib/unit/unit-content-layout.d.ts +4 -3
- package/lib/unit/unit-content-layout.js +9 -9
- package/lib/unit/unit-content.d.ts +6 -5
- package/lib/unit/unit-content.js +83 -18
- package/lib/unit/unit-content.wyw-in-js.css +6 -2
- package/lib/unit/unit.d.ts +38 -5
- package/lib/unit/unit.js +43 -12
- package/lib/workflow-progress-icon.js +2 -2
- package/package.json +6 -6
- package/lib/features.d.ts +0 -8
- package/lib/features.js +0 -15
- package/lib/flags.d.ts +0 -4
- package/lib/flags.js +0 -7
- package/lib/icons/ast/alert-triangle.d.ts +0 -5
- package/lib/icons/ast/alert-triangle.js +0 -25
- package/lib/icons/ast/field-units-large.d.ts +0 -5
- package/lib/icons/ast/field-units-large.js +0 -25
- package/lib/icons/ast/plus.d.ts +0 -5
- package/lib/icons/ast/plus.js +0 -25
- package/lib/icons/react/alert-triangle.d.ts +0 -15
- package/lib/icons/react/alert-triangle.js +0 -21
- package/lib/icons/react/field-units-large.d.ts +0 -15
- package/lib/icons/react/field-units-large.js +0 -21
- package/lib/icons/react/plus.d.ts +0 -15
- package/lib/icons/react/plus.js +0 -21
- package/lib/unit/primitive.d.ts +0 -5
- package/lib/unit/primitive.js +0 -108
- package/lib/unit/primitive.wyw-in-js.css +0 -3
- package/lib/unit/types.d.ts +0 -34
- package/lib/unit/types.js +0 -0
- package/lib/unit/unit-button-group.d.ts +0 -13
- package/lib/unit/unit-button-group.js +0 -23
package/lib/comment.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ declare const commentContentStyle: import("@linaria/core").LinariaClassName;
|
|
|
4
4
|
declare const commentStyle: import("@linaria/core").LinariaClassName;
|
|
5
5
|
declare const defaultCommentStyle: import("@linaria/core").LinariaClassName;
|
|
6
6
|
interface CommentProps {
|
|
7
|
-
author?:
|
|
7
|
+
author?: ReactNode;
|
|
8
8
|
authorTitle?: string;
|
|
9
9
|
authorStyleClassName?: string;
|
|
10
10
|
avatarUrl?: string | null;
|
|
@@ -18,6 +18,7 @@ interface CommentProps {
|
|
|
18
18
|
dateTimeFormat?: string;
|
|
19
19
|
commentContentStyleClassName?: string;
|
|
20
20
|
actionsShowed?: boolean;
|
|
21
|
+
badge?: ReactNode;
|
|
21
22
|
}
|
|
22
23
|
declare const actionsClassName: import("@linaria/core").LinariaClassName;
|
|
23
24
|
declare const Comment: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<CommentProps & import("react").RefAttributes<HTMLDivElement>>>;
|
package/lib/comment.js
CHANGED
|
@@ -14,43 +14,60 @@ import { cx } from "@linaria/core";
|
|
|
14
14
|
var commentContentStyle = "c4bd082-commentContent";
|
|
15
15
|
var commentStyle = "c99co57-comment";
|
|
16
16
|
var avatarContainerStyle = "alj6rui-avatarContainer";
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
17
|
+
var avatarSlotStyle = "a1jz7n7h-avatarSlot";
|
|
18
|
+
var infoContainerStyle = "i1ftwecl-infoContainer";
|
|
19
|
+
var infoRowStyle = "i1uq6781-infoRow";
|
|
20
|
+
var authorStyle = "a1fgzzhc-author";
|
|
21
|
+
var dateStyle = "d6fpn3e-date";
|
|
22
|
+
var badgeStyle = "b1j9f4o5-badge";
|
|
23
|
+
var defaultCommentStyle = "d1slvpm7-defaultComment";
|
|
24
|
+
var actionsClassName = "ajnlt45-actions";
|
|
22
25
|
var Comment = memo(forwardRef((props, ref) => {
|
|
23
|
-
const { author, authorTitle, authorStyleClassName, commentContentStyleClassName = commentContentStyle, date, avatarUrl, hasAccessToAuthor = true, actions, children, customItemStyle, dateTimeFormat, icon, avatarSize = 24, actionsShowed = false } = props;
|
|
26
|
+
const { author, authorTitle, authorStyleClassName, commentContentStyleClassName = commentContentStyle, date, avatarUrl, hasAccessToAuthor = true, actions, children, customItemStyle, dateTimeFormat, icon, avatarSize = 24, actionsShowed = false, badge } = props;
|
|
24
27
|
const { formatted, relative } = formatDateFromNow(date, { format: dateTimeFormat });
|
|
25
28
|
const IconComponent = icon ? icon : null;
|
|
26
29
|
const isPhone = useIsPhone();
|
|
27
30
|
return /* @__PURE__ */ jsxs("div", {
|
|
28
31
|
ref,
|
|
29
|
-
className: cx("
|
|
32
|
+
className: cx("c1gf494l", defaultCommentStyle, customItemStyle ?? "c99co57-comment"),
|
|
30
33
|
children: [
|
|
31
|
-
/* @__PURE__ */ jsx("div", {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
/* @__PURE__ */ jsx("div", {
|
|
35
|
+
className: avatarSlotStyle,
|
|
36
|
+
style: {
|
|
37
|
+
width: avatarSize,
|
|
38
|
+
height: avatarSize
|
|
39
|
+
},
|
|
40
|
+
children: IconComponent ? IconComponent : /* @__PURE__ */ jsx(AvatarImage, {
|
|
41
|
+
avatarUrl,
|
|
42
|
+
title: authorTitle,
|
|
43
|
+
size: avatarSize,
|
|
44
|
+
hasAccess: hasAccessToAuthor
|
|
45
|
+
})
|
|
46
|
+
}),
|
|
37
47
|
/* @__PURE__ */ jsxs("div", {
|
|
38
|
-
className: "
|
|
48
|
+
className: "c14sd9dn",
|
|
39
49
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
40
|
-
className:
|
|
41
|
-
children: [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
children:
|
|
50
|
+
className: infoRowStyle,
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ jsx("div", {
|
|
53
|
+
className: cx(authorStyle, authorStyleClassName),
|
|
54
|
+
children: author
|
|
55
|
+
}),
|
|
56
|
+
date && /* @__PURE__ */ jsx(Tooltip, {
|
|
57
|
+
title: formatted,
|
|
58
|
+
side: "top",
|
|
59
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
60
|
+
className: dateStyle,
|
|
61
|
+
children: relative
|
|
62
|
+
})
|
|
63
|
+
}),
|
|
64
|
+
badge && /* @__PURE__ */ jsx("span", {
|
|
65
|
+
className: badgeStyle,
|
|
66
|
+
children: badge
|
|
50
67
|
})
|
|
51
|
-
|
|
68
|
+
]
|
|
52
69
|
}), actions ? /* @__PURE__ */ jsx("div", {
|
|
53
|
-
className: cx(actionsClassName, (actionsShowed || isPhone) && "
|
|
70
|
+
className: cx(actionsClassName, (actionsShowed || isPhone) && "c1fgpr5b"),
|
|
54
71
|
children: actions
|
|
55
72
|
}) : null]
|
|
56
73
|
}),
|
|
@@ -84,7 +101,7 @@ var CommentPlaceholder = () => {
|
|
|
84
101
|
};
|
|
85
102
|
var ErrorComment = ({ error }) => {
|
|
86
103
|
return /* @__PURE__ */ jsx("div", { children: jsx(Item, {
|
|
87
|
-
itemClassName: cx(commentStyle, "
|
|
104
|
+
itemClassName: cx(commentStyle, "i1x2fdjy-item"),
|
|
88
105
|
multiline: true,
|
|
89
106
|
leftContainer: /* @__PURE__ */ jsx("div", {
|
|
90
107
|
className: avatarContainerStyle,
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
.c4bd082-commentContent{word-break:break-word;padding-top:6px;white-space:pre-line;}
|
|
2
2
|
.c99co57-comment{border-radius:6px;padding-left:12px;padding-right:12px;padding-top:12px;padding-bottom:6px;margin-bottom:1px;background-color:var(--actionMenuBg);transition:box-shadow 120ms ease-in-out;overflow-x:auto;}
|
|
3
3
|
.alj6rui-avatarContainer{margin-right:8px;}
|
|
4
|
-
.
|
|
5
|
-
.
|
|
6
|
-
.
|
|
4
|
+
.a1jz7n7h-avatarSlot{display:flex;align-items:center;justify-content:center;flex-shrink:0;}
|
|
5
|
+
.i1ftwecl-infoContainer{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-height:20px;font-family:"Inter Variable","SF Pro Display",-apple-system,BlinkMacSystemFont,"Segoe UI Variable Display","Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;font-size:14px;line-height:1.3;font-weight:600;color:var(--textColor);}
|
|
6
|
+
.i1uq6781-infoRow{display:flex;align-items:center;min-width:0;min-height:20px;font-family:"Inter Variable","SF Pro Display",-apple-system,BlinkMacSystemFont,"Segoe UI Variable Display","Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;font-size:14px;line-height:1.3;font-weight:600;color:var(--textColor);}
|
|
7
|
+
.a1fgzzhc-author{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:inline;margin-right:8px;min-width:0;}
|
|
8
|
+
.d6fpn3e-date{display:inline;white-space:no-wrap;padding-right:8px;flex-shrink:0;font-family:"Inter Variable","SF Pro Display",-apple-system,BlinkMacSystemFont,"Segoe UI Variable Display","Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;font-size:12px;line-height:1.5;font-weight:410;color:var(--accentTextColor);text-transform:none;}
|
|
9
|
+
.b1j9f4o5-badge{display:flex;flex-shrink:0;}
|
|
7
10
|
|
|
8
|
-
.
|
|
9
|
-
.
|
|
10
|
-
.
|
|
11
|
-
.
|
|
12
|
-
.
|
|
11
|
+
.ajnlt45-actions{display:none;position:absolute;top:0;right:0;z-index:1;padding:3px;background-color:var(--colorBgFloatingPanel);border-radius:8px;box-shadow:var(--shadowFloatingPanel);gap:2px;}.d1slvpm7-defaultComment:hover .ajnlt45-actions{display:flex;}.fibery-mobile .ajnlt45-actions{top:-6px;}
|
|
12
|
+
.c1gf494l{display:grid;grid-template-columns:auto minmax(150px, 1fr);align-items:center;column-gap:12px;}
|
|
13
|
+
.c14sd9dn{display:grid;position:relative;grid-template-columns:1fr auto;align-items:center;min-height:24px;}.fibery-mobile .c14sd9dn{min-height:36px;}
|
|
14
|
+
.c1fgpr5b{display:flex;}
|
|
15
|
+
.i1x2fdjy-item{background-color:var(--warningBgColor);}
|
|
@@ -104,6 +104,7 @@ var SubContent = forwardRef(function DropdownMenuSubContent({ className, ...rest
|
|
|
104
104
|
return /* @__PURE__ */ jsx(ContextMenuPrimitive.Portal, { children: jsx(RadixPortalThemeProvider, { children: /* @__PURE__ */ jsx(ContextMenuPrimitive.SubContent, {
|
|
105
105
|
ref,
|
|
106
106
|
className: cx(dropdownMenuContentStyles, className),
|
|
107
|
+
collisionPadding: space.s12 + space.s8,
|
|
107
108
|
...rest
|
|
108
109
|
}) }) });
|
|
109
110
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.d12eukli-dropdownMenuContent{overflow-y:auto;overflow-x:hidden;z-index:1001;max-height:min(var(--radix-
|
|
1
|
+
.d12eukli-dropdownMenuContent{overflow-y:auto;overflow-x:hidden;z-index:1001;max-height:min(var(--radix-context-menu-content-available-height), 680px);padding-top:4px;padding-bottom:4px;min-width:200px;box-shadow:var(--actionMenuShadow);border-radius:8px;background-color:var(--colorBgActionsMenu);}@keyframes slideDown-d12eukli-dropdownMenuContent{from{opacity:0;transform:translateY(-2px);}to{opacity:1;transform:translateY(0);}}@media (prefers-reduced-motion: no-preference){.d12eukli-dropdownMenuContent{animation-duration:400ms;animation-timing-function:cubic-bezier(0.16, 1, 0.3, 1);animation-fill-mode:forwards;will-change:transform,opacity;}.d12eukli-dropdownMenuContent[data-state="open"]{animation-name:slideDown-d12eukli-dropdownMenuContent;}}
|
|
2
2
|
.i1a6wz4q-Item{font-family:"Inter Variable","SF Pro Display",-apple-system,BlinkMacSystemFont,"Segoe UI Variable Display","Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;font-size:14px;line-height:1.5;font-weight:410;color:var(--textColor);text-transform:none;letter-spacing:normal;display:flex;align-items:center;min-height:32px;outline:none;border-radius:0;padding:0px 8px;margin:0px 4px;cursor:pointer;}.i1a6wz4q-Item:hover,.i1a6wz4q-Item[data-highlighted],.i1a6wz4q-Item[aria-expanded="true"]{inset:10px 4px;margin-left:4px;margin-right:4px;background-color:var(--colorBgActionsMenuItemHover);border-radius:6px;}.i1a6wz4q-Item[data-disabled]{cursor:default;color:var(--disabledTextColor);--actions-menu-item-icon-color:var(--disabledTextColor);}.i1a6wz4q-Item[data-disabled]:hover{color:var(--disabledTextColor);background-color:var(--transparent);}.fibery-mobile .i1a6wz4q-Item{font-family:"Inter Variable","SF Pro Display",-apple-system,BlinkMacSystemFont,"Segoe UI Variable Display","Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;font-size:16px;line-height:1.5;font-weight:410;color:var(--textColor);min-height:44px;padding:0px 12px;}
|
|
3
3
|
.cz86ubx-CheckboxItem{font-family:"Inter Variable","SF Pro Display",-apple-system,BlinkMacSystemFont,"Segoe UI Variable Display","Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;font-size:14px;line-height:1.5;font-weight:410;color:var(--textColor);text-transform:none;letter-spacing:normal;display:flex;align-items:center;min-height:32px;outline:none;border-radius:0;padding:0px 8px;margin:0px 4px;cursor:pointer;}.cz86ubx-CheckboxItem:hover,.cz86ubx-CheckboxItem[data-highlighted],.cz86ubx-CheckboxItem[aria-expanded="true"]{inset:10px 4px;margin-left:4px;margin-right:4px;background-color:var(--colorBgActionsMenuItemHover);border-radius:6px;}.cz86ubx-CheckboxItem[data-disabled]{cursor:default;color:var(--disabledTextColor);--actions-menu-item-icon-color:var(--disabledTextColor);}.cz86ubx-CheckboxItem[data-disabled]:hover{color:var(--disabledTextColor);background-color:var(--transparent);}.fibery-mobile .cz86ubx-CheckboxItem{font-family:"Inter Variable","SF Pro Display",-apple-system,BlinkMacSystemFont,"Segoe UI Variable Display","Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Open Sans","Helvetica Neue",sans-serif;font-size:16px;line-height:1.5;font-weight:410;color:var(--textColor);min-height:44px;padding:0px 12px;}
|
|
4
4
|
.sbtigvo-Separator{background-color:var(--actionMenuSeparatorColor);height:0.5px;margin:4px 0;}
|
|
@@ -12,30 +12,32 @@ var AutoComplete = ({ value, timeFormat: timeFormat$1 = timeFormat, onChange, me
|
|
|
12
12
|
const isPhone = useIsPhone();
|
|
13
13
|
const options = useMemo(() => Array.from({ length: 1440 / step }, (value, index) => {
|
|
14
14
|
const hour = Math.floor(index * step / 60);
|
|
15
|
+
const minute = index * step - hour * 60;
|
|
15
16
|
const label = moment({
|
|
16
17
|
hour,
|
|
17
|
-
minute
|
|
18
|
+
minute
|
|
18
19
|
}).format(timeFormat$1);
|
|
19
20
|
return {
|
|
20
21
|
value: label,
|
|
21
22
|
label
|
|
22
23
|
};
|
|
23
24
|
}), [timeFormat$1]);
|
|
25
|
+
const selectedOption = useMemo(() => {
|
|
26
|
+
if (!value) return null;
|
|
27
|
+
const timeValue = moment(value).format(timeFormat$1);
|
|
28
|
+
return options.find((option) => option.value === timeValue);
|
|
29
|
+
}, [
|
|
30
|
+
value,
|
|
31
|
+
timeFormat$1,
|
|
32
|
+
options
|
|
33
|
+
]);
|
|
24
34
|
return /* @__PURE__ */ jsx(SelectControlSettingsProvider, {
|
|
25
35
|
getPopupContainerElement: void 0,
|
|
26
36
|
children: /* @__PURE__ */ jsx(Select, {
|
|
27
37
|
inline: true,
|
|
28
38
|
options,
|
|
29
39
|
menuIsOpen,
|
|
30
|
-
value:
|
|
31
|
-
if (!value) return null;
|
|
32
|
-
const timeValue = moment(value).format(timeFormat$1);
|
|
33
|
-
return options.find((option) => option.value === timeValue);
|
|
34
|
-
}, [
|
|
35
|
-
value,
|
|
36
|
-
timeFormat$1,
|
|
37
|
-
options
|
|
38
|
-
]),
|
|
40
|
+
value: selectedOption,
|
|
39
41
|
onChange,
|
|
40
42
|
components: { Control: () => null },
|
|
41
43
|
styles: {
|
|
@@ -117,12 +117,14 @@ var DateRangeInput = forwardRef(({ startValue, endValue, showTime, dateFormat, t
|
|
|
117
117
|
}, [onReset]);
|
|
118
118
|
const onSaveValue = useCallback((e) => {
|
|
119
119
|
e.preventDefault();
|
|
120
|
-
if (inputValue === "")
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
if (inputValue === "") {
|
|
121
|
+
if (allowClear) onClear();
|
|
122
|
+
else setInputValue(formatDateRangeInputValue(startValue, endValue, {
|
|
123
|
+
showTime,
|
|
124
|
+
dateFormat,
|
|
125
|
+
dateTimeFormat
|
|
126
|
+
}));
|
|
127
|
+
}
|
|
126
128
|
const [result] = getLocaleSpecificChrono(dateFormat).parse(inputValue.replace(datesSeparator, " - "));
|
|
127
129
|
let start;
|
|
128
130
|
let end;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { eachDayOfInterval, endOfMonth, getISODay, startOfMonth } from "date-fns";
|
|
2
2
|
//#region src/date-picker/get-weekends-for-month.ts
|
|
3
3
|
var getWeekendsForMonth = (date, weekends) => {
|
|
4
|
+
const start = startOfMonth(date);
|
|
5
|
+
const end = endOfMonth(date);
|
|
4
6
|
return eachDayOfInterval({
|
|
5
|
-
start
|
|
6
|
-
end
|
|
7
|
+
start,
|
|
8
|
+
end
|
|
7
9
|
}).filter((date) => weekends.includes(getISODay(date)));
|
|
8
10
|
};
|
|
9
11
|
//#endregion
|
|
@@ -71,12 +71,14 @@ var SingleDateInput = forwardRef(({ value, showTime, dateFormat, timeFormat, dat
|
|
|
71
71
|
}, [onChange]);
|
|
72
72
|
const onSaveValue = useCallback((e) => {
|
|
73
73
|
e.preventDefault();
|
|
74
|
-
if (inputValue === "")
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
if (inputValue === "") {
|
|
75
|
+
if (allowClear) onClear();
|
|
76
|
+
else setInputValue(formatDateInputValue(value, {
|
|
77
|
+
showTime,
|
|
78
|
+
dateFormat,
|
|
79
|
+
dateTimeFormat
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
80
82
|
const [result] = getLocaleSpecificChrono(dateFormat).parse(inputValue);
|
|
81
83
|
if (result && result.start) {
|
|
82
84
|
const newValue = result.start.date();
|
|
@@ -5,9 +5,10 @@ import { RoundToggleButton } from "../toggle-button/round-toggle-button.js";
|
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/day-select/day-select.tsx
|
|
7
7
|
function DaySelect({ value = [], onChange, days, allowEmpty = false }) {
|
|
8
|
+
const stringifiedValue = value.map((v) => v.toString());
|
|
8
9
|
return /* @__PURE__ */ jsx(ToggleButtonGroup, {
|
|
9
10
|
type: "multiple",
|
|
10
|
-
value:
|
|
11
|
+
value: stringifiedValue,
|
|
11
12
|
onValueChange: (v) => {
|
|
12
13
|
if (v.length === 0 && !allowEmpty) return;
|
|
13
14
|
onChange(v.map(Number));
|
|
@@ -9,11 +9,11 @@ declare enum Days {
|
|
|
9
9
|
SA = 5,
|
|
10
10
|
SU = 6
|
|
11
11
|
}
|
|
12
|
-
declare const getDays: ((arg:
|
|
12
|
+
declare const getDays: ((arg: number) => {
|
|
13
13
|
key: string;
|
|
14
14
|
title: string;
|
|
15
15
|
value: Days;
|
|
16
|
-
}[]) & import("@fibery/helpers/src/_").MemoizedFunction<
|
|
16
|
+
}[]) & import("@fibery/helpers/src/_").MemoizedFunction<number, {
|
|
17
17
|
key: string;
|
|
18
18
|
title: string;
|
|
19
19
|
value: Days;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DaySelect } from "./day-select.js";
|
|
2
|
-
import {
|
|
2
|
+
import { memoizeLeak } from "@fibery/helpers/src/_";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
//#region src/day-select/week-day-select.tsx
|
|
5
5
|
var Days = /* @__PURE__ */ function(Days) {
|
|
@@ -21,7 +21,7 @@ var WeekDayMap = {
|
|
|
21
21
|
SA: 5,
|
|
22
22
|
SU: 6
|
|
23
23
|
};
|
|
24
|
-
var getDays =
|
|
24
|
+
var getDays = memoizeLeak((firstDay) => {
|
|
25
25
|
const entries = Object.entries(WeekDayMap);
|
|
26
26
|
const firstDayIndex = entries.findIndex((entry) => entry[1] === firstDay);
|
|
27
27
|
const partA = entries.slice(firstDayIndex);
|
|
@@ -35,10 +35,11 @@ var getDays = memoize((firstDay) => {
|
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
37
|
function WeekdaySelect({ value = [], onChange, firstDay }) {
|
|
38
|
+
const days = getDays(firstDay);
|
|
38
39
|
return /* @__PURE__ */ jsx(DaySelect, {
|
|
39
40
|
value,
|
|
40
41
|
onChange,
|
|
41
|
-
days
|
|
42
|
+
days
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { produceColor } from "../color-utils.js";
|
|
2
|
-
import {
|
|
2
|
+
import { memoizeColor } from "../memoize.js";
|
|
3
3
|
//#region src/design-system/alpha.ts
|
|
4
4
|
var transparent = "rgba(255, 255, 255, 0)";
|
|
5
5
|
var opacity = {
|
|
@@ -32,11 +32,9 @@ var opacity = {
|
|
|
32
32
|
opacity0: 0
|
|
33
33
|
};
|
|
34
34
|
var defineAlphaCoefficient = (value) => value;
|
|
35
|
-
var alpha =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}));
|
|
40
|
-
}, (a, b) => a + b);
|
|
35
|
+
var alpha = memoizeColor((color, alpha) => produceColor(color, (oklch) => ({
|
|
36
|
+
...oklch,
|
|
37
|
+
alpha
|
|
38
|
+
})), (color, alpha) => `${color}/${alpha}`);
|
|
41
39
|
//#endregion
|
|
42
40
|
export { alpha, defineAlphaCoefficient, opacity, transparent };
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { ThemeMode } from "../theme-settings-core.js";
|
|
2
2
|
//#region src/design-system/colors-js.d.ts
|
|
3
3
|
declare const getDarkenColor: ((arg: string) => string) & import("@fibery/helpers/src/_").MemoizedFunction<string, string>;
|
|
4
|
-
|
|
5
|
-
declare const getTextColor: ((arg: string) => string) & import("@fibery/helpers/src/_").MemoizedFunction<string, string>;
|
|
6
|
-
declare const getObjectColorMemoized: ((arg: string | null | undefined) => string) & import("@fibery/helpers/src/_").MemoizedFunction<string | null | undefined, string>;
|
|
4
|
+
declare function getObjectColor(name: string | null | undefined): string;
|
|
7
5
|
declare function makeSelect(mode: ThemeMode): <T>(values: {
|
|
8
6
|
light: T;
|
|
9
7
|
dark: T;
|
|
10
8
|
}) => T;
|
|
11
9
|
//#endregion
|
|
12
|
-
export { getDarkenColor,
|
|
10
|
+
export { getDarkenColor, getObjectColor, makeSelect };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { produceColor } from "../color-utils.js";
|
|
2
|
+
import { memoizeColor } from "../memoize.js";
|
|
3
3
|
import { clampChroma } from "culori";
|
|
4
4
|
import ColorHash from "color-hash";
|
|
5
5
|
//#region src/design-system/colors-js.ts
|
|
6
|
-
var getDarkenColor =
|
|
6
|
+
var getDarkenColor = memoizeColor((color) => {
|
|
7
7
|
return produceColor(color, (oklch) => {
|
|
8
8
|
return clampChroma({
|
|
9
9
|
...oklch,
|
|
@@ -12,12 +12,7 @@ var getDarkenColor = memoize((color) => {
|
|
|
12
12
|
}, "oklch");
|
|
13
13
|
});
|
|
14
14
|
});
|
|
15
|
-
|
|
16
|
-
var getTextColor = memoize((color) => {
|
|
17
|
-
return cssFromUnsafe(color);
|
|
18
|
-
});
|
|
19
|
-
var getObjectColorMemoized = memoize((name) => {
|
|
20
|
-
if (!name) return "#999999";
|
|
15
|
+
var getObjectColorMemoized = memoizeColor((name) => {
|
|
21
16
|
return new ColorHash({
|
|
22
17
|
lightness: [
|
|
23
18
|
.5,
|
|
@@ -33,6 +28,9 @@ var getObjectColorMemoized = memoize((name) => {
|
|
|
33
28
|
]
|
|
34
29
|
}).hex(name);
|
|
35
30
|
});
|
|
31
|
+
function getObjectColor(name) {
|
|
32
|
+
return name ? getObjectColorMemoized(name) : "#999999";
|
|
33
|
+
}
|
|
36
34
|
function makeSelect(mode) {
|
|
37
35
|
return function select(values) {
|
|
38
36
|
if (mode in values) return values[mode];
|
|
@@ -40,4 +38,4 @@ function makeSelect(mode) {
|
|
|
40
38
|
};
|
|
41
39
|
}
|
|
42
40
|
//#endregion
|
|
43
|
-
export { getDarkenColor,
|
|
41
|
+
export { getDarkenColor, getObjectColor, makeSelect };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mixSrgb, produceColor } from "../color-utils.js";
|
|
2
|
+
import { memoizeColor } from "../memoize.js";
|
|
2
3
|
import { ensureLcFloor } from "../apca.js";
|
|
3
4
|
import { mapDef } from "./def.js";
|
|
4
|
-
import { memoizeColor } from "../memoize.js";
|
|
5
5
|
//#region src/design-system/fns.enum.ts
|
|
6
6
|
/**
|
|
7
7
|
* Card color-coding alpha used by {@link paintedCardSurface}. Cards in
|
|
@@ -10,7 +10,7 @@ import { memoizeColor } from "../memoize.js";
|
|
|
10
10
|
*/
|
|
11
11
|
var CARD_COLOR_CODING_ALPHA = .1;
|
|
12
12
|
/** CSS percentage string for the surface side of the card color-mix — pair with {@link CARD_COLOR_CODING_ALPHA}. */
|
|
13
|
-
var CARD_COLOR_CODING_SURFACE_PERCENT =
|
|
13
|
+
var CARD_COLOR_CODING_SURFACE_PERCENT = `90%`;
|
|
14
14
|
/**
|
|
15
15
|
* Reproduce the painted card surface that `box.tsx`'s `colorCodingClassName`
|
|
16
16
|
* renders, so contrast checks can target the surface a badge actually sits on
|
|
@@ -38,10 +38,13 @@ function makeEnumFn(deneutralizeFilterDef, adaptDef, enumDefs) {
|
|
|
38
38
|
const baseSurface = adaptDef[side];
|
|
39
39
|
const { swatchAlpha, minC, surfaceLc, colorCodingLc } = enumDefs.bg[side];
|
|
40
40
|
const bgFromNeutral = memoizeColor((neutralColor) => {
|
|
41
|
-
|
|
41
|
+
const tinted = tintEnum(deneutralize(neutralColor), baseSurface, swatchAlpha, minC);
|
|
42
|
+
return ensureLcFloor(tinted, baseSurface, surfaceLc);
|
|
42
43
|
});
|
|
43
44
|
const bgFromBlend = memoizeColor((neutralColor, cardColorCoding) => {
|
|
44
|
-
|
|
45
|
+
const bare = bgFromNeutral(neutralColor);
|
|
46
|
+
const paintedSurface = paintedCardSurface(cardColorCoding, baseSurface);
|
|
47
|
+
return ensureLcFloor(bare, paintedSurface, colorCodingLc);
|
|
45
48
|
}, (neutralColor, cardColorCoding) => `${neutralColor}|${cardColorCoding}`);
|
|
46
49
|
return (neutralColor, cardColorCoding) => ({ bg: cardColorCoding ? bgFromBlend(neutralColor, cardColorCoding) : bgFromNeutral(neutralColor) });
|
|
47
50
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { colorFromUnsafe, oklchFrom, produceColor } from "../color-utils.js";
|
|
2
|
+
import { memoizeColor } from "../memoize.js";
|
|
2
3
|
import { lightnessFromLc } from "../apca.js";
|
|
3
4
|
import { mapDef } from "./def.js";
|
|
4
|
-
import { memoizeColor } from "../memoize.js";
|
|
5
5
|
//#region src/design-system/fns.icon.ts
|
|
6
6
|
var ACHROMATIC_C = .015;
|
|
7
7
|
var PASTEL_C_CEILING = .06;
|
package/lib/design-system/fns.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { colorFromUnsafe, oklchFrom, produceColor } from "../color-utils.js";
|
|
2
|
+
import { memoizeColor } from "../memoize.js";
|
|
2
3
|
import { alpha } from "./alpha.js";
|
|
3
4
|
import { alphaCoefficients } from "./alpha-coefficients.js";
|
|
4
5
|
import { colorFromLcCompensated, lightnessFromLc } from "../apca.js";
|
|
5
6
|
import { mapDef } from "./def.js";
|
|
6
7
|
import { getDarkenColor } from "./colors-js.js";
|
|
7
8
|
import { a11yColor } from "../a11y-color.js";
|
|
8
|
-
import { memoizeColor } from "../memoize.js";
|
|
9
9
|
import { makeEnumFn } from "./fns.enum.js";
|
|
10
10
|
import { darkIconParams, lightIconParams, makeIconFn, makeIconSide } from "./fns.icon.js";
|
|
11
11
|
//#region src/design-system/fns.ts
|
|
@@ -60,10 +60,12 @@ function createColorFns(deneutralizeFilterDef, defs) {
|
|
|
60
60
|
typeLabelFg: mapDef(deneutralizeFilterDef, (deneutralize, side) => memoizeColor((neutralColor) => typeLabelFgAdapt[side].fg(deneutralize(neutralColor)))),
|
|
61
61
|
badge: mapDef(deneutralizeFilterDef, (deneutralize, side) => memoizeColor((neutralColor) => {
|
|
62
62
|
const oklch = oklchFrom(colorFromUnsafe(neutralColor ?? defs.icon[side]));
|
|
63
|
-
const
|
|
63
|
+
const deneutralized = neutralColor ? deneutralize(neutralColor) : defs.icon[side];
|
|
64
|
+
const darken = getDarkenColor(deneutralized);
|
|
64
65
|
const bg = icon[side](neutralColor ?? defs.icon[side]).fg;
|
|
66
|
+
const bgL = oklchFrom(colorFromUnsafe(bg))?.l ?? 0;
|
|
65
67
|
return {
|
|
66
|
-
fg: colorFromLcCompensated(bg,
|
|
68
|
+
fg: colorFromLcCompensated(bg, bgL > .8 ? 90 : -90, oklch.c, oklch.h ?? 0, deneutralize),
|
|
67
69
|
bg,
|
|
68
70
|
border: bg,
|
|
69
71
|
borderSelected: darken
|
|
@@ -76,8 +78,9 @@ function createColorFns(deneutralizeFilterDef, defs) {
|
|
|
76
78
|
const surface = defs.callout[side];
|
|
77
79
|
return memoizeColor((neutralColor) => {
|
|
78
80
|
const deneutralized = deneutralize(neutralColor);
|
|
81
|
+
const blended = a11yColor(alpha(deneutralized, alphaCoefficients.adaptiveUserColor.calloutBg[side]), surface, side === 0 ? 1 : 1.3);
|
|
79
82
|
return {
|
|
80
|
-
bg: produceColor(
|
|
83
|
+
bg: produceColor(blended, ({ l, c, h }) => {
|
|
81
84
|
const lFloor = lightnessFromLc(surface, side === 0 ? 2 : -2, c, h);
|
|
82
85
|
const lCap = lightnessFromLc(surface, side === 0 ? 20 : -20, c, h);
|
|
83
86
|
const [lo, hi] = side === 0 ? [lCap, lFloor] : [lFloor, lCap];
|
|
@@ -2,7 +2,7 @@ import { ThemePalette } from "./types.js";
|
|
|
2
2
|
import { ThemeMode } from "../theme-settings-core.js";
|
|
3
3
|
import { ThemeDefs } from "./colors.js";
|
|
4
4
|
//#region src/design-system/theme.d.ts
|
|
5
|
-
declare function themeFromDefs(defs: ThemeDefs, mode: ThemeMode
|
|
5
|
+
declare function themeFromDefs(defs: ThemeDefs, mode: ThemeMode): {
|
|
6
6
|
key: string;
|
|
7
7
|
mode: ThemeMode;
|
|
8
8
|
select: <T>(values: {
|
|
@@ -610,10 +610,10 @@ declare function themeFromDefs(defs: ThemeDefs, mode: ThemeMode, ns?: string): {
|
|
|
610
610
|
}>;
|
|
611
611
|
};
|
|
612
612
|
/** @deprecated consider extracting token, internal use only */
|
|
613
|
-
varname: (key:
|
|
613
|
+
varname: (key: string) => string;
|
|
614
614
|
};
|
|
615
615
|
type Theme = ReturnType<typeof themeFromDefs>;
|
|
616
|
-
declare function themeFromPaletteImpl(palette: ThemePalette, mode: ThemeMode
|
|
616
|
+
declare function themeFromPaletteImpl(palette: ThemePalette, mode: ThemeMode): {
|
|
617
617
|
key: string;
|
|
618
618
|
mode: ThemeMode;
|
|
619
619
|
select: <T>(values: {
|
|
@@ -1221,7 +1221,7 @@ declare function themeFromPaletteImpl(palette: ThemePalette, mode: ThemeMode, ns
|
|
|
1221
1221
|
}>;
|
|
1222
1222
|
};
|
|
1223
1223
|
/** @deprecated consider extracting token, internal use only */
|
|
1224
|
-
varname: (key:
|
|
1224
|
+
varname: (key: string) => string;
|
|
1225
1225
|
};
|
|
1226
1226
|
declare const themeFromPalette: typeof themeFromPaletteImpl & import("@fibery/helpers/src/_").MemoizedFunction<string, {
|
|
1227
1227
|
key: string;
|
|
@@ -1831,7 +1831,7 @@ declare const themeFromPalette: typeof themeFromPaletteImpl & import("@fibery/he
|
|
|
1831
1831
|
}>;
|
|
1832
1832
|
};
|
|
1833
1833
|
/** @deprecated consider extracting token, internal use only */
|
|
1834
|
-
varname: (key:
|
|
1834
|
+
varname: (key: string) => string;
|
|
1835
1835
|
}>;
|
|
1836
1836
|
type Styles = Record<string, string>;
|
|
1837
1837
|
declare const stylesFromTheme: ((arg: Pick<{
|
|
@@ -2442,7 +2442,7 @@ declare const stylesFromTheme: ((arg: Pick<{
|
|
|
2442
2442
|
}>;
|
|
2443
2443
|
};
|
|
2444
2444
|
/** @deprecated consider extracting token, internal use only */
|
|
2445
|
-
varname: (key:
|
|
2445
|
+
varname: (key: string) => string;
|
|
2446
2446
|
}, "colors" | "varname">) => Styles) & import("@fibery/helpers/src/_").MemoizedFunction<Pick<{
|
|
2447
2447
|
key: string;
|
|
2448
2448
|
mode: ThemeMode;
|
|
@@ -3051,7 +3051,7 @@ declare const stylesFromTheme: ((arg: Pick<{
|
|
|
3051
3051
|
}>;
|
|
3052
3052
|
};
|
|
3053
3053
|
/** @deprecated consider extracting token, internal use only */
|
|
3054
|
-
varname: (key:
|
|
3054
|
+
varname: (key: string) => string;
|
|
3055
3055
|
}, "colors" | "varname">, Styles>;
|
|
3056
3056
|
//#endregion
|
|
3057
3057
|
export { Styles, Theme, stylesFromTheme, themeFromDefs, themeFromPalette };
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { makeSelect } from "./colors-js.js";
|
|
2
2
|
import { defsFromPalette, sideFromDefs } from "./colors.js";
|
|
3
|
-
import {
|
|
4
|
-
import { typedObjectEntries } from "@fibery/helpers/utils/object";
|
|
3
|
+
import { memoizeLeak, memoizeWeak } from "@fibery/helpers/src/_";
|
|
5
4
|
import { LRUCache } from "lru-cache";
|
|
6
5
|
//#region src/design-system/theme.ts
|
|
7
|
-
function
|
|
8
|
-
if (ns === void 0) return (key) => `--${key}`;
|
|
9
|
-
else return (key) => `--${ns}-${key}`;
|
|
10
|
-
}
|
|
11
|
-
function themeFromDefs(defs, mode, ns) {
|
|
6
|
+
function themeFromDefs(defs, mode) {
|
|
12
7
|
const { colors, fns } = sideFromDefs(defs, mode);
|
|
13
8
|
return {
|
|
14
9
|
key: `${defs.key}-${mode}`,
|
|
@@ -17,16 +12,16 @@ function themeFromDefs(defs, mode, ns) {
|
|
|
17
12
|
colors,
|
|
18
13
|
fns,
|
|
19
14
|
/** @deprecated consider extracting token, internal use only */
|
|
20
|
-
varname:
|
|
15
|
+
varname: (key) => `--${key}`
|
|
21
16
|
};
|
|
22
17
|
}
|
|
23
|
-
function themeFromPaletteImpl(palette, mode
|
|
24
|
-
return themeFromDefs(defsFromPalette(palette), mode
|
|
18
|
+
function themeFromPaletteImpl(palette, mode) {
|
|
19
|
+
return themeFromDefs(defsFromPalette(palette), mode);
|
|
25
20
|
}
|
|
26
|
-
var themeFromPalette =
|
|
21
|
+
var themeFromPalette = memoizeLeak(themeFromPaletteImpl, (palette, mode) => `${palette.key}-${mode}`);
|
|
27
22
|
themeFromPalette.cache = new LRUCache({ max: 4 });
|
|
28
23
|
function stylesFromThemeImpl(theme) {
|
|
29
|
-
return
|
|
24
|
+
return Object.entries(theme.colors).reduce((inlineTheme, [key, value]) => {
|
|
30
25
|
inlineTheme[theme.varname(key)] = value;
|
|
31
26
|
return inlineTheme;
|
|
32
27
|
}, {});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { typedObjectEntries } from "@fibery/helpers/utils/object";
|
|
2
1
|
//#region src/design-system/vars.ts
|
|
3
2
|
function varsFromTheme(theme) {
|
|
4
3
|
const vars = {};
|
|
5
|
-
for (const [key, value] of
|
|
4
|
+
for (const [key, value] of Object.entries(theme.colors)) vars[key] = `var(${theme.varname(key)})`;
|
|
6
5
|
return vars;
|
|
7
6
|
}
|
|
8
7
|
function layoutVarNamesFromPrefix(prefix) {
|