@ceebee/ui 1.5.0 → 1.5.2
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/dist/client.css +13 -0
- package/dist/client.d.ts +21 -2
- package/dist/client.js +107 -9
- package/dist/styles.css +25 -0
- package/package.json +1 -1
package/dist/client.css
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* src/overlay/modal.css */
|
|
2
|
+
.cb-modal {
|
|
3
|
+
z-index: var(--cb-z-modal) !important;
|
|
4
|
+
}
|
|
5
|
+
.cb-modal__backdrop {
|
|
6
|
+
z-index: var(--cb-z-modal-backdrop) !important;
|
|
7
|
+
}
|
|
8
|
+
.cb-modal__description {
|
|
9
|
+
margin-block-end: var(--cb-space-4);
|
|
10
|
+
color: var(--cb-fg-muted);
|
|
11
|
+
font-size: var(--cb-text-sm);
|
|
12
|
+
line-height: var(--cb-leading-normal);
|
|
13
|
+
}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { ThemeConfig } from 'antd';
|
|
1
|
+
import { ModalProps as ModalProps$1, ThemeConfig } from 'antd';
|
|
2
2
|
export * from 'antd';
|
|
3
|
+
import * as antd_es_modal_PurePanel_js from 'antd/es/modal/PurePanel.js';
|
|
4
|
+
import * as antd_es_modal_useModal_index_js from 'antd/es/modal/useModal/index.js';
|
|
5
|
+
import * as antd_es_modal_confirm_js from 'antd/es/modal/confirm.js';
|
|
3
6
|
import * as react from 'react';
|
|
4
7
|
import { ReactNode } from 'react';
|
|
5
8
|
import { createCache } from '@ant-design/cssinjs';
|
|
@@ -9,6 +12,22 @@ export { default as idIDLocale } from 'antd/locale/id_ID.js';
|
|
|
9
12
|
export { default as zhCNLocale } from 'antd/locale/zh_CN.js';
|
|
10
13
|
import * as _base_ui_react from '@base-ui/react';
|
|
11
14
|
|
|
15
|
+
interface ModalProps extends ModalProps$1 {
|
|
16
|
+
/** Separate explanatory copy announced after the dialog title. */
|
|
17
|
+
description?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
declare function ModalRoot({ description, children, classNames, open, afterOpenChange, focusTriggerAfterClose, focusable, panelRef, ...props }: ModalProps): react.JSX.Element;
|
|
20
|
+
/**
|
|
21
|
+
* Ant Design's interaction contract with CeeBee-owned description, semantic
|
|
22
|
+
* layer hooks, and focus restoration for conditionally mounted consumers.
|
|
23
|
+
*/
|
|
24
|
+
declare const Modal: typeof ModalRoot & react.FC<ModalProps$1> & antd_es_modal_confirm_js.ModalStaticFunctions & {
|
|
25
|
+
useModal: typeof antd_es_modal_useModal_index_js.default;
|
|
26
|
+
destroyAll: () => void;
|
|
27
|
+
config: typeof antd_es_modal_confirm_js.modalGlobalConfig;
|
|
28
|
+
_InternalPanelDoNotUseOrYouWillBeFired: (props: antd_es_modal_PurePanel_js.PurePanelProps) => React.JSX.Element;
|
|
29
|
+
};
|
|
30
|
+
|
|
12
31
|
type CeebeeSkin = 'ceebee' | 'astra' | 'clarity' | 'moodboard';
|
|
13
32
|
type ThemeMode = 'light' | 'dark';
|
|
14
33
|
type ThemeContrast = 'normal' | 'more';
|
|
@@ -355,4 +374,4 @@ declare const PanZoomCanvas: typeof PanZoomCanvasRoot & {
|
|
|
355
374
|
Skeleton: typeof PanZoomCanvasSkeleton;
|
|
356
375
|
};
|
|
357
376
|
|
|
358
|
-
export { type CeebeeAntStyleCache, CeebeeAntStyleProvider, type CeebeeAntStyleProviderProps, Checklist, type ChecklistProps, type ChecklistTask, type Command, CommandPalette, type CommandPaletteProps, DEFAULT_LABELS, type DurationToken, type Labels, LabelsProvider, type LabelsProviderProps, type MotionHelpers, MotionProvider, type MotionProviderProps, type MotionSettings, type NavItem, type NavSection, type PaletteCommand, PanZoomCanvas, type PanZoomCanvasProps, type PanZoomCanvasSkeletonProps, type RankedCommand, Reveal, type RevealProps, Sidebar, type SidebarProps, type SpringPreset, Stagger, type StaggerProps, StickerGroup, type StickerGroupProps, type StickerGroupSkeletonProps, type StickerItem, ThemeBridge, type ThemeBridgeProps, type ThemeChoice, ThemeProvider, type ThemeProviderProps, type ToastOptions, type ToastPosition, ToastProvider, type ToastProviderProps, TopBar, type TopBarProps, createCeebeeAntStyleCache, extractCeebeeAntStyles, filterCommands, groupCommands, rankCommand, useLabels, useMotionSettings, useTheme, useToast };
|
|
377
|
+
export { type CeebeeAntStyleCache, CeebeeAntStyleProvider, type CeebeeAntStyleProviderProps, Checklist, type ChecklistProps, type ChecklistTask, type Command, CommandPalette, type CommandPaletteProps, DEFAULT_LABELS, type DurationToken, type Labels, LabelsProvider, type LabelsProviderProps, Modal, type ModalProps, type MotionHelpers, MotionProvider, type MotionProviderProps, type MotionSettings, type NavItem, type NavSection, type PaletteCommand, PanZoomCanvas, type PanZoomCanvasProps, type PanZoomCanvasSkeletonProps, type RankedCommand, Reveal, type RevealProps, Sidebar, type SidebarProps, type SpringPreset, Stagger, type StaggerProps, StickerGroup, type StickerGroupProps, type StickerGroupSkeletonProps, type StickerItem, ThemeBridge, type ThemeBridgeProps, type ThemeChoice, ThemeProvider, type ThemeProviderProps, type ToastOptions, type ToastPosition, ToastProvider, type ToastProviderProps, TopBar, type TopBarProps, createCeebeeAntStyleCache, extractCeebeeAntStyles, filterCommands, groupCommands, rankCommand, useLabels, useMotionSettings, useTheme, useToast };
|
package/dist/client.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Button, theme, ConfigProvider, Progress } from 'antd';
|
|
2
|
+
import { Modal as Modal$1, Button, theme, ConfigProvider, Progress } from 'antd';
|
|
3
3
|
export * from 'antd';
|
|
4
|
-
import { createContext,
|
|
5
|
-
import {
|
|
4
|
+
import { createContext, useId, useRef, useCallback, useInsertionEffect, useLayoutEffect, useState, useContext, useMemo, useEffect, Children } from 'react';
|
|
5
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
6
6
|
import { StyleProvider, createCache, extractStyle } from '@ant-design/cssinjs';
|
|
7
7
|
export { default as enUSLocale } from 'antd/locale/en_US.js';
|
|
8
8
|
export { default as enUSDatePickerLocale } from 'antd/lib/date-picker/locale/en_US.js';
|
|
@@ -14,6 +14,109 @@ import { Toast } from '@base-ui/react/toast';
|
|
|
14
14
|
import { Popover } from '@base-ui/react/popover';
|
|
15
15
|
import { AnimatePresence, motion } from 'motion/react';
|
|
16
16
|
|
|
17
|
+
// src/lib/cn.ts
|
|
18
|
+
function cn(...parts) {
|
|
19
|
+
return parts.filter(Boolean).join(" ");
|
|
20
|
+
}
|
|
21
|
+
function ModalRoot({
|
|
22
|
+
description,
|
|
23
|
+
children,
|
|
24
|
+
classNames,
|
|
25
|
+
open,
|
|
26
|
+
afterOpenChange,
|
|
27
|
+
focusTriggerAfterClose,
|
|
28
|
+
focusable,
|
|
29
|
+
panelRef,
|
|
30
|
+
...props
|
|
31
|
+
}) {
|
|
32
|
+
const descriptionId = useId();
|
|
33
|
+
const returnFocus = useRef(null);
|
|
34
|
+
const restoreTask = useRef(void 0);
|
|
35
|
+
const panel = useRef(null);
|
|
36
|
+
const wasOpen = useRef(false);
|
|
37
|
+
const openRef = useRef(!!open);
|
|
38
|
+
openRef.current = !!open;
|
|
39
|
+
const shouldRestoreFocus = focusable?.focusTriggerAfterClose ?? focusTriggerAfterClose ?? true;
|
|
40
|
+
const restoreFocus = useCallback(() => {
|
|
41
|
+
const target = returnFocus.current;
|
|
42
|
+
if (!shouldRestoreFocus || !target?.isConnected) {
|
|
43
|
+
returnFocus.current = null;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (restoreTask.current) return;
|
|
47
|
+
restoreTask.current = setTimeout(() => {
|
|
48
|
+
restoreTask.current = void 0;
|
|
49
|
+
if (openRef.current && panel.current?.isConnected) return;
|
|
50
|
+
if (target.isConnected) target.focus({ preventScroll: true });
|
|
51
|
+
if (returnFocus.current === target) returnFocus.current = null;
|
|
52
|
+
});
|
|
53
|
+
}, [shouldRestoreFocus]);
|
|
54
|
+
useInsertionEffect(() => {
|
|
55
|
+
if (open && restoreTask.current) {
|
|
56
|
+
clearTimeout(restoreTask.current);
|
|
57
|
+
restoreTask.current = void 0;
|
|
58
|
+
}
|
|
59
|
+
if (open && !wasOpen.current && document.activeElement instanceof HTMLElement) {
|
|
60
|
+
returnFocus.current = document.activeElement;
|
|
61
|
+
}
|
|
62
|
+
}, [open]);
|
|
63
|
+
useLayoutEffect(() => {
|
|
64
|
+
if (!open && wasOpen.current) {
|
|
65
|
+
restoreFocus();
|
|
66
|
+
}
|
|
67
|
+
wasOpen.current = !!open;
|
|
68
|
+
}, [open, restoreFocus]);
|
|
69
|
+
useLayoutEffect(() => () => {
|
|
70
|
+
if (wasOpen.current) restoreFocus();
|
|
71
|
+
}, [restoreFocus]);
|
|
72
|
+
const modalClassNames = typeof classNames === "function" ? (info) => {
|
|
73
|
+
const resolved = classNames(info) ?? {};
|
|
74
|
+
return {
|
|
75
|
+
...resolved,
|
|
76
|
+
wrapper: cn("cb-modal", resolved.wrapper),
|
|
77
|
+
mask: cn("cb-modal__backdrop", resolved.mask)
|
|
78
|
+
};
|
|
79
|
+
} : {
|
|
80
|
+
...classNames,
|
|
81
|
+
wrapper: cn("cb-modal", classNames?.wrapper),
|
|
82
|
+
mask: cn("cb-modal__backdrop", classNames?.mask)
|
|
83
|
+
};
|
|
84
|
+
const describedBy = [
|
|
85
|
+
props["aria-describedby"],
|
|
86
|
+
description ? descriptionId : null
|
|
87
|
+
].filter(Boolean).join(" ") || void 0;
|
|
88
|
+
const setPanelRef = useCallback((node) => {
|
|
89
|
+
panel.current = node;
|
|
90
|
+
if (node && describedBy) node.setAttribute("aria-describedby", describedBy);
|
|
91
|
+
else node?.removeAttribute("aria-describedby");
|
|
92
|
+
if (typeof panelRef === "function") panelRef(node);
|
|
93
|
+
else if (panelRef) panelRef.current = node;
|
|
94
|
+
}, [describedBy, panelRef]);
|
|
95
|
+
useLayoutEffect(() => {
|
|
96
|
+
if (panel.current && describedBy) panel.current.setAttribute("aria-describedby", describedBy);
|
|
97
|
+
else panel.current?.removeAttribute("aria-describedby");
|
|
98
|
+
}, [describedBy]);
|
|
99
|
+
return /* @__PURE__ */ jsxs(
|
|
100
|
+
Modal$1,
|
|
101
|
+
{
|
|
102
|
+
...props,
|
|
103
|
+
open,
|
|
104
|
+
classNames: modalClassNames,
|
|
105
|
+
focusable: { ...focusable, focusTriggerAfterClose: false },
|
|
106
|
+
panelRef: setPanelRef,
|
|
107
|
+
afterOpenChange: (nextOpen) => {
|
|
108
|
+
afterOpenChange?.(nextOpen);
|
|
109
|
+
if (!nextOpen) restoreFocus();
|
|
110
|
+
},
|
|
111
|
+
children: [
|
|
112
|
+
description ? /* @__PURE__ */ jsx("div", { id: descriptionId, className: "cb-modal__description", children: description }) : null,
|
|
113
|
+
children
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
var Modal = Object.assign(ModalRoot, Modal$1);
|
|
119
|
+
|
|
17
120
|
// src/theme/ant-theme-seeds.generated.ts
|
|
18
121
|
var generatedCeebeeAntSeeds = {
|
|
19
122
|
"ceebee": {
|
|
@@ -958,11 +1061,6 @@ function useTheme() {
|
|
|
958
1061
|
return value;
|
|
959
1062
|
}
|
|
960
1063
|
|
|
961
|
-
// src/lib/cn.ts
|
|
962
|
-
function cn(...parts) {
|
|
963
|
-
return parts.filter(Boolean).join(" ");
|
|
964
|
-
}
|
|
965
|
-
|
|
966
1064
|
// src/overlay/command.util.ts
|
|
967
1065
|
function rankCommand(command, query) {
|
|
968
1066
|
const needle = query.trim().toLowerCase();
|
|
@@ -1526,4 +1624,4 @@ function PanZoomCanvasRoot({
|
|
|
1526
1624
|
}
|
|
1527
1625
|
var PanZoomCanvas = Object.assign(PanZoomCanvasRoot, { Skeleton: PanZoomCanvasSkeleton });
|
|
1528
1626
|
|
|
1529
|
-
export { CeebeeAntStyleProvider, Checklist, CommandPalette, DEFAULT_LABELS, LabelsProvider, MotionProvider, PanZoomCanvas, Reveal, Sidebar, Stagger, StickerGroup, ThemeBridge, ThemeProvider, ToastProvider, TopBar, createCeebeeAntStyleCache, extractCeebeeAntStyles, filterCommands, groupCommands, rankCommand, useLabels, useMotionSettings, useTheme, useToast };
|
|
1627
|
+
export { CeebeeAntStyleProvider, Checklist, CommandPalette, DEFAULT_LABELS, LabelsProvider, Modal, MotionProvider, PanZoomCanvas, Reveal, Sidebar, Stagger, StickerGroup, ThemeBridge, ThemeProvider, ToastProvider, TopBar, createCeebeeAntStyleCache, extractCeebeeAntStyles, filterCommands, groupCommands, rankCommand, useLabels, useMotionSettings, useTheme, useToast };
|
package/dist/styles.css
CHANGED
|
@@ -813,6 +813,22 @@ html, body { background: var(--cb-bg); color: var(--cb-fg); }
|
|
|
813
813
|
.cb-palette__shortcut { margin: 0; padding: 0; border: none; background: none; font-family: var(--cb-font-mono); font-size: var(--cb-text-xs); color: var(--cb-fg-subtle); }
|
|
814
814
|
.cb-palette__empty { margin: 0; padding: var(--cb-space-5); text-align: center; font-size: var(--cb-text-sm); color: var(--cb-fg-subtle); }
|
|
815
815
|
|
|
816
|
+
/* overlay/modal.css */
|
|
817
|
+
.cb-modal {
|
|
818
|
+
z-index: var(--cb-z-modal) !important;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
.cb-modal__backdrop {
|
|
822
|
+
z-index: var(--cb-z-modal-backdrop) !important;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
.cb-modal__description {
|
|
826
|
+
margin-block-end: var(--cb-space-4);
|
|
827
|
+
color: var(--cb-fg-muted);
|
|
828
|
+
font-size: var(--cb-text-sm);
|
|
829
|
+
line-height: var(--cb-leading-normal);
|
|
830
|
+
}
|
|
831
|
+
|
|
816
832
|
/* data/donut.css */
|
|
817
833
|
.cb-donut { position: relative; display: inline-grid; place-items: center; }
|
|
818
834
|
.cb-donut svg { position: absolute; inset: 0; }
|
|
@@ -2099,6 +2115,15 @@ html, body { background: var(--cb-bg); color: var(--cb-fg); }
|
|
|
2099
2115
|
display: flex;
|
|
2100
2116
|
}
|
|
2101
2117
|
|
|
2118
|
+
/* The native radio remains in the server markup. Without Ant's runtime rule it paints as a normal
|
|
2119
|
+
form control beside every option, even though the visible label already owns the interaction. */
|
|
2120
|
+
:where(.ant-segmented-item-input) {
|
|
2121
|
+
position: absolute;
|
|
2122
|
+
inset: var(--cb-space-0);
|
|
2123
|
+
opacity: 0;
|
|
2124
|
+
pointer-events: none;
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2102
2127
|
:where(.ant-segmented-item) {
|
|
2103
2128
|
color: var(--cb-fg-muted);
|
|
2104
2129
|
}
|