@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/a11y-color.js
CHANGED
|
@@ -69,12 +69,13 @@ function a11yColor(fg, bg, minimumContrast = 3) {
|
|
|
69
69
|
let minLightness = 0;
|
|
70
70
|
let maxLightness = 100;
|
|
71
71
|
let isDarkColor = false;
|
|
72
|
-
if (isBlackBgContrast && isWhiteBgContrast)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
if (isBlackBgContrast && isWhiteBgContrast) {
|
|
73
|
+
if (a11yLightness >= 50) minLightness = a11yLightness;
|
|
74
|
+
else {
|
|
75
|
+
maxLightness = a11yLightness;
|
|
76
|
+
isDarkColor = true;
|
|
77
|
+
}
|
|
78
|
+
} else if (isBlackBgContrast) {
|
|
78
79
|
maxLightness = a11yLightness;
|
|
79
80
|
isDarkColor = true;
|
|
80
81
|
} else minLightness = a11yLightness;
|
|
@@ -91,10 +92,11 @@ function a11yColor(fg, bg, minimumContrast = 3) {
|
|
|
91
92
|
res = midColor;
|
|
92
93
|
break;
|
|
93
94
|
}
|
|
94
|
-
if (wcagContrast(midColor, effectiveBg) >= minimumContrast)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
if (wcagContrast(midColor, effectiveBg) >= minimumContrast) {
|
|
96
|
+
if (maxLightness - minLightness <= minHexDiff) res = midColor;
|
|
97
|
+
else if (isDarkColor) minLightness = midLightness;
|
|
98
|
+
else maxLightness = midLightness;
|
|
99
|
+
} else if (isDarkColor) maxLightness = midLightness;
|
|
98
100
|
else minLightness = midLightness;
|
|
99
101
|
}
|
|
100
102
|
const foundColorCss = cssFromColor(res);
|
|
@@ -25,6 +25,8 @@ type ActionsMenuProps = {
|
|
|
25
25
|
autoFocusOnClose?: boolean;
|
|
26
26
|
/** Show menu in a modal on mobile */
|
|
27
27
|
supportsMobile?: boolean;
|
|
28
|
+
/** Mobile presentation when supportsMobile is set: full-screen popover (default) or a bottom-sheet drawer */
|
|
29
|
+
mobileVariant?: "popover" | "drawer";
|
|
28
30
|
mobileTitle?: string;
|
|
29
31
|
height?: string;
|
|
30
32
|
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
@@ -16,6 +16,10 @@ var ActionsMenuSubCommandMenu = ({ disabled, trigger, children, Icon }) => {
|
|
|
16
16
|
const [open, onOpenChange] = useState(false);
|
|
17
17
|
const triggerRef = useRef(null);
|
|
18
18
|
const openRef = useRef(false);
|
|
19
|
+
const ctx = useMemo(() => ({
|
|
20
|
+
subMenuOpenRef: openRef,
|
|
21
|
+
subMenuTriggerRef: triggerRef
|
|
22
|
+
}), []);
|
|
19
23
|
return /* @__PURE__ */ jsx(ActionsMenuSubMenu, {
|
|
20
24
|
disabled,
|
|
21
25
|
open,
|
|
@@ -28,10 +32,7 @@ var ActionsMenuSubCommandMenu = ({ disabled, trigger, children, Icon }) => {
|
|
|
28
32
|
triggerRef,
|
|
29
33
|
contentClassName: "c199nm2d-content",
|
|
30
34
|
children: jsx(ActionsMenuSubCommandMenuProvider, {
|
|
31
|
-
value:
|
|
32
|
-
subMenuOpenRef: openRef,
|
|
33
|
-
subMenuTriggerRef: triggerRef
|
|
34
|
-
}), []),
|
|
35
|
+
value: ctx,
|
|
35
36
|
children
|
|
36
37
|
})
|
|
37
38
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActionsMenuProps } from "./actions-menu-props.js";
|
|
2
2
|
//#region src/actions-menu/actions-menu.d.ts
|
|
3
3
|
declare const preventDefaultAndStopPropagation: (event: React.MouseEvent) => void;
|
|
4
|
-
declare const ActionsMenu: ({ trigger, triggerEvent, wide, align, alignOffset, side, sideOffset, collisionPadding, open, onOpenChange, onEscapeKeyDown, children, portalled, container, disabled, contentStyles, modal, autoFocusOnClose, supportsMobile, mobileTitle, sticky, height }: ActionsMenuProps) => JSX.Element;
|
|
4
|
+
declare const ActionsMenu: ({ trigger, triggerEvent, wide, align, alignOffset, side, sideOffset, collisionPadding, open, onOpenChange, onEscapeKeyDown, children, portalled, container, disabled, contentStyles, modal, autoFocusOnClose, supportsMobile, mobileVariant, mobileTitle, sticky, height }: ActionsMenuProps) => JSX.Element;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { ActionsMenu, preventDefaultAndStopPropagation };
|
|
@@ -18,7 +18,7 @@ var preventDefaultAndStopPropagation = (event) => {
|
|
|
18
18
|
event.stopPropagation();
|
|
19
19
|
};
|
|
20
20
|
var wideCss = "wxkzlue-wide";
|
|
21
|
-
var ActionsMenu = ({ trigger, triggerEvent = "click", wide, align = "start", alignOffset, side, sideOffset, collisionPadding, open, onOpenChange, onEscapeKeyDown, children, portalled, container, disabled, contentStyles, modal, autoFocusOnClose, supportsMobile, mobileTitle, sticky, height }) => {
|
|
21
|
+
var ActionsMenu = ({ trigger, triggerEvent = "click", wide, align = "start", alignOffset, side, sideOffset, collisionPadding, open, onOpenChange, onEscapeKeyDown, children, portalled, container, disabled, contentStyles, modal, autoFocusOnClose, supportsMobile, mobileVariant, mobileTitle, sticky, height }) => {
|
|
22
22
|
const [isOpen = false, setOpen] = useControllableState({
|
|
23
23
|
value: open,
|
|
24
24
|
onChange: onOpenChange
|
|
@@ -42,6 +42,7 @@ var ActionsMenu = ({ trigger, triggerEvent = "click", wide, align = "start", ali
|
|
|
42
42
|
onOpenChange: setOpen,
|
|
43
43
|
modal: modal || false,
|
|
44
44
|
title: mobileTitle,
|
|
45
|
+
variant: mobileVariant,
|
|
45
46
|
children: [/* @__PURE__ */ jsx(MenuPrimitive.Trigger, {
|
|
46
47
|
className: isOpen ? "actions-visible" : "actions-hidden actions-visible-on-mobile",
|
|
47
48
|
onClick: triggerEvent === "click" ? preventDefaultAndStopPropagation : void 0,
|
|
@@ -4,18 +4,19 @@ import { createContext as createContext$1 } from "@fibery/react/src/create-conte
|
|
|
4
4
|
//#region src/actions-menu/contexts/actions-menu-context.tsx
|
|
5
5
|
var [Provider, useContext$1] = createContext$1("ActionsMenuContext");
|
|
6
6
|
var ActionsMenuContextProvider = ({ setOpen, showConfirmation, MenuPrimitive, container, children }) => {
|
|
7
|
+
const context = useMemo(() => ({
|
|
8
|
+
close: () => setOpen(false),
|
|
9
|
+
MenuPrimitive,
|
|
10
|
+
showConfirmation,
|
|
11
|
+
container
|
|
12
|
+
}), [
|
|
13
|
+
MenuPrimitive,
|
|
14
|
+
showConfirmation,
|
|
15
|
+
container,
|
|
16
|
+
setOpen
|
|
17
|
+
]);
|
|
7
18
|
return /* @__PURE__ */ jsx(Provider, {
|
|
8
|
-
value:
|
|
9
|
-
close: () => setOpen(false),
|
|
10
|
-
MenuPrimitive,
|
|
11
|
-
showConfirmation,
|
|
12
|
-
container
|
|
13
|
-
}), [
|
|
14
|
-
MenuPrimitive,
|
|
15
|
-
showConfirmation,
|
|
16
|
-
container,
|
|
17
|
-
setOpen
|
|
18
|
-
]),
|
|
19
|
+
value: context,
|
|
19
20
|
children
|
|
20
21
|
});
|
|
21
22
|
};
|
package/lib/ai/max-tokens.js
CHANGED
|
@@ -6,17 +6,18 @@ import { useCallback, useState } from "react";
|
|
|
6
6
|
var inputStyle = "i1hleh57-input";
|
|
7
7
|
var MaxTokens = ({ min = 1, max = 2048, step = 1, initialValue, onChange }) => {
|
|
8
8
|
const [internalValue, setInternalValue] = useState(initialValue);
|
|
9
|
+
const handleChange = useCallback((event) => {
|
|
10
|
+
const nextValue = parseInt(event.target.value);
|
|
11
|
+
setInternalValue(nextValue);
|
|
12
|
+
onChange(nextValue);
|
|
13
|
+
}, [onChange, setInternalValue]);
|
|
9
14
|
return /* @__PURE__ */ jsx("div", { children: jsx("input", {
|
|
10
15
|
type: "range",
|
|
11
16
|
min,
|
|
12
17
|
max,
|
|
13
18
|
step,
|
|
14
19
|
value: internalValue,
|
|
15
|
-
onChange:
|
|
16
|
-
const nextValue = parseInt(event.target.value);
|
|
17
|
-
setInternalValue(nextValue);
|
|
18
|
-
onChange(nextValue);
|
|
19
|
-
}, [onChange, setInternalValue]),
|
|
20
|
+
onChange: handleChange,
|
|
20
21
|
className: inputStyle
|
|
21
22
|
}) });
|
|
22
23
|
};
|
package/lib/antd/ant-modal.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ type AntModalProps = Omit<IDialogPropTypes, "visible" | "onClose" | "prefixCls">
|
|
|
7
7
|
centered?: boolean;
|
|
8
8
|
bodyStyle?: CSSProperties;
|
|
9
9
|
};
|
|
10
|
-
declare function AntModal({ open, onCancel, centered, bodyStyle, className, wrapClassName, rootClassName, width, transitionName, maskTransitionName, closeIcon, ...restProps }: AntModalProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function AntModal({ open, onCancel, centered, bodyStyle, className, wrapClassName, rootClassName, width, transitionName, maskTransitionName, closeIcon, keyboard, ...restProps }: AntModalProps): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { AntModal, AntModalProps };
|
package/lib/antd/ant-modal.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import "./ant-modal.wyw-in-js.css";
|
|
2
2
|
import { ThemeProvider } from "../theme-provider.js";
|
|
3
3
|
import Close from "../icons/react/close.js";
|
|
4
|
+
import { usePopupStackContext } from "../popover/popup-stack-context.js";
|
|
4
5
|
/* empty css */
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
import { useEffect, useId, useRef } from "react";
|
|
6
8
|
import { cx } from "@linaria/core";
|
|
7
9
|
import Dialog from "rc-dialog";
|
|
8
10
|
//#region src/antd/ant-modal.tsx
|
|
@@ -14,8 +16,33 @@ function renderWithTheme(node) {
|
|
|
14
16
|
children: node
|
|
15
17
|
});
|
|
16
18
|
}
|
|
17
|
-
function AntModal({ open, onCancel, centered, bodyStyle = {}, className, wrapClassName, rootClassName, width = 520, transitionName = "ant-zoom", maskTransitionName = "ant-fade", closeIcon = defaultCloseIcon, ...restProps }) {
|
|
19
|
+
function AntModal({ open, onCancel, centered, bodyStyle = {}, className, wrapClassName, rootClassName, width = 520, transitionName = "ant-zoom", maskTransitionName = "ant-fade", closeIcon = defaultCloseIcon, keyboard = true, ...restProps }) {
|
|
20
|
+
const contentId = useId();
|
|
21
|
+
const { registerPopup, registerEscapeCallback } = usePopupStackContext();
|
|
22
|
+
const onCancelRef = useRef(onCancel);
|
|
23
|
+
onCancelRef.current = onCancel;
|
|
24
|
+
const stackAvailable = Boolean(registerEscapeCallback);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!open || !keyboard || !registerEscapeCallback) return;
|
|
27
|
+
const unregisterPopup = registerPopup?.(contentId);
|
|
28
|
+
const unregisterEscape = registerEscapeCallback(contentId, (e) => {
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
e.stopPropagation();
|
|
31
|
+
onCancelRef.current?.(e);
|
|
32
|
+
});
|
|
33
|
+
return () => {
|
|
34
|
+
unregisterEscape();
|
|
35
|
+
unregisterPopup?.();
|
|
36
|
+
};
|
|
37
|
+
}, [
|
|
38
|
+
open,
|
|
39
|
+
keyboard,
|
|
40
|
+
contentId,
|
|
41
|
+
registerPopup,
|
|
42
|
+
registerEscapeCallback
|
|
43
|
+
]);
|
|
18
44
|
return /* @__PURE__ */ jsx(Dialog, {
|
|
45
|
+
keyboard: stackAvailable ? false : keyboard,
|
|
19
46
|
prefixCls: "ant-modal",
|
|
20
47
|
visible: open,
|
|
21
48
|
onClose: onCancel,
|
package/lib/antd/ant-upload.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ declare const AntUpload: import("react").ForwardRefExoticComponent<Omit<UploadPr
|
|
|
41
41
|
className?: string;
|
|
42
42
|
wrapClassName?: string;
|
|
43
43
|
children?: React.ReactNode;
|
|
44
|
-
onChange?: (info: UploadChangeParam
|
|
44
|
+
onChange?: (info: UploadChangeParam) => void;
|
|
45
45
|
} & import("react").RefAttributes<HTMLSpanElement>>;
|
|
46
46
|
//#endregion
|
|
47
47
|
export { AntUpload, AntUploadProps, UploadChangeParam, UploadFile, UploadFileStatus, type UploadRequestOption, antUploadStyle };
|
package/lib/antd/ant-upload.js
CHANGED
|
@@ -98,28 +98,33 @@ var AntUpload = forwardRef(function AntUpload({ type = "select", listType = "tex
|
|
|
98
98
|
onSuccess: handleSuccess,
|
|
99
99
|
onError: handleError
|
|
100
100
|
};
|
|
101
|
-
if (type === "drag")
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
children: /* @__PURE__ */ jsx(
|
|
114
|
-
|
|
115
|
-
|
|
101
|
+
if (type === "drag") {
|
|
102
|
+
const hasUploading = fileList.some((f) => f.status === "uploading");
|
|
103
|
+
const dragCls = cx("ant-upload", "ant-upload-drag", hasUploading && "ant-upload-drag-uploading", dragState === "dragover" && "ant-upload-drag-hover", disabled && "ant-upload-disabled", className);
|
|
104
|
+
return /* @__PURE__ */ jsx(Wrapper, {
|
|
105
|
+
className: wrapClassName,
|
|
106
|
+
children: jsx("span", {
|
|
107
|
+
ref,
|
|
108
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
109
|
+
className: dragCls,
|
|
110
|
+
onDrop: onFileDrop,
|
|
111
|
+
onDragOver: onFileDrop,
|
|
112
|
+
onDragLeave: onFileDrop,
|
|
113
|
+
children: /* @__PURE__ */ jsx(RcUpload, {
|
|
114
|
+
...rcUploadProps,
|
|
115
|
+
className: "ant-upload-btn",
|
|
116
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
117
|
+
className: "ant-upload-drag-container",
|
|
118
|
+
children
|
|
119
|
+
})
|
|
116
120
|
})
|
|
117
121
|
})
|
|
118
122
|
})
|
|
119
|
-
})
|
|
120
|
-
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
const buttonCls = cx("ant-upload", "ant-upload-select", `ant-upload-select-${listType}`, disabled && "ant-upload-disabled");
|
|
121
126
|
const button = /* @__PURE__ */ jsx("div", {
|
|
122
|
-
className:
|
|
127
|
+
className: buttonCls,
|
|
123
128
|
children: jsx(RcUpload, {
|
|
124
129
|
...rcUploadProps,
|
|
125
130
|
children
|
package/lib/antd/input.js
CHANGED
|
@@ -13,13 +13,14 @@ import RcTextArea from "rc-textarea";
|
|
|
13
13
|
var clearIconNode = /* @__PURE__ */ jsx(CircleCross, {});
|
|
14
14
|
var Input = forwardRef(function Input({ status, className, allowClear, bordered = true, ...props }, ref) {
|
|
15
15
|
const statusClass = status === "error" ? "ant-input-status-error" : void 0;
|
|
16
|
+
const allowClearProp = useMemo(() => {
|
|
17
|
+
if (allowClear === true) return { clearIcon: clearIconNode };
|
|
18
|
+
return allowClear;
|
|
19
|
+
}, [allowClear]);
|
|
16
20
|
return /* @__PURE__ */ jsx(RcInput, {
|
|
17
21
|
prefixCls: "ant-input",
|
|
18
22
|
ref,
|
|
19
|
-
allowClear:
|
|
20
|
-
if (allowClear === true) return { clearIcon: clearIconNode };
|
|
21
|
-
return allowClear;
|
|
22
|
-
}, [allowClear]),
|
|
23
|
+
allowClear: allowClearProp,
|
|
23
24
|
className: cx(className, statusClass, !bordered && "ant-input-borderless"),
|
|
24
25
|
...props
|
|
25
26
|
});
|
package/lib/antd/utils.js
CHANGED
|
@@ -16,11 +16,12 @@ var wrapWith = (WrapperComponent, Component) => {
|
|
|
16
16
|
var wrapWithPopupContainer = (Wrapper, WrappedComponent) => {
|
|
17
17
|
return forwardRef(function ProvidePopupContainerGetter(props, forwardedRef) {
|
|
18
18
|
const wrapperRef = useRef(null);
|
|
19
|
+
const getPopupContainer = useCallback(() => wrapperRef.current, []);
|
|
19
20
|
return /* @__PURE__ */ jsx(Wrapper, {
|
|
20
21
|
ref: wrapperRef,
|
|
21
22
|
children: /* @__PURE__ */ jsx(WrappedComponent, {
|
|
22
23
|
ref: forwardedRef,
|
|
23
|
-
getPopupContainer
|
|
24
|
+
getPopupContainer,
|
|
24
25
|
...props
|
|
25
26
|
})
|
|
26
27
|
});
|
package/lib/avatar-colors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { produceColor } from "./color-utils.js";
|
|
2
|
-
import { Swatch } from "./design-system/colors-swatches.js";
|
|
3
2
|
import { memoizeColor } from "./memoize.js";
|
|
3
|
+
import { Swatch } from "./design-system/colors-swatches.js";
|
|
4
4
|
//#region src/avatar-colors.ts
|
|
5
5
|
var cyrb53 = (str, seed = 0) => {
|
|
6
6
|
let h1 = 3735928559 ^ seed;
|
package/lib/avatar.d.ts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import { FibermojiPlaceholder } from "./fibermoji-placeholder.js";
|
|
2
2
|
import { FC } from "react";
|
|
3
3
|
//#region src/avatar.d.ts
|
|
4
|
-
declare const getContainerStyle: ((arg: number) => {
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
lineHeight: string;
|
|
8
|
-
}) & import("@fibery/helpers/src/_").MemoizedFunction<number, {
|
|
9
|
-
width: number;
|
|
10
|
-
height: number;
|
|
11
|
-
lineHeight: string;
|
|
12
|
-
}>;
|
|
13
4
|
type AvatarImageProps = {
|
|
14
5
|
size: number;
|
|
15
6
|
containerSize?: number;
|
|
@@ -35,4 +26,4 @@ declare function AvatarGroupCount({ className, size, ...props }: {
|
|
|
35
26
|
size: number;
|
|
36
27
|
} & React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
37
28
|
//#endregion
|
|
38
|
-
export { Avatar, AvatarGroup, AvatarGroupCount, AvatarImage, FibermojiPlaceholder as AvatarPlaceholder, NullUserAvatar
|
|
29
|
+
export { Avatar, AvatarGroup, AvatarGroupCount, AvatarImage, FibermojiPlaceholder as AvatarPlaceholder, NullUserAvatar };
|
package/lib/avatar.js
CHANGED
|
@@ -3,18 +3,11 @@ import { themeVars } from "./theming.generated.js";
|
|
|
3
3
|
import { FibermojiPlaceholder } from "./fibermoji-placeholder.js";
|
|
4
4
|
import { getShiftStyle } from "./icons/get-shift-style.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
import {
|
|
6
|
+
import { memoizeLeak } from "@fibery/helpers/src/_";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
import { memo, useCallback,
|
|
8
|
+
import { memo, useCallback, useState } from "react";
|
|
9
9
|
import { cx } from "@linaria/core";
|
|
10
10
|
//#region src/avatar.tsx
|
|
11
|
-
var getContainerStyle = memoize((containerSize) => {
|
|
12
|
-
return {
|
|
13
|
-
width: containerSize,
|
|
14
|
-
height: containerSize,
|
|
15
|
-
lineHeight: `${containerSize}px`
|
|
16
|
-
};
|
|
17
|
-
});
|
|
18
11
|
var statusIconPositionByIndex = [
|
|
19
12
|
{
|
|
20
13
|
bottom: 0,
|
|
@@ -33,7 +26,7 @@ var statusIconPositionByIndex = [
|
|
|
33
26
|
left: 0
|
|
34
27
|
}
|
|
35
28
|
];
|
|
36
|
-
var getStatusIconStyle =
|
|
29
|
+
var getStatusIconStyle = memoizeLeak((size, index) => {
|
|
37
30
|
const iconSize = Math.ceil(size / 2);
|
|
38
31
|
const position = statusIconPositionByIndex[index];
|
|
39
32
|
return {
|
|
@@ -55,32 +48,48 @@ var EMOJI_BY_BADGE = {
|
|
|
55
48
|
vacation: "🌴",
|
|
56
49
|
dayon: "💻"
|
|
57
50
|
};
|
|
51
|
+
var imageSizes = [
|
|
52
|
+
32,
|
|
53
|
+
64,
|
|
54
|
+
128,
|
|
55
|
+
256,
|
|
56
|
+
512
|
|
57
|
+
];
|
|
58
|
+
/**
|
|
59
|
+
* Avatars are requested at a bucketed size rather than the exact rendered one: the same face shows up
|
|
60
|
+
* across surfaces at slightly different sizes (16px in a selector, 18px in a grid cell, 20px in a
|
|
61
|
+
* mention), and baking each of them into the url means a separate image per surface — every one of
|
|
62
|
+
* them fetched from scratch, with the placeholder blinking until it arrives.
|
|
63
|
+
*/
|
|
64
|
+
function getImageSize(size) {
|
|
65
|
+
return imageSizes.find((imageSize) => imageSize >= size) ?? size;
|
|
66
|
+
}
|
|
58
67
|
function getAvatarUrl(url, size) {
|
|
59
68
|
if (!url) return url;
|
|
69
|
+
const imageSize = getImageSize(size);
|
|
60
70
|
const urlObject = new URL(url, window.origin);
|
|
61
|
-
urlObject.searchParams.set("width", `${
|
|
62
|
-
urlObject.searchParams.set("height", `${
|
|
71
|
+
urlObject.searchParams.set("width", `${imageSize}`);
|
|
72
|
+
urlObject.searchParams.set("height", `${imageSize}`);
|
|
63
73
|
return urlObject.toString();
|
|
64
74
|
}
|
|
65
75
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
76
|
+
* Avatar urls that have already been loaded in this session. A remount of one of them renders the image
|
|
77
|
+
* right away instead of showing the placeholder first — the browser has it cached, so waiting for `load`
|
|
78
|
+
* to hide the placeholder is what makes the avatar blink.
|
|
68
79
|
*/
|
|
69
|
-
var
|
|
70
|
-
const image = new Image();
|
|
71
|
-
image.src = src;
|
|
72
|
-
return image.complete && image.naturalWidth !== 0;
|
|
73
|
-
};
|
|
80
|
+
var loadedUrls = /* @__PURE__ */ new Set();
|
|
74
81
|
var AvatarImage = memo(function AvatarImage({ size, containerSize, title, badges, avatarUrl, radius, hasAccess = true, disableNativeTitle = false, placeholder }) {
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
|
|
82
|
+
const src = avatarUrl ? getAvatarUrl(avatarUrl, size) : "";
|
|
83
|
+
const [loadedSrc, setLoadedSrc] = useState(null);
|
|
84
|
+
const [failedSrc, setFailedSrc] = useState(null);
|
|
85
|
+
const isLoaded = Boolean(src) && (loadedSrc === src || loadedUrls.has(src));
|
|
86
|
+
const hasFailed = Boolean(src) && failedSrc === src;
|
|
87
|
+
const onError = useCallback((event) => {
|
|
88
|
+
setFailedSrc(event.currentTarget.src);
|
|
81
89
|
}, []);
|
|
82
|
-
const onLoad = useCallback(() => {
|
|
83
|
-
|
|
90
|
+
const onLoad = useCallback((event) => {
|
|
91
|
+
loadedUrls.add(event.currentTarget.src);
|
|
92
|
+
setLoadedSrc(event.currentTarget.src);
|
|
84
93
|
}, []);
|
|
85
94
|
return /* @__PURE__ */ jsx("div", {
|
|
86
95
|
style: {
|
|
@@ -99,7 +108,13 @@ var AvatarImage = memo(function AvatarImage({ size, containerSize, title, badges
|
|
|
99
108
|
})
|
|
100
109
|
},
|
|
101
110
|
children: [
|
|
102
|
-
|
|
111
|
+
!isLoaded && (placeholder || /* @__PURE__ */ jsx(FibermojiPlaceholder, {
|
|
112
|
+
size,
|
|
113
|
+
title,
|
|
114
|
+
radius,
|
|
115
|
+
hasAccess
|
|
116
|
+
})),
|
|
117
|
+
src && !hasFailed && /* @__PURE__ */ jsx("img", {
|
|
103
118
|
draggable: false,
|
|
104
119
|
className: imageStyle,
|
|
105
120
|
style: {
|
|
@@ -107,18 +122,12 @@ var AvatarImage = memo(function AvatarImage({ size, containerSize, title, badges
|
|
|
107
122
|
height: size,
|
|
108
123
|
borderRadius: radius ?? "50%"
|
|
109
124
|
},
|
|
110
|
-
src
|
|
111
|
-
alt:
|
|
125
|
+
src,
|
|
126
|
+
alt: isLoaded ? title : "",
|
|
112
127
|
title: disableNativeTitle ? void 0 : title,
|
|
113
128
|
onLoad,
|
|
114
129
|
onError
|
|
115
130
|
}),
|
|
116
|
-
(!avatarUrl || fetchState !== ":fetch-state/success") && (placeholder || /* @__PURE__ */ jsx(FibermojiPlaceholder, {
|
|
117
|
-
size,
|
|
118
|
-
title,
|
|
119
|
-
radius,
|
|
120
|
-
hasAccess
|
|
121
|
-
})),
|
|
122
131
|
badges && badges.map((badge, index) => {
|
|
123
132
|
return /* @__PURE__ */ jsx("div", {
|
|
124
133
|
style: getStatusIconStyle(size, index),
|
|
@@ -184,12 +193,13 @@ function Avatar({ className, ...props }) {
|
|
|
184
193
|
}
|
|
185
194
|
var avatarGroupCountCss = "a12d2alp-avatarGroupCount";
|
|
186
195
|
function AvatarGroupCount({ className, size, ...props }) {
|
|
196
|
+
const style = { "--fibery-avatar-group-count-size": size + "px" };
|
|
187
197
|
return /* @__PURE__ */ jsx("div", {
|
|
188
198
|
"data-slot": "avatar-group-count",
|
|
189
|
-
style
|
|
199
|
+
style,
|
|
190
200
|
className: cx(avatarGroupCountCss, className),
|
|
191
201
|
...props
|
|
192
202
|
});
|
|
193
203
|
}
|
|
194
204
|
//#endregion
|
|
195
|
-
export { Avatar, AvatarGroup, AvatarGroupCount, AvatarImage, FibermojiPlaceholder as AvatarPlaceholder, NullUserAvatar
|
|
205
|
+
export { Avatar, AvatarGroup, AvatarGroupCount, AvatarImage, FibermojiPlaceholder as AvatarPlaceholder, NullUserAvatar };
|
package/lib/avatar.wyw-in-js.css
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
.i18iq8q0-image{position:absolute;left:0;object-fit:cover;}
|
|
1
|
+
.i18iq8q0-image{position:absolute;top:0;left:0;object-fit:cover;}
|
|
2
2
|
.a1gg8ffu-avatarGroup{display:flex;}
|
|
3
3
|
.a1gj4doj-avatar{margin-left:-4px;z-index:1;}.a1gj4doj-avatar:first-of-type{margin-left:0;}
|
|
4
4
|
.a12d2alp-avatarGroupCount{display:flex;align-items:center;justify-content:center;width:var(--fibery-avatar-group-count-size);height:var(--fibery-avatar-group-count-size);color:var(--accentTextColor);font-size:calc(var(--fibery-avatar-group-count-size) * 0.5);background-color:var(--badgeBgColor);border-radius:50%;}
|
|
@@ -4,11 +4,12 @@ import { jsx } from "react/jsx-runtime";
|
|
|
4
4
|
import { forwardRef } from "react";
|
|
5
5
|
//#region src/banner/banner-action.tsx
|
|
6
6
|
var BannerAction = forwardRef(function BannerAction({ children, className, ...props }, ref) {
|
|
7
|
+
const variant = useBannerContext();
|
|
7
8
|
return /* @__PURE__ */ jsx(Button, {
|
|
8
9
|
ref,
|
|
9
10
|
size: "small",
|
|
10
11
|
variant: "outline",
|
|
11
|
-
color:
|
|
12
|
+
color: variant === "primary" ? "accent" : "neutral",
|
|
12
13
|
className,
|
|
13
14
|
...props,
|
|
14
15
|
children
|
package/lib/button/button.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./button.wyw-in-js.css";
|
|
2
2
|
import { useIsPhone } from "../use-is-phone.js";
|
|
3
3
|
import { useIsSupportHardwareKeyboard } from "../use-is-support-hardware-keyboard.js";
|
|
4
|
-
import Spinner from "../
|
|
4
|
+
import { Spinner } from "../spinner.js";
|
|
5
5
|
import { BaseButton } from "./base-button.js";
|
|
6
6
|
/* empty css */
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./icon-button.wyw-in-js.css";
|
|
2
2
|
import { useIsPhone } from "../use-is-phone.js";
|
|
3
|
-
import Spinner from "../
|
|
3
|
+
import { Spinner } from "../spinner.js";
|
|
4
4
|
import { BaseButton } from "./base-button.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
package/lib/canvas-colors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { colorFromUnsafe, oklchFrom, rgbFrom, serializeHexVariadic } from "./color-utils.js";
|
|
2
|
+
import { memoizeColor } from "./memoize.js";
|
|
2
3
|
import { invertHueRotate } from "./color-filter.js";
|
|
3
|
-
import { memoize } from "@fibery/helpers/src/_";
|
|
4
4
|
//#region src/canvas-colors.ts
|
|
5
5
|
/** Light-mode canvas palette; dark-mode variants are computed via {@link darkFromLight}. */
|
|
6
6
|
var backgrounds = [
|
|
@@ -75,6 +75,6 @@ var darkFromLight = (light, _role) => {
|
|
|
75
75
|
alpha: lch.alpha
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
|
-
darkFromLight =
|
|
78
|
+
darkFromLight = memoizeColor(darkFromLight, (fg, _role) => fg.toUpperCase());
|
|
79
79
|
//#endregion
|
|
80
80
|
export { backgrounds, darkFromLight, sections, stickers };
|
package/lib/card-container.d.ts
CHANGED
|
@@ -41,15 +41,11 @@ type CompactCardContainerProps = {
|
|
|
41
41
|
declare const CompactCardContainer: ({ title, floating, backgroundColors }: CompactCardContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
42
42
|
declare const titleUnitsContainerClassName: import("@linaria/core").LinariaClassName;
|
|
43
43
|
type UnitGroupProps = {
|
|
44
|
-
renderedUnits:
|
|
45
|
-
reactElement: JSX.Element;
|
|
46
|
-
}[];
|
|
44
|
+
renderedUnits: JSX.Element[];
|
|
47
45
|
};
|
|
48
46
|
declare const UnitGroup: ({ renderedUnits }: UnitGroupProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
49
47
|
type TitleUnitGroupProps = {
|
|
50
|
-
renderedUnits:
|
|
51
|
-
reactElement: JSX.Element;
|
|
52
|
-
}[];
|
|
48
|
+
renderedUnits: JSX.Element[];
|
|
53
49
|
className?: string;
|
|
54
50
|
};
|
|
55
51
|
declare const TitleUnitGroup: ({ renderedUnits, className }: TitleUnitGroupProps) => import("react/jsx-runtime").JSX.Element | null;
|
package/lib/card-container.js
CHANGED
|
@@ -158,13 +158,13 @@ var CompactCardContainer = ({ title, floating, backgroundColors }) => {
|
|
|
158
158
|
};
|
|
159
159
|
var titleUnitsContainerClassName = "t5lzfm0-titleUnitsContainer";
|
|
160
160
|
var UnitGroup = ({ renderedUnits }) => {
|
|
161
|
-
return renderedUnits ? /* @__PURE__ */ jsx(Fragment, { children: renderedUnits
|
|
161
|
+
return renderedUnits ? /* @__PURE__ */ jsx(Fragment, { children: renderedUnits }) : null;
|
|
162
162
|
};
|
|
163
163
|
var TitleUnitGroup = ({ renderedUnits, className }) => {
|
|
164
|
-
return renderedUnits ? /* @__PURE__ */ jsx(Fragment, { children: renderedUnits.map((
|
|
164
|
+
return renderedUnits ? /* @__PURE__ */ jsx(Fragment, { children: renderedUnits.map((element) => /* @__PURE__ */ jsx("div", {
|
|
165
165
|
className: cx(titleUnitsContainerClassName, className),
|
|
166
|
-
children:
|
|
167
|
-
},
|
|
166
|
+
children: element
|
|
167
|
+
}, element.key)) }) : null;
|
|
168
168
|
};
|
|
169
169
|
//#endregion
|
|
170
170
|
export { CardContainer, CompactCardContainer, TitleUnitGroup, UnitGroup, afterFeedSize, afterListSize, beforeClassName, coverHeightBySize, titleTimelineClassName, titleUnitsContainerClassName };
|
package/lib/color-filter.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { colorFromUnsafe, cssFromColor, oklchFrom, rgbFrom } from "./color-utils.js";
|
|
2
|
+
import { memoizeColor } from "./memoize.js";
|
|
2
3
|
import { makeAdjust } from "./color-adjuster.js";
|
|
3
4
|
import { makeDoubleApplyDetector } from "./double-apply.js";
|
|
4
5
|
import { shiftHueTowards } from "./palette-generator.js";
|
|
5
|
-
import { memoize } from "@fibery/helpers/src/_";
|
|
6
6
|
import { clampRgb, filterDeficiencyDeuter, filterDeficiencyProt, filterDeficiencyTrit, filterHueRotate, filterInvert } from "culori";
|
|
7
7
|
//#region src/color-filter.ts
|
|
8
8
|
var cvdChannels = [
|
|
@@ -33,7 +33,7 @@ function makeColorFilter(spec) {
|
|
|
33
33
|
if (!spec) return (x) => x;
|
|
34
34
|
const adjust = spec.adjust && makeAdjust(spec.adjust);
|
|
35
35
|
const detect = makeDoubleApplyDetector();
|
|
36
|
-
return
|
|
36
|
+
return memoizeColor(function filterColor(color) {
|
|
37
37
|
if (!color) return color;
|
|
38
38
|
color = spec.swatches?.[color.toUpperCase()] ?? color;
|
|
39
39
|
const parsed = oklchFrom(color);
|
package/lib/color-inspect.js
CHANGED
|
@@ -9,7 +9,7 @@ function alignColorComponents(formatted) {
|
|
|
9
9
|
pad: (s) => s.padStart(COMPONENT_PAD, " ")
|
|
10
10
|
}, {
|
|
11
11
|
prefix: "oklch(",
|
|
12
|
-
pad: (s, i, total) => i === total - 1 ? s.padStart(
|
|
12
|
+
pad: (s, i, total) => i === total - 1 ? s.padStart(3, " ").padEnd(COMPONENT_PAD, " ") : s.padEnd(COMPONENT_PAD, " ")
|
|
13
13
|
}].find((m) => formatted.startsWith(m.prefix));
|
|
14
14
|
if (!mode || !formatted.endsWith(")")) return formatted;
|
|
15
15
|
const inner = formatted.slice(mode.prefix.length, -1);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ColorPicker } from "./index.js";
|
|
2
2
|
//#region src/color-picker/color-picker-or-loader.d.ts
|
|
3
|
-
declare const LazyColorPicker: import("react").LazyExoticComponent<
|
|
3
|
+
declare const LazyColorPicker: import("react").LazyExoticComponent<typeof ColorPicker>;
|
|
4
4
|
declare const ColorPickerOrLoader: (props: React.ComponentProps<typeof LazyColorPicker>) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { ColorPickerOrLoader };
|
package/lib/color-utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveColorArg } from "./design-system/vars.js";
|
|
2
|
-
import { isFlagPresent } from "
|
|
2
|
+
import { isFlagPresent } from "@fibery/helpers/src/flags";
|
|
3
3
|
import { blend, differenceCie76, formatCss, formatRgb, hsl as hslFrom, interpolate, oklch as oklchFrom, parse, rgb as rgbFrom, serializeHex, serializeHex8, toGamut, wcagLuminance } from "culori";
|
|
4
4
|
//#region src/color-utils.ts
|
|
5
5
|
var useOklchDefs = isFlagPresent("oklch-defs");
|