@kjun-ui/react 0.19.0 → 0.20.0

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/index.js CHANGED
@@ -7801,16 +7801,16 @@ function useNumberMotion(value, animated, fromPrevious, reduced) {
7801
7801
  // packages/react/src/number-display.tsx
7802
7802
  import { Fragment as Fragment19, jsx as jsx34, jsxs as jsxs27 } from "react/jsx-runtime";
7803
7803
  var finiteNumber = (value) => value == null || typeof value === "boolean" || typeof value === "string" && !value.trim() || !["number", "string"].includes(typeof value) || !Number.isFinite(Number(value)) ? null : Number(value) || 0;
7804
- var format = (value, decimals = 0) => new Intl.NumberFormat(void 0, {
7805
- minimumFractionDigits: Math.max(0, Math.min(20, decimals)),
7806
- maximumFractionDigits: Math.max(0, Math.min(20, decimals))
7804
+ var format = (value, decimals2 = 0) => new Intl.NumberFormat(void 0, {
7805
+ minimumFractionDigits: Math.max(0, Math.min(20, decimals2)),
7806
+ maximumFractionDigits: Math.max(0, Math.min(20, decimals2))
7807
7807
  }).format(value);
7808
7808
  function useCountUp(value, animated, fromPrevious) {
7809
7809
  return useNumberMotion(value, animated, fromPrevious, useReducedMotion());
7810
7810
  }
7811
7811
  function KjunAnimatedNumber({
7812
7812
  value,
7813
- decimals = 0,
7813
+ decimals: decimals2 = 0,
7814
7814
  prefix = "",
7815
7815
  suffix = "",
7816
7816
  animated = true,
@@ -7821,7 +7821,7 @@ function KjunAnimatedNumber({
7821
7821
  const n = useCountUp(value, animated, fromPrevious);
7822
7822
  return /* @__PURE__ */ jsxs27("span", { className: "kjun-animated-number " + className, children: [
7823
7823
  prefix && /* @__PURE__ */ jsx34("span", { className: "kjun-number-affix", "data-side": "prefix", children: prefix }),
7824
- /* @__PURE__ */ jsx34("span", { children: typeof n === "string" ? n : formatter ? formatter(n) : format(n, decimals) }),
7824
+ /* @__PURE__ */ jsx34("span", { children: typeof n === "string" ? n : formatter ? formatter(n) : format(n, decimals2) }),
7825
7825
  suffix && /* @__PURE__ */ jsx34("span", { className: "kjun-number-affix", "data-side": "suffix", children: suffix })
7826
7826
  ] });
7827
7827
  }
@@ -7864,7 +7864,7 @@ function KjunSignedValue({
7864
7864
  value,
7865
7865
  format: kind = "number",
7866
7866
  isRaw = false,
7867
- decimals = 2,
7867
+ decimals: decimals2 = 2,
7868
7868
  prefix = "",
7869
7869
  suffix = "",
7870
7870
  showSign = true,
@@ -7874,7 +7874,7 @@ function KjunSignedValue({
7874
7874
  formatter
7875
7875
  }) {
7876
7876
  const n = finiteNumber(value), role2 = loading || n === null ? "text-secondary" : stale ? "text-tertiary" : n > 0 ? "price-up" : n < 0 ? "price-down" : "price-neutral";
7877
- const display = n === null ? "\u2014" : formatter ? formatter(n) : prefix + (showSign && n > 0 ? "+" : "") + format(kind === "percent" && !isRaw ? n * 100 : n, decimals) + (kind === "percent" ? "%" : "") + suffix;
7877
+ const display = n === null ? "\u2014" : formatter ? formatter(n) : prefix + (showSign && n > 0 ? "+" : "") + format(kind === "percent" && !isRaw ? n * 100 : n, decimals2) + (kind === "percent" ? "%" : "") + suffix;
7878
7878
  return /* @__PURE__ */ jsx34(
7879
7879
  "span",
7880
7880
  {
@@ -7898,14 +7898,14 @@ function KjunDeviation({
7898
7898
  value,
7899
7899
  variant = "pill",
7900
7900
  signalThreshold = 1,
7901
- decimals = 2,
7901
+ decimals: decimals2 = 2,
7902
7902
  formatter
7903
7903
  }) {
7904
7904
  const m = useKjunMessages();
7905
7905
  const n = finiteNumber(value);
7906
7906
  if (n === null)
7907
7907
  return /* @__PURE__ */ jsx35("span", { style: { color: "var(--_kjun-color-text-disabled)" }, children: "-" });
7908
- const abs = Math.abs(n), signal = abs >= signalThreshold, level = deviationLevel(n), neutral = level === "neutral", role2 = neutral ? "text-secondary" : n > 0 ? "price-up" : "price-down", label = formatter ? formatter(n) : (n > 0 ? "+" : "") + format(n, decimals) + "%";
7908
+ const abs = Math.abs(n), signal = abs >= signalThreshold, level = deviationLevel(n), neutral = level === "neutral", role2 = neutral ? "text-secondary" : n > 0 ? "price-up" : "price-down", label = formatter ? formatter(n) : (n > 0 ? "+" : "") + format(n, decimals2) + "%";
7909
7909
  if (variant === "badge")
7910
7910
  return /* @__PURE__ */ jsxs28("span", { className: "kjun-deviation-badge", children: [
7911
7911
  /* @__PURE__ */ jsx35(
@@ -8275,17 +8275,36 @@ function useTableModel2(props) {
8275
8275
  }
8276
8276
 
8277
8277
  // shared/package-runtime/table-groups.ts
8278
+ var tableGroupKey = (value) => value == null ? "null:" : typeof value + ":" + String(value);
8278
8279
  function groupTableRows(rows, groupBy) {
8279
8280
  if (!groupBy) return null;
8280
8281
  const groups = /* @__PURE__ */ new Map();
8281
8282
  for (const row of rows) {
8282
- const value = getValue(row, groupBy), key = value == null ? "null:" : typeof value + ":" + String(value);
8283
+ const value = getValue(row, groupBy), key = tableGroupKey(value);
8283
8284
  let group = groups.get(key);
8284
8285
  if (!group) groups.set(key, group = { key, value, rows: [] });
8285
8286
  group.rows.push(row);
8286
8287
  }
8287
8288
  return [...groups.values()];
8288
8289
  }
8290
+ function tableGroupExpansion(groups, expanded, internalCollapsed) {
8291
+ const keys = expanded === void 0 ? null : new Set(expanded.map(tableGroupKey));
8292
+ const collapsed = keys ? (groups != null ? groups : []).filter((group) => !keys.has(group.key)).map((group) => group.key) : internalCollapsed;
8293
+ return {
8294
+ collapsed,
8295
+ toggle(key) {
8296
+ const group = groups == null ? void 0 : groups.find((group2) => group2.key === key);
8297
+ if (!group) return null;
8298
+ const values = expanded != null ? expanded : groups.filter((group2) => !collapsed.includes(group2.key)).map((group2) => group2.value);
8299
+ const next = values.filter((value) => tableGroupKey(value) !== key);
8300
+ const opening = collapsed.includes(key);
8301
+ return {
8302
+ expanded: opening ? [...next, group.value] : next,
8303
+ collapsed: opening ? collapsed.filter((value) => value !== key) : [...collapsed, key]
8304
+ };
8305
+ }
8306
+ };
8307
+ }
8289
8308
  function summarizeColumn(rows, key, kind) {
8290
8309
  if (kind === "count") return rows.length;
8291
8310
  const values = rows.map((row) => getValue(row, key)).filter((value) => typeof value === "number" && Number.isFinite(value));
@@ -8407,6 +8426,25 @@ function tableGroupName(label, group) {
8407
8426
  return typeof label === "string" || typeof label === "number" ? String(label) : group.value == null || group.value === "" ? "-" : String(group.value);
8408
8427
  }
8409
8428
 
8429
+ // shared/package-runtime/use-table-group-expansion.ts
8430
+ import { useEffect as useEffect27, useState as useState32 } from "react";
8431
+ function useTableGroupExpansion(groups, groupBy, expanded, onChange) {
8432
+ const [internal, setInternal] = useState32({ field: groupBy, collapsed: [] });
8433
+ useEffect27(() => {
8434
+ setInternal({ field: groupBy, collapsed: [] });
8435
+ }, [groupBy]);
8436
+ const state = tableGroupExpansion(groups, expanded, internal.field === groupBy ? internal.collapsed : []);
8437
+ return {
8438
+ collapsed: state.collapsed,
8439
+ toggleGroup(key) {
8440
+ const next = state.toggle(key);
8441
+ if (!next) return;
8442
+ if (expanded === void 0) setInternal({ field: groupBy, collapsed: next.collapsed });
8443
+ onChange == null ? void 0 : onChange(next.expanded);
8444
+ }
8445
+ };
8446
+ }
8447
+
8410
8448
  // packages/react/src/table-toolbar.tsx
8411
8449
  import { tokens as tokens44 } from "@kjun-ui/tokens";
8412
8450
  import { Fragment as Fragment21, jsx as jsx36, jsxs as jsxs29 } from "react/jsx-runtime";
@@ -8463,7 +8501,7 @@ function TableToolbar({
8463
8501
 
8464
8502
  // packages/react/src/table-grid.tsx
8465
8503
  import { tokens as tokens46 } from "@kjun-ui/tokens";
8466
- import { Fragment as Fragment22, useEffect as useEffect27, useRef as useRef36, useState as useState32 } from "react";
8504
+ import { Fragment as Fragment22, useEffect as useEffect28, useRef as useRef36, useState as useState33 } from "react";
8467
8505
 
8468
8506
  // packages/react/src/table-check.tsx
8469
8507
  import { forwardRef as forwardRef4 } from "react";
@@ -8556,9 +8594,9 @@ function TableGrid({ initialLoading, skeletonRows, skeletonHidden, state, onRowC
8556
8594
  group.rows.length > 1 && summaryRow(group.rows, "subtotal", "subtotal")
8557
8595
  ] }, "group:" + group.key);
8558
8596
  });
8559
- const [stuck, setStuck] = useState32(false), table = useRef36(null);
8597
+ const [stuck, setStuck] = useState33(false), table = useRef36(null);
8560
8598
  const pageSticky = stickyHeader && maxHeight == null;
8561
- useEffect27(() => {
8599
+ useEffect28(() => {
8562
8600
  if (!pageSticky) return;
8563
8601
  const update = () => setStuck(stickyHeaderStuck(table.current, stickyOffset));
8564
8602
  update();
@@ -8676,8 +8714,9 @@ function TableTotals({ totals }) {
8676
8714
 
8677
8715
  // packages/react/src/table-cards.tsx
8678
8716
  import { Fragment as Fragment24, jsx as jsx40, jsxs as jsxs33 } from "react/jsx-runtime";
8679
- function TableGroupHeader({ label, count, totals }) {
8717
+ function TableGroupHeader({ label, count, totals, toggle }) {
8680
8718
  return /* @__PURE__ */ jsxs33("div", { className: "kjun-table-card-group", children: [
8719
+ toggle,
8681
8720
  /* @__PURE__ */ jsx40("span", { children: label }),
8682
8721
  /* @__PURE__ */ jsx40("span", { className: "kjun-table-card-group-count", children: count }),
8683
8722
  totals.length > 0 && /* @__PURE__ */ jsx40("span", { className: "kjun-table-card-group-total", children: totals.map((total) => /* @__PURE__ */ jsx40("span", { children: totals.length > 1 ? /* @__PURE__ */ jsxs33(Fragment24, { children: [
@@ -8687,14 +8726,33 @@ function TableGroupHeader({ label, count, totals }) {
8687
8726
  ] }) : total.value }, total.key)) })
8688
8727
  ] });
8689
8728
  }
8690
- function useTableGroups({ groupLabel, groupTotals, state }, className, itemsClass, item) {
8729
+ function useTableGroups({ groupLabel, groupTotals, state, collapsed, toggleGroup }, className, itemsClass, item) {
8691
8730
  const m = useKjunMessages();
8692
8731
  return (list) => list.map((group) => {
8693
- var _a;
8732
+ var _a, _b;
8694
8733
  const label = groupLabel == null ? void 0 : groupLabel(group);
8734
+ const open = !(collapsed == null ? void 0 : collapsed.includes(group.key));
8695
8735
  return /* @__PURE__ */ jsxs33("div", { role: "group", "aria-label": tableGroupName(label, group), className, children: [
8696
- /* @__PURE__ */ jsx40(TableGroupHeader, { label, count: m.groupCount(group.rows.length), totals: group.rows.length > 1 ? (_a = groupTotals == null ? void 0 : groupTotals(group.rows)) != null ? _a : [] : [] }),
8697
- /* @__PURE__ */ jsx40("div", { className: itemsClass, role: "list", children: group.rows.map((row) => item(row, state.rowIndex(row))) })
8736
+ /* @__PURE__ */ jsx40(
8737
+ TableGroupHeader,
8738
+ {
8739
+ label,
8740
+ count: m.groupCount(group.rows.length),
8741
+ totals: group.rows.length > 1 ? (_a = groupTotals == null ? void 0 : groupTotals(group.rows)) != null ? _a : [] : [],
8742
+ toggle: /* @__PURE__ */ jsx40(
8743
+ KjunButton,
8744
+ {
8745
+ variant: "ghost",
8746
+ size: "xs",
8747
+ prefixIcon: open ? "chevron-down" : "chevron-right",
8748
+ "aria-expanded": open,
8749
+ ariaLabel: m.toggleGroup(String((_b = group.value) != null ? _b : ""), open),
8750
+ onClick: () => toggleGroup == null ? void 0 : toggleGroup(group.key)
8751
+ }
8752
+ )
8753
+ }
8754
+ ),
8755
+ open && /* @__PURE__ */ jsx40("div", { className: itemsClass, role: "list", children: group.rows.map((row) => item(row, state.rowIndex(row))) })
8698
8756
  ] }, group.key);
8699
8757
  });
8700
8758
  }
@@ -8911,7 +8969,7 @@ function TableList(props) {
8911
8969
  }
8912
8970
 
8913
8971
  // packages/react/src/table-view.tsx
8914
- import { useEffect as useEffect28, useState as useState33 } from "react";
8972
+ import { useEffect as useEffect29, useState as useState34 } from "react";
8915
8973
  import { isComposingKey as isComposingKey4, tokens as tokens49 } from "@kjun-ui/tokens";
8916
8974
  import { jsx as jsx42, jsxs as jsxs35 } from "react/jsx-runtime";
8917
8975
  function KjunTable(props) {
@@ -8942,8 +9000,10 @@ function KjunTable(props) {
8942
9000
  onRowClick,
8943
9001
  onRetry
8944
9002
  } = props;
8945
- const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = useState33(false), [collapsed, setCollapsed] = useState33([]);
8946
- useEffect28(() => {
9003
+ const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = useState34(false);
9004
+ const groups = groupTableRows(state.rows, props.groupBy);
9005
+ const expansion = useTableGroupExpansion(groups, props.groupBy, props.expandedGroups, props.onExpandedGroupsChange);
9006
+ useEffect29(() => {
8947
9007
  const media = matchMedia(`(width < ${tokens49.table.mobileBreakpoint}px)`);
8948
9008
  const update = () => setMobile(media.matches);
8949
9009
  update();
@@ -8952,9 +9012,8 @@ function KjunTable(props) {
8952
9012
  }, []);
8953
9013
  const layout = tablePresentation(props, mobile);
8954
9014
  const grouping = {
8955
- groups: groupTableRows(state.rows, props.groupBy),
8956
- collapsed,
8957
- toggleGroup: (key) => setCollapsed((keys) => keys.includes(key) ? keys.filter((k) => k !== key) : [...keys, key]),
9015
+ groups,
9016
+ ...expansion,
8958
9017
  groupLabel: (group) => props.renderGroupLabel ? props.renderGroupLabel(group.value, group.rows) : group.value == null || group.value === "" ? "-" : String(group.value),
8959
9018
  summary: props.summary ? (col, rows) => tableSummaryValue(props, col, rows, locale) : null
8960
9019
  };
@@ -9039,7 +9098,7 @@ function KjunTable(props) {
9039
9098
  loadingText,
9040
9099
  loadingDelay: skeleton ? 0 : loadingDelay,
9041
9100
  children: [
9042
- card ? /* @__PURE__ */ jsx42(TableCards, { ...{ initialLoading: query2.initialLoading, skeletonRows, skeletonHidden: query2.initialLoading && !revealed, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, layout, ariaLabel, customClass, rowKeyDown }, groups: grouping.groups, groupLabel: grouping.groupLabel, groupTotals: (rows) => tableTotals(props, rows, locale), totals: tableTotals(props, state.rows, locale) }) : layout.list ? /* @__PURE__ */ jsx42(TableList, { ...{ initialLoading: query2.initialLoading, skeletonRows, skeletonHidden: query2.initialLoading && !revealed, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, layout, ariaLabel, customClass, rowKeyDown }, groups: grouping.groups, groupLabel: grouping.groupLabel, groupTotals: (rows) => tableTotals(props, rows, locale), totals: tableTotals(props, state.rows, locale) }) : /* @__PURE__ */ jsx42(TableGrid, { ...{ initialLoading: query2.initialLoading, skeletonRows, skeletonHidden: query2.initialLoading && !revealed, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, visible, maxHeight, stickyHeader, compact, striped, hoverable, ariaLabel, customClass, rowKeyDown, ...grouping }, stickyOffset: props.stickyOffset, sortable: props.sortable }),
9101
+ card ? /* @__PURE__ */ jsx42(TableCards, { ...{ initialLoading: query2.initialLoading, skeletonRows, skeletonHidden: query2.initialLoading && !revealed, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, layout, ariaLabel, customClass, rowKeyDown }, groups: grouping.groups, collapsed: grouping.collapsed, toggleGroup: grouping.toggleGroup, groupLabel: grouping.groupLabel, groupTotals: (rows) => tableTotals(props, rows, locale), totals: tableTotals(props, state.rows, locale) }) : layout.list ? /* @__PURE__ */ jsx42(TableList, { ...{ initialLoading: query2.initialLoading, skeletonRows, skeletonHidden: query2.initialLoading && !revealed, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, layout, ariaLabel, customClass, rowKeyDown }, groups: grouping.groups, collapsed: grouping.collapsed, toggleGroup: grouping.toggleGroup, groupLabel: grouping.groupLabel, groupTotals: (rows) => tableTotals(props, rows, locale), totals: tableTotals(props, state.rows, locale) }) : /* @__PURE__ */ jsx42(TableGrid, { ...{ initialLoading: query2.initialLoading, skeletonRows, skeletonHidden: query2.initialLoading && !revealed, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, visible, maxHeight, stickyHeader, compact, striped, hoverable, ariaLabel, customClass, rowKeyDown, ...grouping }, stickyOffset: props.stickyOffset, sortable: props.sortable }),
9043
9102
  pagination && /* @__PURE__ */ jsx42(
9044
9103
  KjunPagination,
9045
9104
  {
@@ -9079,7 +9138,7 @@ function KjunKpiHero(props) {
9079
9138
  value,
9080
9139
  prefix = "",
9081
9140
  suffix = "",
9082
- decimals = 0,
9141
+ decimals: decimals2 = 0,
9083
9142
  deltaAbsolute = null,
9084
9143
  deltaPercent = null,
9085
9144
  deltaDescription = "",
@@ -9099,8 +9158,8 @@ function KjunKpiHero(props) {
9099
9158
  v > 0 ? "+" : v < 0 ? "\u2212" : "",
9100
9159
  kind === "absolute" && prefix && /* @__PURE__ */ jsx43("span", { className: "kjun-number-affix", "data-side": "prefix", children: prefix }),
9101
9160
  new Intl.NumberFormat(void 0, {
9102
- minimumFractionDigits: kind === "absolute" ? decimals : 1,
9103
- maximumFractionDigits: kind === "absolute" ? decimals : 1
9161
+ minimumFractionDigits: kind === "absolute" ? decimals2 : 1,
9162
+ maximumFractionDigits: kind === "absolute" ? decimals2 : 1
9104
9163
  }).format(Math.abs(v)),
9105
9164
  kind === "percent" && /* @__PURE__ */ jsx43("span", { className: "kjun-number-affix", "data-side": "suffix", children: "%" })
9106
9165
  ] });
@@ -9121,7 +9180,7 @@ function KjunKpiHero(props) {
9121
9180
  KjunAnimatedNumber,
9122
9181
  {
9123
9182
  value,
9124
- decimals,
9183
+ decimals: decimals2,
9125
9184
  animated,
9126
9185
  formatter
9127
9186
  }
@@ -9324,7 +9383,7 @@ function KjunKpiRow({
9324
9383
  import { tokens as tokens51 } from "@kjun-ui/tokens";
9325
9384
 
9326
9385
  // shared/package-runtime/market-cards.ts
9327
- import { useEffect as useEffect29, useRef as useRef37, useState as useState34 } from "react";
9386
+ import { useEffect as useEffect30, useRef as useRef37, useState as useState35 } from "react";
9328
9387
  function useMarketCardsModel(props, persistence) {
9329
9388
  const {
9330
9389
  columns,
@@ -9340,7 +9399,7 @@ function useMarketCardsModel(props, persistence) {
9340
9399
  sortKey: c.sortable ? metricConfig[c.key].sortKey : null,
9341
9400
  isDefaultSort: c.defaultSort
9342
9401
  }));
9343
- const [key, setKey] = useState34(""), restoreSignature = JSON.stringify([storageNamespace, pills]);
9402
+ const [key, setKey] = useState35(""), restoreSignature = JSON.stringify([storageNamespace, pills]);
9344
9403
  const mounted = useRef37("");
9345
9404
  const save = (key2) => {
9346
9405
  var _a;
@@ -9349,7 +9408,7 @@ function useMarketCardsModel(props, persistence) {
9349
9408
  } catch (e) {
9350
9409
  }
9351
9410
  };
9352
- useEffect29(() => {
9411
+ useEffect30(() => {
9353
9412
  var _a, _b;
9354
9413
  if (mounted.current === restoreSignature) return;
9355
9414
  mounted.current = restoreSignature;
@@ -9674,7 +9733,7 @@ function watchTrailingOverflow(element, onChange) {
9674
9733
  }
9675
9734
 
9676
9735
  // packages/react/src/market-table.tsx
9677
- import { useEffect as useEffect30, useRef as useRef38, useState as useState35 } from "react";
9736
+ import { useEffect as useEffect31, useRef as useRef38, useState as useState36 } from "react";
9678
9737
  import { jsx as jsx48, jsxs as jsxs41 } from "react/jsx-runtime";
9679
9738
  function KjunMarketTable(props) {
9680
9739
  const m = useKjunMessages();
@@ -9696,8 +9755,8 @@ function KjunMarketTable(props) {
9696
9755
  formatMetric,
9697
9756
  renderCell
9698
9757
  } = props;
9699
- const scroller = useRef38(null), [fadeEnd, setFadeEnd] = useState35(false);
9700
- useEffect30(() => scroller.current ? watchTrailingOverflow(scroller.current, setFadeEnd) : void 0, [rows, columns]);
9758
+ const scroller = useRef38(null), [fadeEnd, setFadeEnd] = useState36(false);
9759
+ useEffect31(() => scroller.current ? watchTrailingOverflow(scroller.current, setFadeEnd) : void 0, [rows, columns]);
9701
9760
  const render = (row, col) => {
9702
9761
  const value = getValue(row, col.key), stale = !!getValue(row, "stale");
9703
9762
  if (cellLoading(row, col))
@@ -9878,7 +9937,7 @@ function KjunMarketTable(props) {
9878
9937
 
9879
9938
  // packages/react/src/list.tsx
9880
9939
  import { tokens as tokens55 } from "@kjun-ui/tokens";
9881
- import { createContext as createContext14, useContext as useContext17, useEffect as useEffect31, useId as useId17, useRef as useRef39 } from "react";
9940
+ import { createContext as createContext14, useContext as useContext17, useEffect as useEffect32, useId as useId17, useRef as useRef39 } from "react";
9882
9941
 
9883
9942
  // shared/package-runtime/list-row.ts
9884
9943
  function listRowKind({ checked, selected, href, pressable }) {
@@ -9908,10 +9967,10 @@ import { Fragment as Fragment28, jsx as jsx49, jsxs as jsxs42 } from "react/jsx-
9908
9967
  function KjunListRow({ title, description, icon, leading, trailing, actions, href, disabled = false, destructive = false, chevron = false, selected, checked, onCheckedChange, onClick, ariaLabel, children, titleLines, descriptionLines }) {
9909
9968
  const kind = listRowKind({ checked, selected, href, pressable: !!(href || onClick) }), toggle = kind === "switch";
9910
9969
  const content = useRef39(null), pressable = kind !== "static";
9911
- useEffect31(() => {
9970
+ useEffect32(() => {
9912
9971
  if (pressable) warnNestedControls(content.current, "KJUN ListRow: a pressable row's content contains buttons or links; move them to actions.");
9913
9972
  }, [pressable]);
9914
- useEffect31(() => warnListRowProps({ checked, selected, href, chevron }), [checked !== void 0, selected !== void 0, !!href, chevron]);
9973
+ useEffect32(() => warnListRowProps({ checked, selected, href, chevron }), [checked !== void 0, selected !== void 0, !!href, chevron]);
9915
9974
  const clamp = (lines) => lines ? { WebkitLineClamp: lines } : void 0;
9916
9975
  const front = leading || (icon ? /* @__PURE__ */ jsx49(KjunIcon, { name: icon, className: "kjun-list-icon", size: tokens55.extensions.list.iconSize }) : null);
9917
9976
  const contents = /* @__PURE__ */ jsxs42(Fragment28, { children: [
@@ -9930,7 +9989,7 @@ function KjunListRow({ title, description, icon, leading, trailing, actions, hre
9930
9989
  onCheckedChange == null ? void 0 : onCheckedChange(!checked);
9931
9990
  onClick == null ? void 0 : onClick(event);
9932
9991
  }, children: contents }) : kind === "radio" ? /* @__PURE__ */ jsx49("button", { className: "kjun-list-main", type: "button", role: "radio", "aria-checked": !!selected, "aria-label": ariaLabel, disabled, onClick, children: contents }) : href ? /* @__PURE__ */ jsx49("a", { className: "kjun-list-main", href: disabled ? void 0 : href, "aria-label": ariaLabel, "aria-disabled": disabled || void 0, onClick: disabled ? (e) => e.preventDefault() : onClick, children: contents }) : onClick ? /* @__PURE__ */ jsx49("button", { className: "kjun-list-main", type: "button", "aria-label": ariaLabel, disabled, onClick, children: contents }) : /* @__PURE__ */ jsx49("div", { className: "kjun-list-main", children: contents });
9933
- return /* @__PURE__ */ jsxs42("li", { className: "kjun-list-row", "data-leading": front ? "" : void 0, "data-destructive": destructive || void 0, "data-disabled": disabled || void 0, children: [
9992
+ return /* @__PURE__ */ jsxs42("li", { className: "kjun-list-row", "data-leading": front ? leading ? "" : "icon" : void 0, "data-destructive": destructive || void 0, "data-disabled": disabled || void 0, children: [
9934
9993
  main,
9935
9994
  hasContent(actions) && /* @__PURE__ */ jsx49("div", { className: "kjun-list-actions", "data-disabled": disabled || void 0, inert: disabled || void 0, children: actions })
9936
9995
  ] });
@@ -10058,14 +10117,14 @@ function KjunBottomActionBar({ description, children, safeArea = true, keyboardV
10058
10117
  }
10059
10118
 
10060
10119
  // packages/react/src/media.tsx
10061
- import { useRef as useRef40, useState as useState36 } from "react";
10120
+ import { useRef as useRef40, useState as useState37 } from "react";
10062
10121
  import { tokens as tokens57 } from "@kjun-ui/tokens";
10063
10122
  import { jsx as jsx51, jsxs as jsxs44 } from "react/jsx-runtime";
10064
10123
  function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover", fallback: fallback2, lazy = true, onLoad, onError }) {
10065
10124
  const current = useRef40({ src, version: 0 });
10066
10125
  if (current.current.src !== src) current.current = { src, version: current.current.version + 1 };
10067
10126
  const version = current.current.version;
10068
- const [result, setResult] = useState36({ version, state: "loading" });
10127
+ const [result, setResult] = useState37({ version, state: "loading" });
10069
10128
  const state = result.version === version ? result.state : "loading";
10070
10129
  const failed = !src || state === "error";
10071
10130
  return /* @__PURE__ */ jsxs44("span", { className: "kjun-image", style: { aspectRatio: aspectRatio > 0 ? aspectRatio : 1 }, "data-state": failed ? "error" : state, children: [
@@ -10116,33 +10175,217 @@ function KjunFab({ icon, ariaLabel, disabled = false, safeArea = true, offsetBot
10116
10175
  );
10117
10176
  }
10118
10177
 
10178
+ // shared/package-runtime/slider-view.ts
10179
+ var decimals = (value) => {
10180
+ var _a;
10181
+ const text = String(value);
10182
+ return text.includes("e-") ? Number(text.split("e-")[1]) : ((_a = text.split(".")[1]) != null ? _a : "").length;
10183
+ };
10184
+ var formatters = /* @__PURE__ */ new Map();
10185
+ function sliderFormatter(formatValue, locale, min = 0, step = 1) {
10186
+ if (formatValue) return formatValue;
10187
+ const digits = Math.min(6, Math.max(decimals(min), decimals(step)));
10188
+ const key = (locale != null ? locale : "") + "|" + digits;
10189
+ let format2 = formatters.get(key);
10190
+ if (!format2) {
10191
+ const intl = new Intl.NumberFormat(locale, { minimumFractionDigits: digits, maximumFractionDigits: digits });
10192
+ format2 = (value) => intl.format(value);
10193
+ formatters.set(key, format2);
10194
+ }
10195
+ return format2;
10196
+ }
10197
+ function sliderValueText(values, format2, formatRange2) {
10198
+ if (values.length === 2 && formatRange2) return formatRange2(values[0], values[1]);
10199
+ return values.length === 2 && values[0] === values[1] ? format2(values[0]) : values.map(format2).join(" \u2013 ");
10200
+ }
10201
+ var warnedMarks = false;
10202
+ function sliderMarks(marks, min, max, step, values, layout = {}) {
10203
+ if (!marks || !(max > min)) return [];
10204
+ const steps = Math.round((max - min) / step);
10205
+ if (marks === true && steps > 24 && !warnedMarks) {
10206
+ warnedMarks = true;
10207
+ console.warn(`KJUN Slider: marks={true}\uB294 step\uC774 24\uAC1C \uC774\uD558\uC77C \uB54C\uB9CC \uC810\uC744 \uADF8\uB9BD\uB2C8\uB2E4(\uC9C0\uAE08 ${steps}\uAC1C). \uAC12 \uBC30\uC5F4\uB85C \uC6D0\uD558\uB294 \uC704\uCE58\uB9CC \uB118\uAE30\uC138\uC694.`);
10208
+ }
10209
+ const list = marks === true ? steps <= 24 ? Array.from({ length: steps + 1 }, (_, i) => ({ value: min + i * step })) : [] : marks.filter((mark) => mark.value >= min && mark.value <= max);
10210
+ const high = values[values.length - 1];
10211
+ return list.map((mark) => ({
10212
+ ...mark,
10213
+ fraction: (mark.value - min) / (max - min),
10214
+ /** Offset from the left (or the top when vertical), like the thumbs. */
10215
+ position: sliderAxis((mark.value - min) / (max - min), layout),
10216
+ // On the fill the dot turns light: a single slider fills from min, a range between its thumbs.
10217
+ active: values.length === 2 ? mark.value > values[0] && mark.value < high : mark.value < high,
10218
+ dot: mark.value !== min && mark.value !== max,
10219
+ // Which rail end an end label aligns to: the visual left or right (vertical labels sit beside the rail and need none).
10220
+ edge: layout.vertical || mark.value !== min && mark.value !== max ? void 0 : mark.value === min !== !!layout.rtl ? "start" : "end"
10221
+ }));
10222
+ }
10223
+ function sliderAxis(fraction, { rtl = false, vertical = false } = {}) {
10224
+ return vertical || rtl ? 1 - fraction : fraction;
10225
+ }
10226
+ function sliderFillBox(fractions, layout = {}) {
10227
+ const ends = fractions.map((fraction) => sliderAxis(fraction, layout) * 100);
10228
+ if (ends.length === 2) return { lead: Math.min(...ends), trail: 100 - Math.max(...ends) };
10229
+ return layout.vertical || layout.rtl ? { lead: ends[0], trail: null } : { lead: null, trail: 100 - ends[0] };
10230
+ }
10231
+ function sliderPageSize(min, max, step) {
10232
+ const tenth = Math.floor((max - min) / 10 / step) * step;
10233
+ return Math.max(step, tenth);
10234
+ }
10235
+ function sliderKeyValue(key, value, min, max, step, rtl = false) {
10236
+ if (key === "Home") return min;
10237
+ if (key === "End") return max;
10238
+ if (key === "PageUp" || key === "PageDown") return value + (key === "PageUp" ? 1 : -1) * sliderPageSize(min, max, step);
10239
+ const delta = { ArrowRight: rtl ? -1 : 1, ArrowLeft: rtl ? 1 : -1, ArrowUp: 1, ArrowDown: -1 };
10240
+ return key in delta ? value + delta[key] * step : null;
10241
+ }
10242
+ function sliderValueAt(offset, length, min, max, { rtl = false, vertical = false } = {}) {
10243
+ let fraction = Math.max(0, Math.min(1, offset / Math.max(1, length)));
10244
+ if (vertical || rtl) fraction = 1 - fraction;
10245
+ return min + fraction * (max - min);
10246
+ }
10247
+ function sliderFractions(values, min, max) {
10248
+ return values.map((value) => max > min ? Math.max(0, Math.min(1, (value - min) / (max - min))) : 0);
10249
+ }
10250
+ function sliderFrontThumb(values, min, max) {
10251
+ if (values.length !== 2 || values[0] !== values[1]) return null;
10252
+ return values[0] >= (min + max) / 2 ? 0 : 1;
10253
+ }
10254
+ function sliderPick(values, number, snapped) {
10255
+ if (values.length !== 2) return { index: 0, pending: false };
10256
+ if (values[0] === values[1]) {
10257
+ if (snapped === values[0]) return { index: values[0] >= number ? 0 : 1, pending: true };
10258
+ return { index: number > values[0] ? 1 : 0, pending: false };
10259
+ }
10260
+ return { index: Math.abs(number - values[1]) < Math.abs(number - values[0]) ? 1 : 0, pending: false };
10261
+ }
10262
+ function createSliderSession(initial, options) {
10263
+ let latest = [...initial], dirty = false, pending = false, active = null;
10264
+ const update = (index, number) => {
10265
+ if (options.blocked()) return;
10266
+ const next = [...latest];
10267
+ next[index] = Math.min(
10268
+ index === 0 && next.length === 2 ? next[1] : options.max(),
10269
+ Math.max(index === 1 ? next[0] : options.min(), options.snap(number))
10270
+ );
10271
+ if (next[index] === latest[index]) return;
10272
+ latest = next;
10273
+ dirty = true;
10274
+ options.emit([...next]);
10275
+ };
10276
+ const commit = () => {
10277
+ if (options.blocked() || !dirty) return;
10278
+ dirty = false;
10279
+ options.commit([...latest]);
10280
+ };
10281
+ return {
10282
+ get values() {
10283
+ return latest;
10284
+ },
10285
+ get active() {
10286
+ return active;
10287
+ },
10288
+ sync(values) {
10289
+ if (active === null) latest = [...values];
10290
+ },
10291
+ update,
10292
+ commit,
10293
+ press(number) {
10294
+ var _a;
10295
+ if (options.blocked()) return null;
10296
+ const pick = sliderPick(latest, number, options.snap(number));
10297
+ active = pick.index;
10298
+ pending = pick.pending;
10299
+ (_a = options.focus) == null ? void 0 : _a.call(options, active);
10300
+ update(active, number);
10301
+ return active;
10302
+ },
10303
+ move(number) {
10304
+ var _a;
10305
+ if (active === null) return active;
10306
+ if (pending) {
10307
+ if (options.snap(number) === latest[0]) return active;
10308
+ active = number > latest[0] ? 1 : 0;
10309
+ pending = false;
10310
+ (_a = options.focus) == null ? void 0 : _a.call(options, active);
10311
+ }
10312
+ update(active, number);
10313
+ return active;
10314
+ },
10315
+ release() {
10316
+ if (active === null) return;
10317
+ active = null;
10318
+ pending = false;
10319
+ commit();
10320
+ },
10321
+ cancel() {
10322
+ active = null;
10323
+ pending = false;
10324
+ dirty = false;
10325
+ },
10326
+ key(index, key, rtl = false) {
10327
+ const next = sliderKeyValue(key, latest[index], options.min(), options.max(), options.step(), rtl);
10328
+ if (next === null) return false;
10329
+ update(index, next);
10330
+ return true;
10331
+ }
10332
+ };
10333
+ }
10334
+
10119
10335
  // packages/react/src/range-input.tsx
10120
- import { useContext as useContext18, useEffect as useEffect32, useLayoutEffect as useLayoutEffect17, useRef as useRef41 } from "react";
10121
- import { Slider, SliderTrack, SliderThumb, Label, SliderOutput, SliderStateContext } from "react-aria-components";
10336
+ import { useContext as useContext18, useEffect as useEffect33, useLayoutEffect as useLayoutEffect17, useRef as useRef41, useState as useState38 } from "react";
10337
+ import { Slider, SliderTrack, SliderThumb, Label, SliderOutput, SliderStateContext, useLocale as useLocale2 } from "react-aria-components";
10122
10338
  import { createSliderDomain } from "@kjun-ui/tokens";
10123
10339
  import { Fragment as Fragment29, jsx as jsx54, jsxs as jsxs46 } from "react/jsx-runtime";
10124
- function RangeThumb({ index, label, formatValue }) {
10340
+ var edge = "calc(var(--_kjun-slider-thumb) / -2)";
10341
+ function RangeThumb({ index, label, format: format2, front, dragging, inputs }) {
10125
10342
  const state = useContext18(SliderStateContext);
10126
10343
  const input = useRef41(null);
10127
- const text = formatValue ? formatValue(state.values[index]) : state.getThumbValueLabel(index);
10344
+ const text = format2(state.values[index]);
10128
10345
  useLayoutEffect17(() => {
10129
10346
  var _a;
10130
10347
  (_a = input.current) == null ? void 0 : _a.setAttribute("aria-valuetext", text);
10348
+ inputs[index] = input.current;
10131
10349
  });
10132
- return /* @__PURE__ */ jsx54(SliderThumb, { index, inputRef: input, className: "kjun-slider-thumb", "aria-label": label });
10350
+ return /* @__PURE__ */ jsx54(
10351
+ SliderThumb,
10352
+ {
10353
+ index,
10354
+ inputRef: input,
10355
+ className: "kjun-slider-thumb" + (dragging ? " kjun-slider-thumb--dragging" : ""),
10356
+ "aria-label": label,
10357
+ style: front ? { zIndex: 1 } : void 0
10358
+ }
10359
+ );
10133
10360
  }
10134
- function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, label, ariaLabel, showValue = true, formatValue, onValueChange, onChangeCommit, ...rest }) {
10135
- const m = useKjunMessages();
10136
- const thumbLabels = "thumbLabels" in rest ? rest.thumbLabels || [m.minimum, m.maximum] : [m.minimum, m.maximum];
10361
+ function RangeInput(props) {
10362
+ const { value, min = 0, max = 100, step = 1, disabled = false, label, ariaLabel, showValue = true, formatValue, marks, size = "md", orientation = "horizontal" } = props;
10363
+ const m = useKjunMessages(), locale = useKjunMessageScope().intl;
10364
+ const { direction } = useLocale2();
10365
+ const vertical = orientation === "vertical", layout = { rtl: direction === "rtl" && !vertical, vertical };
10366
+ const format2 = sliderFormatter(formatValue, locale, min, step);
10367
+ const formatRange2 = "formatRange" in props ? props.formatRange : void 0;
10368
+ const thumbLabels = "thumbLabels" in props ? props.thumbLabels || [m.minimum, m.maximum] : [m.minimum, m.maximum];
10137
10369
  const domain = createSliderDomain(min, max, step);
10138
10370
  const list = Array.isArray(value) ? value : [value];
10139
10371
  const valid = domain.valid && (!Array.isArray(value) || value.length === 2) && list.every((v) => domain.accepts(v)) && (list.length === 1 || list[0] <= list[1]);
10140
10372
  const latest = useRef41(value);
10141
10373
  latest.current = value;
10142
10374
  const active = useRef41(false);
10143
- useEffect32(() => {
10375
+ const inputs = useRef41([]);
10376
+ const track = useRef41(null);
10377
+ const [ownDrag, setOwnDrag] = useState38(null);
10378
+ useEffect33(() => {
10144
10379
  if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
10145
10380
  }, [valid]);
10381
+ const emit = (result) => {
10382
+ var _a;
10383
+ return (_a = props.onValueChange) == null ? void 0 : _a.call(props, result);
10384
+ };
10385
+ const commit = (result) => {
10386
+ var _a;
10387
+ return (_a = props.onChangeCommit) == null ? void 0 : _a.call(props, result);
10388
+ };
10146
10389
  const change = (next) => {
10147
10390
  if (!valid || disabled) return;
10148
10391
  const snapped = (Array.isArray(next) ? next : [next]).map(domain.snap);
@@ -10150,24 +10393,114 @@ function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, lab
10150
10393
  if (JSON.stringify(result) === JSON.stringify(latest.current)) return;
10151
10394
  latest.current = result;
10152
10395
  active.current = true;
10153
- onValueChange == null ? void 0 : onValueChange(result);
10396
+ emit(result);
10397
+ };
10398
+ const top = valid ? domain.snap(max) : max;
10399
+ const session = () => createSliderSession(Array.isArray(latest.current) ? latest.current : [latest.current], {
10400
+ min: () => min,
10401
+ max: () => top,
10402
+ step: () => step,
10403
+ snap: domain.snap,
10404
+ blocked: () => disabled || !valid,
10405
+ emit: (next) => {
10406
+ const result = next.length === 1 ? next[0] : next;
10407
+ latest.current = result;
10408
+ emit(result);
10409
+ },
10410
+ commit: (next) => commit(next.length === 1 ? next[0] : next),
10411
+ focus: (index) => {
10412
+ var _a;
10413
+ setOwnDrag(index);
10414
+ (_a = inputs.current[index]) == null ? void 0 : _a.focus({ preventScroll: true });
10415
+ }
10416
+ });
10417
+ const valueAt = (event) => {
10418
+ const box = track.current.getBoundingClientRect();
10419
+ return sliderValueAt(vertical ? event.clientY - box.top : event.clientX - box.left, vertical ? box.height : box.width, min, top, layout);
10154
10420
  };
10155
- return /* @__PURE__ */ jsxs46(Slider, { className: "kjun-slider", "data-disabled": disabled || !valid, "aria-label": ariaLabel || label || m.value, value: valid ? value : Array.isArray(value) ? [0, 100] : 0, minValue: valid ? min : 0, maxValue: valid ? domain.snap(max) : 100, step: valid ? step : 1, isDisabled: disabled || !valid, onChange: change, onChangeEnd: () => {
10156
- if (valid && !disabled && active.current) {
10157
- active.current = false;
10158
- onChangeCommit == null ? void 0 : onChangeCommit(latest.current);
10421
+ const collapsed = valid && !disabled && list.length === 2 && list[0] === list[1];
10422
+ useEffect33(() => {
10423
+ const element = track.current;
10424
+ if (!element || !collapsed) return;
10425
+ const down = (event) => {
10426
+ if (event.button !== 0) return;
10427
+ event.preventDefault();
10428
+ event.stopPropagation();
10429
+ const drag = session();
10430
+ drag.press(valueAt(event));
10431
+ const move = (next) => drag.move(valueAt(next));
10432
+ const up = () => {
10433
+ drag.release();
10434
+ setOwnDrag(null);
10435
+ removeEventListener("pointermove", move);
10436
+ removeEventListener("pointerup", up);
10437
+ removeEventListener("pointercancel", up);
10438
+ };
10439
+ addEventListener("pointermove", move);
10440
+ addEventListener("pointerup", up);
10441
+ addEventListener("pointercancel", up);
10442
+ };
10443
+ element.addEventListener("pointerdown", down, true);
10444
+ return () => element.removeEventListener("pointerdown", down, true);
10445
+ });
10446
+ const pickMark = (number) => {
10447
+ const drag = session();
10448
+ drag.press(number);
10449
+ drag.release();
10450
+ setOwnDrag(null);
10451
+ };
10452
+ const fractions = sliderFractions(list, min, top);
10453
+ const front = valid ? sliderFrontThumb(list, min, top) : null;
10454
+ const dots = valid ? sliderMarks(marks, min, top, step, list, layout) : [];
10455
+ const fill = sliderFillBox(fractions, layout);
10456
+ const [lead, trail] = vertical ? ["top", "bottom"] : ["left", "right"];
10457
+ return /* @__PURE__ */ jsxs46(
10458
+ Slider,
10459
+ {
10460
+ className: "kjun-slider",
10461
+ "data-size": size,
10462
+ "data-orientation": orientation,
10463
+ "data-disabled": disabled || !valid,
10464
+ orientation,
10465
+ "aria-label": label ? void 0 : ariaLabel || m.value,
10466
+ style: vertical && props.length ? { "--_kjun-slider-length": props.length + "px" } : void 0,
10467
+ value: valid ? value : Array.isArray(value) ? fractions.map((f) => f * 100) : fractions[0] * 100,
10468
+ minValue: valid ? min : 0,
10469
+ maxValue: valid ? top : 100,
10470
+ step: valid ? step : 1,
10471
+ isDisabled: disabled || !valid,
10472
+ onChange: change,
10473
+ onChangeEnd: () => {
10474
+ if (valid && !disabled && active.current) {
10475
+ active.current = false;
10476
+ commit(latest.current);
10477
+ }
10478
+ },
10479
+ children: [
10480
+ (label || showValue) && /* @__PURE__ */ jsxs46("div", { className: "kjun-slider-caption", children: [
10481
+ label && /* @__PURE__ */ jsx54(Label, { className: "kjun-slider-label", children: label }),
10482
+ showValue && /* @__PURE__ */ jsx54(SliderOutput, { className: "kjun-slider-value", children: ({ state }) => sliderValueText(valid ? state.values : list, format2, formatRange2) })
10483
+ ] }),
10484
+ /* @__PURE__ */ jsx54(SliderTrack, { ref: track, className: "kjun-slider-track", children: () => /* @__PURE__ */ jsxs46(Fragment29, { children: [
10485
+ /* @__PURE__ */ jsx54("div", { className: "kjun-slider-rail" }),
10486
+ /* @__PURE__ */ jsx54("div", { className: "kjun-slider-fill", style: { [lead]: fill.lead === null ? edge : fill.lead + "%", [trail]: fill.trail === null ? edge : fill.trail + "%" } }),
10487
+ dots.filter((dot) => dot.dot).map((dot) => /* @__PURE__ */ jsx54("span", { className: "kjun-slider-mark", "data-active": dot.active || void 0, style: { [lead]: dot.position * 100 + "%" } }, dot.value)),
10488
+ list.map((_, i) => /* @__PURE__ */ jsx54(RangeThumb, { index: i, format: format2, front: front === i, dragging: ownDrag === i, inputs: inputs.current, label: list.length === 2 ? thumbLabels[i] : ariaLabel || label || m.value }, i))
10489
+ ] }) }),
10490
+ dots.some((dot) => dot.label) && /* @__PURE__ */ jsx54("div", { className: "kjun-slider-marks", "aria-hidden": "true", children: dots.filter((dot) => dot.label).map((dot) => /* @__PURE__ */ jsx54(
10491
+ "span",
10492
+ {
10493
+ className: "kjun-slider-mark-label",
10494
+ "data-edge": dot.edge,
10495
+ style: { [lead]: dot.position * 100 + "%" },
10496
+ onClick: () => pickMark(dot.value),
10497
+ children: dot.label
10498
+ },
10499
+ dot.value
10500
+ )) })
10501
+ ]
10159
10502
  }
10160
- }, children: [
10161
- (label || showValue) && /* @__PURE__ */ jsxs46("div", { className: "kjun-slider-caption", children: [
10162
- label && /* @__PURE__ */ jsx54(Label, { className: "kjun-slider-label", children: label }),
10163
- showValue && /* @__PURE__ */ jsx54(SliderOutput, { className: "kjun-slider-value", children: ({ state }) => state.values.map(formatValue != null ? formatValue : String).join(" \u2013 ") })
10164
- ] }),
10165
- /* @__PURE__ */ jsx54(SliderTrack, { className: "kjun-slider-track", children: ({ state }) => /* @__PURE__ */ jsxs46(Fragment29, { children: [
10166
- /* @__PURE__ */ jsx54("div", { className: "kjun-slider-rail" }),
10167
- /* @__PURE__ */ jsx54("div", { className: "kjun-slider-fill", style: { left: (list.length === 2 ? state.getThumbPercent(0) * 100 : 0) + "%", width: (state.getThumbPercent(list.length - 1) - (list.length === 2 ? state.getThumbPercent(0) : 0)) * 100 + "%" } }),
10168
- list.map((_, i) => /* @__PURE__ */ jsx54(RangeThumb, { index: i, formatValue, label: list.length === 2 ? thumbLabels[i] : ariaLabel || label || m.value }, i))
10169
- ] }) })
10170
- ] });
10503
+ );
10171
10504
  }
10172
10505
  function KjunSlider(props) {
10173
10506
  return /* @__PURE__ */ jsx54(RangeInput, { ...props });
@@ -10177,7 +10510,7 @@ function KjunRangeSlider(props) {
10177
10510
  }
10178
10511
 
10179
10512
  // packages/react/src/quantity-stepper.tsx
10180
- import { useEffect as useEffect33, useRef as useRef42, useState as useState37 } from "react";
10513
+ import { useEffect as useEffect34, useRef as useRef42, useState as useState39 } from "react";
10181
10514
  import { createNumberDomain, quantityKeyAction, tokens as tokens60 } from "@kjun-ui/tokens";
10182
10515
  import { jsx as jsx55, jsxs as jsxs47 } from "react/jsx-runtime";
10183
10516
  function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, disabled = false, error = false, size = "md", block = false, id, ariaLabel, onValueChange, onChangeCommit, onInvalidInput }) {
@@ -10186,15 +10519,15 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
10186
10519
  const buttonStyle = { width: tokens60.input[size].height, padding: 0 };
10187
10520
  const domain = createNumberDomain({ min, max, step, precision });
10188
10521
  const valid = domain.valid && domain.accepts(value), blocked = disabled || !valid;
10189
- const [draft, setDraft] = useState37(String(value));
10522
+ const [draft, setDraft] = useState39(String(value));
10190
10523
  const field = useKjunField();
10191
10524
  const composing = useRef42(false), dirty = useRef42(false), accepted = useRef42(value);
10192
- useEffect33(() => {
10525
+ useEffect34(() => {
10193
10526
  setDraft(String(value));
10194
10527
  accepted.current = value;
10195
10528
  dirty.current = false;
10196
10529
  }, [value, precision, min, max, step]);
10197
- useEffect33(() => {
10530
+ useEffect34(() => {
10198
10531
  if (!valid) console.warn("KJUN QuantityStepper: \uBC94\uC704\xB7step\xB7\uC815\uBC00\uB3C4\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
10199
10532
  }, [valid]);
10200
10533
  const emit = (next) => {
@@ -10310,7 +10643,7 @@ function timeSegments(domain, value, { precision, hourCycle = 24, messages, peri
10310
10643
  var periodLeads = (language) => !language || ["ko", "ja", "zh"].includes(language);
10311
10644
 
10312
10645
  // packages/react/src/time-picker.tsx
10313
- import { Fragment as Fragment30, useEffect as useEffect34, useId as useId18, useMemo as useMemo4, useRef as useRef43 } from "react";
10646
+ import { Fragment as Fragment30, useEffect as useEffect35, useId as useId18, useMemo as useMemo4, useRef as useRef43 } from "react";
10314
10647
  import { createTimeDomain, tokens as tokens61 } from "@kjun-ui/tokens";
10315
10648
  import { jsx as jsx56, jsxs as jsxs48 } from "react/jsx-runtime";
10316
10649
  function KjunTimePicker({
@@ -10339,7 +10672,7 @@ function KjunTimePicker({
10339
10672
  const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
10340
10673
  const domain = useMemo4(() => createTimeDomain({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]);
10341
10674
  const accepted = domain.accepts(value);
10342
- useEffect34(() => {
10675
+ useEffect35(() => {
10343
10676
  if (!domain.valid) warnPicker("TimePicker: check min, max, minuteStep and secondStep.");
10344
10677
  else if (!accepted) warnPicker(`TimePicker: ${value} is outside the step or bounds.`);
10345
10678
  }, [domain, accepted, value]);