klun-ui 0.1.11 → 0.1.13

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/CHANGELOG.md CHANGED
@@ -5,6 +5,22 @@ All notable changes to **klun-ui** are documented here. The format follows
5
5
  [Semantic Versioning](https://semver.org/) (pre-1.0: minor/patch bumps may carry
6
6
  small breaking changes).
7
7
 
8
+ ## [0.1.13] — 2026-06-23
9
+
10
+ ### Added
11
+ - **`CheckboxGroup` — a set of checkboxes bound to a `string[]` value.**
12
+ antd-aligned API: `options` (a bare string is shorthand for
13
+ `{ label, value }`, or pass `{ label, value, disabled }`), controlled
14
+ `value`/`onChange` or uncontrolled `defaultValue`, `direction`
15
+ (`"horizontal"` | `"vertical"`), `size`, and a group-level `disabled`.
16
+ - **`Checkbox` now renders an optional label.** Pass `children` to show text
17
+ next to the box (backward compatible — box-only usage is unchanged).
18
+
19
+ ### Changed
20
+ - **`Drawer` default size is now `50%`** of the viewport along the slide axis
21
+ (was a fixed `378px`) for both `width` and `height`. Pass an explicit
22
+ `width`/`height` (number or string) to override.
23
+
8
24
  ## [0.1.10] — 2026-06-21
9
25
 
10
26
  ### Added
@@ -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" },
@@ -6014,7 +6014,7 @@ var CharacterCounter = forwardRef(
6014
6014
  }
6015
6015
  );
6016
6016
  CharacterCounter.displayName = "CharacterCounter";
6017
- var Checkbox = forwardRef(function Checkbox2({ indeterminate = false, disabled = false, error = false, size: sizeProp, onChange, className, style, ...props }, ref) {
6017
+ var Checkbox = forwardRef(function Checkbox2({ indeterminate = false, disabled = false, error = false, size: sizeProp, onChange, className, style, children, ...props }, ref) {
6018
6018
  const size = useSize(sizeProp);
6019
6019
  const innerRef = useRef(null);
6020
6020
  const setRef = (node) => {
@@ -6033,6 +6033,7 @@ var Checkbox = forwardRef(function Checkbox2({ indeterminate = false, disabled =
6033
6033
  `klun-checkbox--${size}`,
6034
6034
  disabled && "klun-checkbox--disabled",
6035
6035
  error && "klun-checkbox--error",
6036
+ children != null && children !== false && "klun-checkbox--with-label",
6036
6037
  className
6037
6038
  ),
6038
6039
  style,
@@ -6052,12 +6053,52 @@ var Checkbox = forwardRef(function Checkbox2({ indeterminate = false, disabled =
6052
6053
  /* @__PURE__ */ jsxs("span", { className: "klun-checkbox__box", "aria-hidden": true, children: [
6053
6054
  /* @__PURE__ */ jsx("svg", { className: "klun-checkbox__check", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M3.5 8.5l3 3 6-6.5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }),
6054
6055
  /* @__PURE__ */ jsx("svg", { className: "klun-checkbox__dash", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M3.5 8h9", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) })
6055
- ] })
6056
+ ] }),
6057
+ children != null && children !== false && /* @__PURE__ */ jsx("span", { className: "klun-checkbox__label", children })
6056
6058
  ]
6057
6059
  }
6058
6060
  );
6059
6061
  });
6060
6062
  Checkbox.displayName = "Checkbox";
6063
+ var CheckboxGroup = forwardRef(function CheckboxGroup2({ options, value, defaultValue, onChange, disabled = false, size, name, direction = "horizontal", className, style, children }, ref) {
6064
+ const [internal, setInternal] = useState(defaultValue ?? []);
6065
+ const controlled = value != null;
6066
+ const current = controlled ? value : internal;
6067
+ const toggle = (val, checked) => {
6068
+ const next = checked ? [...current, val] : current.filter((v) => v !== val);
6069
+ if (!controlled) setInternal(next);
6070
+ onChange?.(next);
6071
+ };
6072
+ const norm2 = (options ?? []).map(
6073
+ (o) => typeof o === "string" ? { label: o, value: o } : o
6074
+ );
6075
+ return /* @__PURE__ */ jsxs(
6076
+ "div",
6077
+ {
6078
+ ref,
6079
+ role: "group",
6080
+ className: cx("klun-checkbox-group", `klun-checkbox-group--${direction}`, className),
6081
+ style,
6082
+ children: [
6083
+ norm2.map((o) => /* @__PURE__ */ jsx(
6084
+ Checkbox,
6085
+ {
6086
+ name,
6087
+ size,
6088
+ value: o.value,
6089
+ checked: current.includes(o.value),
6090
+ disabled: disabled || o.disabled,
6091
+ onChange: (checked) => toggle(o.value, checked),
6092
+ children: o.label
6093
+ },
6094
+ o.value
6095
+ )),
6096
+ children
6097
+ ]
6098
+ }
6099
+ );
6100
+ });
6101
+ CheckboxGroup.displayName = "CheckboxGroup";
6061
6102
  var CheckboxCard = forwardRef(
6062
6103
  function CheckboxCard2({
6063
6104
  title,
@@ -10089,8 +10130,8 @@ var Drawer = forwardRef(function Drawer2({
10089
10130
  title,
10090
10131
  placement,
10091
10132
  side,
10092
- width = 378,
10093
- height = 378,
10133
+ width = "50%",
10134
+ height = "50%",
10094
10135
  size = "default",
10095
10136
  closable = true,
10096
10137
  maskClosable = true,
@@ -10380,6 +10421,8 @@ var Modal = forwardRef(function Modal2({
10380
10421
  keyboard = true,
10381
10422
  mask = true,
10382
10423
  draggable = false,
10424
+ maximizable = false,
10425
+ defaultMaximized = false,
10383
10426
  zIndex,
10384
10427
  afterClose,
10385
10428
  afterOpenChange,
@@ -10392,6 +10435,7 @@ var Modal = forwardRef(function Modal2({
10392
10435
  const cancel = onCancel ?? onClose;
10393
10436
  const backdropClosable = maskClosable ?? closeOnBackdrop ?? true;
10394
10437
  const [pos, setPos] = useState({ x: 0, y: 0 });
10438
+ const [maximized, setMaximized] = useState(defaultMaximized);
10395
10439
  const drag = useRef(null);
10396
10440
  const prevOpen = useRef(open);
10397
10441
  useEffect(() => {
@@ -10408,7 +10452,10 @@ var Modal = forwardRef(function Modal2({
10408
10452
  };
10409
10453
  }, [open, keyboard, closable, cancel]);
10410
10454
  useEffect(() => {
10411
- if (open) setPos({ x: 0, y: 0 });
10455
+ if (open) {
10456
+ setPos({ x: 0, y: 0 });
10457
+ setMaximized(defaultMaximized);
10458
+ }
10412
10459
  if (prevOpen.current !== open) {
10413
10460
  afterOpenChange?.(open);
10414
10461
  if (!open) afterClose?.();
@@ -10417,8 +10464,8 @@ var Modal = forwardRef(function Modal2({
10417
10464
  }, [open]);
10418
10465
  if (!open) return null;
10419
10466
  const startDrag = (e) => {
10420
- if (!draggable) return;
10421
- if (e.target.closest(".klun-modal__close")) return;
10467
+ if (!draggable || maximized) return;
10468
+ if (e.target.closest(".klun-modal__actions")) return;
10422
10469
  drag.current = { sx: e.clientX, sy: e.clientY, ox: pos.x, oy: pos.y };
10423
10470
  const move = (ev) => {
10424
10471
  if (!drag.current) return;
@@ -10440,7 +10487,7 @@ var Modal = forwardRef(function Modal2({
10440
10487
  /* @__PURE__ */ jsx(Button, { variant: okType === "danger" ? "error" : "primary", loading: confirmLoading, onClick: onOk, ...okButtonProps, children: okText ?? "OK" })
10441
10488
  ] });
10442
10489
  const resolvedFooter = footer === null ? null : footer !== void 0 ? footer : defaultFooter;
10443
- const dialogStyle = {
10490
+ const dialogStyle = maximized ? { ...style } : {
10444
10491
  width,
10445
10492
  ...pos.x || pos.y ? { transform: `translate(${pos.x}px, ${pos.y}px)` } : null,
10446
10493
  ...style
@@ -10458,14 +10505,14 @@ var Modal = forwardRef(function Modal2({
10458
10505
  role: "dialog",
10459
10506
  "aria-modal": "true",
10460
10507
  onClick: (e) => e.stopPropagation(),
10461
- className: cx("klun-modal__dialog", className),
10508
+ className: cx("klun-modal__dialog", maximized && "klun-modal__dialog--maximized", className),
10462
10509
  style: dialogStyle,
10463
10510
  ...props,
10464
10511
  children: [
10465
10512
  title || icon ? /* @__PURE__ */ jsxs(
10466
10513
  "div",
10467
10514
  {
10468
- className: cx("klun-modal__header", draggable && "klun-modal__header--draggable"),
10515
+ className: cx("klun-modal__header", draggable && !maximized && "klun-modal__header--draggable"),
10469
10516
  onMouseDown: startDrag,
10470
10517
  children: [
10471
10518
  icon ? /* @__PURE__ */ jsx("div", { className: "klun-modal__icon", children: icon }) : null,
@@ -10473,7 +10520,19 @@ var Modal = forwardRef(function Modal2({
10473
10520
  title ? /* @__PURE__ */ jsx("div", { className: "klun-modal__title", children: title }) : null,
10474
10521
  description ? /* @__PURE__ */ jsx("div", { className: "klun-modal__description", children: description }) : null
10475
10522
  ] }),
10476
- closable ? /* @__PURE__ */ jsx("button", { type: "button", onClick: cancel, "aria-label": modal.close, className: "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
10523
+ maximizable || closable ? /* @__PURE__ */ jsxs("div", { className: "klun-modal__actions", children: [
10524
+ maximizable ? /* @__PURE__ */ jsx(
10525
+ "button",
10526
+ {
10527
+ type: "button",
10528
+ onClick: () => setMaximized((m) => !m),
10529
+ "aria-label": maximized ? modal.restore ?? "Restore" : modal.maximize ?? "Maximize",
10530
+ className: "klun-modal__action",
10531
+ 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" }) })
10532
+ }
10533
+ ) : null,
10534
+ 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
10535
+ ] }) : null
10477
10536
  ]
10478
10537
  }
10479
10538
  ) : null,
@@ -10660,6 +10719,6 @@ var Popconfirm = forwardRef(function Popconfirm2({
10660
10719
  });
10661
10720
  Popconfirm.displayName = "Popconfirm";
10662
10721
 
10663
- 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 };
10664
- //# sourceMappingURL=chunk-N4NBEKYR.js.map
10665
- //# sourceMappingURL=chunk-N4NBEKYR.js.map
10722
+ export { Accordion, Alert, AutoComplete, Avatar, AvatarGroup, Badge, Banner, Breadcrumb, BulkAction, BulkActionBar, Button, ButtonGroup, Card, Carousel, Cascader, CharacterCounter, ChartLegend, ChartTooltip, Checkbox, CheckboxCard, CheckboxGroup, 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 };
10723
+ //# sourceMappingURL=chunk-O2CR4NDQ.js.map
10724
+ //# sourceMappingURL=chunk-O2CR4NDQ.js.map