klun-ui 0.1.10 → 0.1.12
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/README.md +2 -2
- package/dist/{chunk-Y5BGEO2J.js → chunk-3XJ5FN4P.js} +80 -12
- package/dist/chunk-3XJ5FN4P.js.map +1 -0
- package/dist/{chunk-VFEV4TOL.cjs → chunk-7FELOLAD.cjs} +80 -11
- package/dist/chunk-7FELOLAD.cjs.map +1 -0
- package/dist/index.cjs +151 -147
- package/dist/index.d.cts +39 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.js +1 -1
- package/dist/styles.css +104 -4
- package/dist/templates/index.cjs +1047 -82
- package/dist/templates/index.cjs.map +1 -1
- package/dist/templates/index.d.cts +3 -1
- package/dist/templates/index.d.ts +3 -1
- package/dist/templates/index.js +966 -2
- package/dist/templates/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-VFEV4TOL.cjs.map +0 -1
- package/dist/chunk-Y5BGEO2J.js.map +0 -1
package/README.md
CHANGED
|
@@ -75,7 +75,7 @@ You can also override tokens directly:
|
|
|
75
75
|
| **Feedback** | Alert, Banner, InlineTip, Toast, NotificationItem, ProgressBar, GaugeBar, CircularProgress, SegmentedProgress, Spinner, Skeleton, EmptyState |
|
|
76
76
|
| **Navigation** | Tabs, SegmentedControl, Breadcrumb, Pagination, StepIndicator, Divider, ContentDivider, HorizontalFilter, PageHeader |
|
|
77
77
|
| **Overlays** | Modal, Drawer, Dropdown, Popover, CommandMenu |
|
|
78
|
-
| **Disclosure** | Accordion |
|
|
78
|
+
| **Disclosure** | Accordion, Collapse |
|
|
79
79
|
| **Layout** | Card, ContentCard, FeatureCard |
|
|
80
80
|
|
|
81
81
|
All components and their prop types are named exports; a `cx` classnames helper is exported too.
|
|
@@ -86,7 +86,7 @@ Full-screen example compositions are available from the `klun-ui/templates` subp
|
|
|
86
86
|
|
|
87
87
|
```tsx
|
|
88
88
|
import "klun-ui/styles.css";
|
|
89
|
-
import { DashboardTemplate, AIAssistantTemplate, CryptoTemplate, MarketingTemplate } from "klun-ui/templates";
|
|
89
|
+
import { DashboardTemplate, AIAssistantTemplate, AgentChatTemplate, CryptoTemplate, MarketingTemplate } from "klun-ui/templates";
|
|
90
90
|
|
|
91
91
|
export default function App() {
|
|
92
92
|
return <DashboardTemplate />;
|
|
@@ -188,7 +188,7 @@ var enUS = {
|
|
|
188
188
|
},
|
|
189
189
|
timePicker: { am: "AM", pm: "PM" },
|
|
190
190
|
pagination: { previous: "Previous", next: "Next" },
|
|
191
|
-
modal: { close: "Close" },
|
|
191
|
+
modal: { close: "Close", maximize: "Maximize", restore: "Restore" },
|
|
192
192
|
drawer: { close: "Close" },
|
|
193
193
|
alert: { dismiss: "Dismiss" },
|
|
194
194
|
banner: { dismiss: "Dismiss" },
|
|
@@ -282,7 +282,7 @@ var zhCN = {
|
|
|
282
282
|
},
|
|
283
283
|
timePicker: { am: "\u4E0A\u5348", pm: "\u4E0B\u5348" },
|
|
284
284
|
pagination: { previous: "\u4E0A\u4E00\u9875", next: "\u4E0B\u4E00\u9875" },
|
|
285
|
-
modal: { close: "\u5173\u95ED" },
|
|
285
|
+
modal: { close: "\u5173\u95ED", maximize: "\u6700\u5927\u5316", restore: "\u8FD8\u539F" },
|
|
286
286
|
drawer: { close: "\u5173\u95ED" },
|
|
287
287
|
alert: { dismiss: "\u5173\u95ED" },
|
|
288
288
|
banner: { dismiss: "\u5173\u95ED" },
|
|
@@ -5016,6 +5016,56 @@ var Accordion = forwardRef(function Accordion2({ items: items2 = [], defaultOpen
|
|
|
5016
5016
|
}) });
|
|
5017
5017
|
});
|
|
5018
5018
|
Accordion.displayName = "Accordion";
|
|
5019
|
+
var Collapse = forwardRef(function Collapse2({
|
|
5020
|
+
title,
|
|
5021
|
+
icon,
|
|
5022
|
+
extra,
|
|
5023
|
+
defaultOpen = false,
|
|
5024
|
+
open,
|
|
5025
|
+
onOpenChange,
|
|
5026
|
+
hideChevron = false,
|
|
5027
|
+
contentStyle,
|
|
5028
|
+
contentClassName,
|
|
5029
|
+
className,
|
|
5030
|
+
children,
|
|
5031
|
+
...props
|
|
5032
|
+
}, ref) {
|
|
5033
|
+
const isControlled = open !== void 0;
|
|
5034
|
+
const [internal, setInternal] = useState(defaultOpen);
|
|
5035
|
+
const isOpen = isControlled ? open : internal;
|
|
5036
|
+
const toggle = () => {
|
|
5037
|
+
const next = !isOpen;
|
|
5038
|
+
if (!isControlled) setInternal(next);
|
|
5039
|
+
onOpenChange?.(next);
|
|
5040
|
+
};
|
|
5041
|
+
const onKeyDown = (e) => {
|
|
5042
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
5043
|
+
e.preventDefault();
|
|
5044
|
+
toggle();
|
|
5045
|
+
}
|
|
5046
|
+
};
|
|
5047
|
+
return /* @__PURE__ */ jsxs("div", { ref, className: cx("klun-collapse", className), "data-state": isOpen ? "open" : "closed", ...props, children: [
|
|
5048
|
+
/* @__PURE__ */ jsxs(
|
|
5049
|
+
"div",
|
|
5050
|
+
{
|
|
5051
|
+
className: "klun-collapse__trigger",
|
|
5052
|
+
role: "button",
|
|
5053
|
+
tabIndex: 0,
|
|
5054
|
+
"aria-expanded": isOpen,
|
|
5055
|
+
onClick: toggle,
|
|
5056
|
+
onKeyDown,
|
|
5057
|
+
children: [
|
|
5058
|
+
icon != null ? /* @__PURE__ */ jsx("span", { className: "klun-collapse__icon", children: icon }) : null,
|
|
5059
|
+
/* @__PURE__ */ jsx("span", { className: "klun-collapse__title", children: title }),
|
|
5060
|
+
extra != null ? /* @__PURE__ */ jsx("span", { className: "klun-collapse__extra", onClick: (e) => e.stopPropagation(), children: extra }) : null,
|
|
5061
|
+
!hideChevron ? /* @__PURE__ */ jsx("span", { className: "klun-collapse__chevron", "aria-hidden": true, children: /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M6 8l4 4 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) }) : null
|
|
5062
|
+
]
|
|
5063
|
+
}
|
|
5064
|
+
),
|
|
5065
|
+
/* @__PURE__ */ jsx("div", { className: "klun-collapse__panel", children: /* @__PURE__ */ jsx("div", { className: cx("klun-collapse__content", contentClassName), style: contentStyle, children }) })
|
|
5066
|
+
] });
|
|
5067
|
+
});
|
|
5068
|
+
Collapse.displayName = "Collapse";
|
|
5019
5069
|
var Alert = forwardRef(function Alert2({ status = "information", variant = "lighter", icon, title, action, onClose, className, children, ...props }, ref) {
|
|
5020
5070
|
const { alert } = useLocale();
|
|
5021
5071
|
return /* @__PURE__ */ jsxs(
|
|
@@ -10330,6 +10380,8 @@ var Modal = forwardRef(function Modal2({
|
|
|
10330
10380
|
keyboard = true,
|
|
10331
10381
|
mask = true,
|
|
10332
10382
|
draggable = false,
|
|
10383
|
+
maximizable = false,
|
|
10384
|
+
defaultMaximized = false,
|
|
10333
10385
|
zIndex,
|
|
10334
10386
|
afterClose,
|
|
10335
10387
|
afterOpenChange,
|
|
@@ -10342,6 +10394,7 @@ var Modal = forwardRef(function Modal2({
|
|
|
10342
10394
|
const cancel = onCancel ?? onClose;
|
|
10343
10395
|
const backdropClosable = maskClosable ?? closeOnBackdrop ?? true;
|
|
10344
10396
|
const [pos, setPos] = useState({ x: 0, y: 0 });
|
|
10397
|
+
const [maximized, setMaximized] = useState(defaultMaximized);
|
|
10345
10398
|
const drag = useRef(null);
|
|
10346
10399
|
const prevOpen = useRef(open);
|
|
10347
10400
|
useEffect(() => {
|
|
@@ -10358,7 +10411,10 @@ var Modal = forwardRef(function Modal2({
|
|
|
10358
10411
|
};
|
|
10359
10412
|
}, [open, keyboard, closable, cancel]);
|
|
10360
10413
|
useEffect(() => {
|
|
10361
|
-
if (open)
|
|
10414
|
+
if (open) {
|
|
10415
|
+
setPos({ x: 0, y: 0 });
|
|
10416
|
+
setMaximized(defaultMaximized);
|
|
10417
|
+
}
|
|
10362
10418
|
if (prevOpen.current !== open) {
|
|
10363
10419
|
afterOpenChange?.(open);
|
|
10364
10420
|
if (!open) afterClose?.();
|
|
@@ -10367,8 +10423,8 @@ var Modal = forwardRef(function Modal2({
|
|
|
10367
10423
|
}, [open]);
|
|
10368
10424
|
if (!open) return null;
|
|
10369
10425
|
const startDrag = (e) => {
|
|
10370
|
-
if (!draggable) return;
|
|
10371
|
-
if (e.target.closest(".klun-
|
|
10426
|
+
if (!draggable || maximized) return;
|
|
10427
|
+
if (e.target.closest(".klun-modal__actions")) return;
|
|
10372
10428
|
drag.current = { sx: e.clientX, sy: e.clientY, ox: pos.x, oy: pos.y };
|
|
10373
10429
|
const move = (ev) => {
|
|
10374
10430
|
if (!drag.current) return;
|
|
@@ -10390,7 +10446,7 @@ var Modal = forwardRef(function Modal2({
|
|
|
10390
10446
|
/* @__PURE__ */ jsx(Button, { variant: okType === "danger" ? "error" : "primary", loading: confirmLoading, onClick: onOk, ...okButtonProps, children: okText ?? "OK" })
|
|
10391
10447
|
] });
|
|
10392
10448
|
const resolvedFooter = footer === null ? null : footer !== void 0 ? footer : defaultFooter;
|
|
10393
|
-
const dialogStyle = {
|
|
10449
|
+
const dialogStyle = maximized ? { ...style } : {
|
|
10394
10450
|
width,
|
|
10395
10451
|
...pos.x || pos.y ? { transform: `translate(${pos.x}px, ${pos.y}px)` } : null,
|
|
10396
10452
|
...style
|
|
@@ -10408,14 +10464,14 @@ var Modal = forwardRef(function Modal2({
|
|
|
10408
10464
|
role: "dialog",
|
|
10409
10465
|
"aria-modal": "true",
|
|
10410
10466
|
onClick: (e) => e.stopPropagation(),
|
|
10411
|
-
className: cx("klun-modal__dialog", className),
|
|
10467
|
+
className: cx("klun-modal__dialog", maximized && "klun-modal__dialog--maximized", className),
|
|
10412
10468
|
style: dialogStyle,
|
|
10413
10469
|
...props,
|
|
10414
10470
|
children: [
|
|
10415
10471
|
title || icon ? /* @__PURE__ */ jsxs(
|
|
10416
10472
|
"div",
|
|
10417
10473
|
{
|
|
10418
|
-
className: cx("klun-modal__header", draggable && "klun-modal__header--draggable"),
|
|
10474
|
+
className: cx("klun-modal__header", draggable && !maximized && "klun-modal__header--draggable"),
|
|
10419
10475
|
onMouseDown: startDrag,
|
|
10420
10476
|
children: [
|
|
10421
10477
|
icon ? /* @__PURE__ */ jsx("div", { className: "klun-modal__icon", children: icon }) : null,
|
|
@@ -10423,7 +10479,19 @@ var Modal = forwardRef(function Modal2({
|
|
|
10423
10479
|
title ? /* @__PURE__ */ jsx("div", { className: "klun-modal__title", children: title }) : null,
|
|
10424
10480
|
description ? /* @__PURE__ */ jsx("div", { className: "klun-modal__description", children: description }) : null
|
|
10425
10481
|
] }),
|
|
10426
|
-
closable ? /* @__PURE__ */
|
|
10482
|
+
maximizable || closable ? /* @__PURE__ */ jsxs("div", { className: "klun-modal__actions", children: [
|
|
10483
|
+
maximizable ? /* @__PURE__ */ jsx(
|
|
10484
|
+
"button",
|
|
10485
|
+
{
|
|
10486
|
+
type: "button",
|
|
10487
|
+
onClick: () => setMaximized((m) => !m),
|
|
10488
|
+
"aria-label": maximized ? modal.restore ?? "Restore" : modal.maximize ?? "Maximize",
|
|
10489
|
+
className: "klun-modal__action",
|
|
10490
|
+
children: maximized ? /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M8 4v4H4M12 16v-4h4M12 4v4h4M8 16v-4H4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) : /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M4 8V4h4M16 12v4h-4M16 8V4h-4M4 12v4h4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
10491
|
+
}
|
|
10492
|
+
) : null,
|
|
10493
|
+
closable ? /* @__PURE__ */ jsx("button", { type: "button", onClick: cancel, "aria-label": modal.close, className: "klun-modal__action klun-modal__close", children: /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M5 5l10 10M15 5L5 15", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) }) }) : null
|
|
10494
|
+
] }) : null
|
|
10427
10495
|
]
|
|
10428
10496
|
}
|
|
10429
10497
|
) : null,
|
|
@@ -10610,6 +10678,6 @@ var Popconfirm = forwardRef(function Popconfirm2({
|
|
|
10610
10678
|
});
|
|
10611
10679
|
Popconfirm.displayName = "Popconfirm";
|
|
10612
10680
|
|
|
10613
|
-
export { Accordion, Alert, AutoComplete, Avatar, AvatarGroup, Badge, Banner, Breadcrumb, BulkAction, BulkActionBar, Button, ButtonGroup, Card, Carousel, Cascader, CharacterCounter, ChartLegend, ChartTooltip, Checkbox, CheckboxCard, Chip, CircularProgress, CodeViewer, Col, ColorDot, ColorPicker, ColorSlider, CommandMenu, CompactSelect, CompactSelectForInput, ConfigProvider, Confirm, ContentLabel, ContextMenu2 as ContextMenu, CopyButton, CounterInput, DatePicker, DateRangePicker, DateTimePicker, Descriptions, DigitInput, Divider, Drawer, Dropdown, ExpiryCountdown, FileUpload, Flex, Form, FormItem, FormList, Format, GaugeBar, Grid, Hint, HorizontalFilter, ImageUpload, ImageViewer, InlineInput, InlineSelect, Input, Kbd, KeyIcon, Label, Layout, LayoutContent, LayoutFooter, LayoutHeader, LayoutSider, List, ListItem, LiveDot, LogViewer, Masonry, Menu, Message, Modal, Money, Notification, Pagination, PasswordStrength, Popconfirm, Popover, ProgressBar, Radio, RadioCard, RangeSlider, Rating, RelativeTime, RichEditorToolbar, Row, SegmentedControl, SegmentedProgress, Select, SelectMenu, Skeleton, Slider, Space, Spinner2 as Spinner, Splitter2 as Splitter, SplitterPanel, Statistic, StatusBadge, StatusDot, StepIndicator, Switch, Table, Tabs, Tag, Textarea, TimePicker, Timeline, Toast, Toaster, Tooltip, Tree, Wizard, arSA, deDE, enUS, esES, fmt, frFR, idID, itIT, jaJP, koKR, locales, nlNL, plPL, primaryColorVars, ptBR, ruRU, toast, trTR, useBreakpoint, useConfig, useContextMenu, useForm, useLocale, useMappedSize, useMessage, useNotification, useSize, viVN, zhCN, zhTW };
|
|
10614
|
-
//# sourceMappingURL=chunk-
|
|
10615
|
-
//# sourceMappingURL=chunk-
|
|
10681
|
+
export { Accordion, Alert, AutoComplete, Avatar, AvatarGroup, Badge, Banner, Breadcrumb, BulkAction, BulkActionBar, Button, ButtonGroup, Card, Carousel, Cascader, CharacterCounter, ChartLegend, ChartTooltip, Checkbox, CheckboxCard, Chip, CircularProgress, CodeViewer, Col, Collapse, ColorDot, ColorPicker, ColorSlider, CommandMenu, CompactSelect, CompactSelectForInput, ConfigProvider, Confirm, ContentLabel, ContextMenu2 as ContextMenu, CopyButton, CounterInput, DatePicker, DateRangePicker, DateTimePicker, Descriptions, DigitInput, Divider, Drawer, Dropdown, ExpiryCountdown, FileUpload, Flex, Form, FormItem, FormList, Format, GaugeBar, Grid, Hint, HorizontalFilter, ImageUpload, ImageViewer, InlineInput, InlineSelect, Input, Kbd, KeyIcon, Label, Layout, LayoutContent, LayoutFooter, LayoutHeader, LayoutSider, List, ListItem, LiveDot, LogViewer, Masonry, Menu, Message, Modal, Money, Notification, Pagination, PasswordStrength, Popconfirm, Popover, ProgressBar, Radio, RadioCard, RangeSlider, Rating, RelativeTime, RichEditorToolbar, Row, SegmentedControl, SegmentedProgress, Select, SelectMenu, Skeleton, Slider, Space, Spinner2 as Spinner, Splitter2 as Splitter, SplitterPanel, Statistic, StatusBadge, StatusDot, StepIndicator, Switch, Table, Tabs, Tag, Textarea, TimePicker, Timeline, Toast, Toaster, Tooltip, Tree, Wizard, arSA, deDE, enUS, esES, fmt, frFR, idID, itIT, jaJP, koKR, locales, nlNL, plPL, primaryColorVars, ptBR, ruRU, toast, trTR, useBreakpoint, useConfig, useContextMenu, useForm, useLocale, useMappedSize, useMessage, useNotification, useSize, viVN, zhCN, zhTW };
|
|
10682
|
+
//# sourceMappingURL=chunk-3XJ5FN4P.js.map
|
|
10683
|
+
//# sourceMappingURL=chunk-3XJ5FN4P.js.map
|