@kjun-ui/native 0.5.0 → 0.6.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.cjs CHANGED
@@ -4064,7 +4064,7 @@ function KjunTooltip({
4064
4064
  }
4065
4065
  };
4066
4066
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
4067
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native29.View, { ref, collapsable: false, style: { alignSelf: "flex-start" }, children: child ? (0, import_react35.cloneElement)(child, handlers) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AccessiblePressable, { ...handlers, children }) }),
4067
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native29.View, { ref, collapsable: false, style: { alignSelf: (childProps == null ? void 0 : childProps.block) ? "stretch" : "flex-start" }, children: child ? (0, import_react35.cloneElement)(child, handlers) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AccessiblePressable, { ...handlers, children }) }),
4068
4068
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4069
4069
  FloatingPanel,
4070
4070
  {
@@ -7052,12 +7052,36 @@ function KjunSparkline({
7052
7052
  // shared/package-runtime/table.ts
7053
7053
  var import_tokens43 = require("@kjun-ui/tokens");
7054
7054
  var import_react56 = require("react");
7055
+
7056
+ // shared/package-runtime/table-model.ts
7055
7057
  function getValue(row, key) {
7056
7058
  return key.split(".").reduce(
7057
7059
  (value, part) => value != null && typeof value === "object" ? value[part] : void 0,
7058
7060
  row
7059
7061
  );
7060
7062
  }
7063
+ function sortTableRows(data, sort, { sortable = true, sortMode = "client" }) {
7064
+ if (!sortable || sortMode === "server" || !sort.key) return data;
7065
+ return [...data].sort((a, b) => {
7066
+ const x = getValue(a, sort.key), y = getValue(b, sort.key);
7067
+ const order = x === y ? 0 : typeof x === "number" && typeof y === "number" ? x > y ? 1 : -1 : String(x) > String(y) ? 1 : -1;
7068
+ return sort.order === "asc" ? order : -order;
7069
+ });
7070
+ }
7071
+ var tableRowKey = (row, rowKey, index = 0) => {
7072
+ var _a;
7073
+ return (_a = getValue(row, rowKey)) != null ? _a : index;
7074
+ };
7075
+ function tableSelection(rows, selected, rowKey) {
7076
+ const isSelected = (row) => selected.some((r) => getValue(r, rowKey) === getValue(row, rowKey));
7077
+ const all = rows.length > 0 && rows.every(isSelected);
7078
+ return { isSelected, all, some: rows.some(isSelected) && !all };
7079
+ }
7080
+ var toggleSelectedRow = (selected, row, rowKey) => selected.some((r) => getValue(r, rowKey) === getValue(row, rowKey)) ? selected.filter((r) => getValue(r, rowKey) !== getValue(row, rowKey)) : [...selected, row];
7081
+ var toggleAllRows = (rows, all) => all ? [] : [...rows];
7082
+ var toggleExpandedRow = (expanded, id, single) => expanded.includes(id) ? expanded.filter((v) => v !== id) : [...single ? [] : expanded, id];
7083
+
7084
+ // shared/package-runtime/table.ts
7061
7085
  function useTableModel(props) {
7062
7086
  var _a;
7063
7087
  const {
@@ -7077,17 +7101,9 @@ function useTableModel(props) {
7077
7101
  }), [internalExpanded, setExpanded] = (0, import_react56.useState)([]), [search, setSearch] = (0, import_react56.useState)(""), timer = (0, import_react56.useRef)(void 0);
7078
7102
  (0, import_react56.useEffect)(() => () => clearTimeout(timer.current), []);
7079
7103
  const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
7080
- const rows = sortable && sortMode !== "server" && sort.key ? [...data].sort((a, b) => {
7081
- const x = getValue(a, sort.key), y = getValue(b, sort.key);
7082
- const order = x === y ? 0 : typeof x === "number" && typeof y === "number" ? x > y ? 1 : -1 : String(x) > String(y) ? 1 : -1;
7083
- return sort.order === "asc" ? order : -order;
7084
- }) : data;
7085
- const key = (row, index = 0) => {
7086
- var _a2;
7087
- return (_a2 = getValue(row, rowKey)) != null ? _a2 : index;
7088
- };
7089
- const selectedRow = (row) => selected.some((r) => getValue(r, rowKey) === getValue(row, rowKey));
7090
- const all = rows.length > 0 && rows.every(selectedRow), some = rows.some(selectedRow) && !all, expanded = expandedRows != null ? expandedRows : internalExpanded;
7104
+ const rows = sortTableRows(data, sort, { sortable, sortMode });
7105
+ const key = (row, index = 0) => tableRowKey(row, rowKey, index);
7106
+ const { isSelected: selectedRow, all, some } = tableSelection(rows, selected, rowKey), expanded = expandedRows != null ? expandedRows : internalExpanded;
7091
7107
  return {
7092
7108
  rows,
7093
7109
  key,
@@ -7112,14 +7128,10 @@ function useTableModel(props) {
7112
7128
  if (props.sort === void 0) setSort(next);
7113
7129
  (_a2 = props.onSortChange) == null ? void 0 : _a2.call(props, next);
7114
7130
  },
7115
- toggleRow: (row) => onSelectionChange == null ? void 0 : onSelectionChange(
7116
- selectedRow(row) ? selected.filter(
7117
- (r) => getValue(r, rowKey) !== getValue(row, rowKey)
7118
- ) : [...selected, row]
7119
- ),
7120
- toggleAll: () => onSelectionChange == null ? void 0 : onSelectionChange(all ? [] : [...rows]),
7131
+ toggleRow: (row) => onSelectionChange == null ? void 0 : onSelectionChange(toggleSelectedRow(selected, row, rowKey)),
7132
+ toggleAll: () => onSelectionChange == null ? void 0 : onSelectionChange(toggleAllRows(rows, all)),
7121
7133
  toggleExpand: (row, index) => {
7122
- const id = key(row, index), next = expanded.includes(id) ? expanded.filter((v) => v !== id) : [...expandSingle ? [] : expanded, id];
7134
+ const next = toggleExpandedRow(expanded, key(row, index), expandSingle);
7123
7135
  setExpanded(next);
7124
7136
  onExpandedRowsChange == null ? void 0 : onExpandedRowsChange(next);
7125
7137
  }
@@ -9603,7 +9615,8 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
9603
9615
  };
9604
9616
  }, []);
9605
9617
  const surfaceBox = { position: "absolute", left: 0, right: 0, top: "50%", height: import_tokens60.tokens.input[size].height, marginTop: -import_tokens60.tokens.input[size].height / 2, borderRadius: surface.spec.radius };
9606
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_react_native62.View, { style: { flexDirection: "row", alignItems: "center", alignSelf: block ? "stretch" : "flex-start", maxWidth: "100%" }, children: [
9618
+ const hug = import_react_native62.Platform.OS === "web" && !block ? { width: "fit-content" } : {};
9619
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_react_native62.View, { style: { flexDirection: "row", alignItems: "center", alignSelf: block ? "stretch" : "flex-start", maxWidth: "100%", borderRadius: surface.spec.radius, ...hug }, children: [
9607
9620
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react_native62.View, { pointerEvents: "none", "aria-hidden": true, style: { ...surfaceBox, backgroundColor: colors.inputBg } }),
9608
9621
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(CompoundTarget, { square: true, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(KjunButton, { size, style: decreaseStyle, variant: "ghost", ariaLabel: "\uC218\uB7C9 \uC904\uC774\uAE30", disabled: blocked || value <= min, onPress: () => move(-1), prefixIcon: "minus" }) }),
9609
9622
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react_native62.View, { style: { flex: block ? 1 : void 0, width: block ? void 0 : geometry2.valueWidth, minWidth: 0, minHeight: finePointer() ? void 0 : import_tokens60.tokens.native.minimumTouchTarget, justifyContent: "center" }, ...fieldTarget(() => {
package/dist/index.js CHANGED
@@ -4079,7 +4079,7 @@ function KjunTooltip({
4079
4079
  }
4080
4080
  };
4081
4081
  return /* @__PURE__ */ jsxs15(Fragment5, { children: [
4082
- /* @__PURE__ */ jsx25(View19, { ref, collapsable: false, style: { alignSelf: "flex-start" }, children: child ? cloneElement3(child, handlers) : /* @__PURE__ */ jsx25(AccessiblePressable, { ...handlers, children }) }),
4082
+ /* @__PURE__ */ jsx25(View19, { ref, collapsable: false, style: { alignSelf: (childProps == null ? void 0 : childProps.block) ? "stretch" : "flex-start" }, children: child ? cloneElement3(child, handlers) : /* @__PURE__ */ jsx25(AccessiblePressable, { ...handlers, children }) }),
4083
4083
  /* @__PURE__ */ jsx25(
4084
4084
  FloatingPanel,
4085
4085
  {
@@ -7091,12 +7091,36 @@ function KjunSparkline({
7091
7091
  // shared/package-runtime/table.ts
7092
7092
  import { nextTableSort } from "@kjun-ui/tokens";
7093
7093
  import { useEffect as useEffect23, useRef as useRef31, useState as useState33 } from "react";
7094
+
7095
+ // shared/package-runtime/table-model.ts
7094
7096
  function getValue(row, key) {
7095
7097
  return key.split(".").reduce(
7096
7098
  (value, part) => value != null && typeof value === "object" ? value[part] : void 0,
7097
7099
  row
7098
7100
  );
7099
7101
  }
7102
+ function sortTableRows(data, sort, { sortable = true, sortMode = "client" }) {
7103
+ if (!sortable || sortMode === "server" || !sort.key) return data;
7104
+ return [...data].sort((a, b) => {
7105
+ const x = getValue(a, sort.key), y = getValue(b, sort.key);
7106
+ const order = x === y ? 0 : typeof x === "number" && typeof y === "number" ? x > y ? 1 : -1 : String(x) > String(y) ? 1 : -1;
7107
+ return sort.order === "asc" ? order : -order;
7108
+ });
7109
+ }
7110
+ var tableRowKey = (row, rowKey, index = 0) => {
7111
+ var _a;
7112
+ return (_a = getValue(row, rowKey)) != null ? _a : index;
7113
+ };
7114
+ function tableSelection(rows, selected, rowKey) {
7115
+ const isSelected = (row) => selected.some((r) => getValue(r, rowKey) === getValue(row, rowKey));
7116
+ const all = rows.length > 0 && rows.every(isSelected);
7117
+ return { isSelected, all, some: rows.some(isSelected) && !all };
7118
+ }
7119
+ var toggleSelectedRow = (selected, row, rowKey) => selected.some((r) => getValue(r, rowKey) === getValue(row, rowKey)) ? selected.filter((r) => getValue(r, rowKey) !== getValue(row, rowKey)) : [...selected, row];
7120
+ var toggleAllRows = (rows, all) => all ? [] : [...rows];
7121
+ var toggleExpandedRow = (expanded, id, single) => expanded.includes(id) ? expanded.filter((v) => v !== id) : [...single ? [] : expanded, id];
7122
+
7123
+ // shared/package-runtime/table.ts
7100
7124
  function useTableModel(props) {
7101
7125
  var _a;
7102
7126
  const {
@@ -7116,17 +7140,9 @@ function useTableModel(props) {
7116
7140
  }), [internalExpanded, setExpanded] = useState33([]), [search, setSearch] = useState33(""), timer = useRef31(void 0);
7117
7141
  useEffect23(() => () => clearTimeout(timer.current), []);
7118
7142
  const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
7119
- const rows = sortable && sortMode !== "server" && sort.key ? [...data].sort((a, b) => {
7120
- const x = getValue(a, sort.key), y = getValue(b, sort.key);
7121
- const order = x === y ? 0 : typeof x === "number" && typeof y === "number" ? x > y ? 1 : -1 : String(x) > String(y) ? 1 : -1;
7122
- return sort.order === "asc" ? order : -order;
7123
- }) : data;
7124
- const key = (row, index = 0) => {
7125
- var _a2;
7126
- return (_a2 = getValue(row, rowKey)) != null ? _a2 : index;
7127
- };
7128
- const selectedRow = (row) => selected.some((r) => getValue(r, rowKey) === getValue(row, rowKey));
7129
- const all = rows.length > 0 && rows.every(selectedRow), some = rows.some(selectedRow) && !all, expanded = expandedRows != null ? expandedRows : internalExpanded;
7143
+ const rows = sortTableRows(data, sort, { sortable, sortMode });
7144
+ const key = (row, index = 0) => tableRowKey(row, rowKey, index);
7145
+ const { isSelected: selectedRow, all, some } = tableSelection(rows, selected, rowKey), expanded = expandedRows != null ? expandedRows : internalExpanded;
7130
7146
  return {
7131
7147
  rows,
7132
7148
  key,
@@ -7151,14 +7167,10 @@ function useTableModel(props) {
7151
7167
  if (props.sort === void 0) setSort(next);
7152
7168
  (_a2 = props.onSortChange) == null ? void 0 : _a2.call(props, next);
7153
7169
  },
7154
- toggleRow: (row) => onSelectionChange == null ? void 0 : onSelectionChange(
7155
- selectedRow(row) ? selected.filter(
7156
- (r) => getValue(r, rowKey) !== getValue(row, rowKey)
7157
- ) : [...selected, row]
7158
- ),
7159
- toggleAll: () => onSelectionChange == null ? void 0 : onSelectionChange(all ? [] : [...rows]),
7170
+ toggleRow: (row) => onSelectionChange == null ? void 0 : onSelectionChange(toggleSelectedRow(selected, row, rowKey)),
7171
+ toggleAll: () => onSelectionChange == null ? void 0 : onSelectionChange(toggleAllRows(rows, all)),
7160
7172
  toggleExpand: (row, index) => {
7161
- const id = key(row, index), next = expanded.includes(id) ? expanded.filter((v) => v !== id) : [...expandSingle ? [] : expanded, id];
7173
+ const next = toggleExpandedRow(expanded, key(row, index), expandSingle);
7162
7174
  setExpanded(next);
7163
7175
  onExpandedRowsChange == null ? void 0 : onExpandedRowsChange(next);
7164
7176
  }
@@ -9654,7 +9666,8 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
9654
9666
  };
9655
9667
  }, []);
9656
9668
  const surfaceBox = { position: "absolute", left: 0, right: 0, top: "50%", height: tokens57.input[size].height, marginTop: -tokens57.input[size].height / 2, borderRadius: surface.spec.radius };
9657
- return /* @__PURE__ */ jsx59(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ jsxs45(View52, { style: { flexDirection: "row", alignItems: "center", alignSelf: block ? "stretch" : "flex-start", maxWidth: "100%" }, children: [
9669
+ const hug = Platform27.OS === "web" && !block ? { width: "fit-content" } : {};
9670
+ return /* @__PURE__ */ jsx59(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ jsxs45(View52, { style: { flexDirection: "row", alignItems: "center", alignSelf: block ? "stretch" : "flex-start", maxWidth: "100%", borderRadius: surface.spec.radius, ...hug }, children: [
9658
9671
  /* @__PURE__ */ jsx59(View52, { pointerEvents: "none", "aria-hidden": true, style: { ...surfaceBox, backgroundColor: colors.inputBg } }),
9659
9672
  /* @__PURE__ */ jsx59(CompoundTarget, { square: true, children: /* @__PURE__ */ jsx59(KjunButton, { size, style: decreaseStyle, variant: "ghost", ariaLabel: "\uC218\uB7C9 \uC904\uC774\uAE30", disabled: blocked || value <= min, onPress: () => move(-1), prefixIcon: "minus" }) }),
9660
9673
  /* @__PURE__ */ jsx59(View52, { style: { flex: block ? 1 : void 0, width: block ? void 0 : geometry2.valueWidth, minWidth: 0, minHeight: finePointer() ? void 0 : tokens57.native.minimumTouchTarget, justifyContent: "center" }, ...fieldTarget(() => {
@@ -4226,7 +4226,7 @@ function KjunTooltip({
4226
4226
  }
4227
4227
  };
4228
4228
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
4229
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native29.View, { ref, collapsable: false, style: { alignSelf: "flex-start" }, children: child ? (0, import_react38.cloneElement)(child, handlers) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AccessiblePressable, { ...handlers, children }) }),
4229
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native29.View, { ref, collapsable: false, style: { alignSelf: (childProps == null ? void 0 : childProps.block) ? "stretch" : "flex-start" }, children: child ? (0, import_react38.cloneElement)(child, handlers) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AccessiblePressable, { ...handlers, children }) }),
4230
4230
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4231
4231
  FloatingPanel,
4232
4232
  {
@@ -7307,12 +7307,36 @@ function KjunSparkline({
7307
7307
  // shared/package-runtime/table.ts
7308
7308
  var import_tokens44 = require("@kjun-ui/tokens");
7309
7309
  var import_react60 = require("react");
7310
+
7311
+ // shared/package-runtime/table-model.ts
7310
7312
  function getValue(row, key) {
7311
7313
  return key.split(".").reduce(
7312
7314
  (value, part) => value != null && typeof value === "object" ? value[part] : void 0,
7313
7315
  row
7314
7316
  );
7315
7317
  }
7318
+ function sortTableRows(data, sort, { sortable = true, sortMode = "client" }) {
7319
+ if (!sortable || sortMode === "server" || !sort.key) return data;
7320
+ return [...data].sort((a, b) => {
7321
+ const x = getValue(a, sort.key), y = getValue(b, sort.key);
7322
+ const order = x === y ? 0 : typeof x === "number" && typeof y === "number" ? x > y ? 1 : -1 : String(x) > String(y) ? 1 : -1;
7323
+ return sort.order === "asc" ? order : -order;
7324
+ });
7325
+ }
7326
+ var tableRowKey = (row, rowKey, index = 0) => {
7327
+ var _a;
7328
+ return (_a = getValue(row, rowKey)) != null ? _a : index;
7329
+ };
7330
+ function tableSelection(rows, selected, rowKey) {
7331
+ const isSelected = (row) => selected.some((r) => getValue(r, rowKey) === getValue(row, rowKey));
7332
+ const all = rows.length > 0 && rows.every(isSelected);
7333
+ return { isSelected, all, some: rows.some(isSelected) && !all };
7334
+ }
7335
+ var toggleSelectedRow = (selected, row, rowKey) => selected.some((r) => getValue(r, rowKey) === getValue(row, rowKey)) ? selected.filter((r) => getValue(r, rowKey) !== getValue(row, rowKey)) : [...selected, row];
7336
+ var toggleAllRows = (rows, all) => all ? [] : [...rows];
7337
+ var toggleExpandedRow = (expanded, id, single) => expanded.includes(id) ? expanded.filter((v) => v !== id) : [...single ? [] : expanded, id];
7338
+
7339
+ // shared/package-runtime/table.ts
7316
7340
  function useTableModel(props) {
7317
7341
  var _a;
7318
7342
  const {
@@ -7332,17 +7356,9 @@ function useTableModel(props) {
7332
7356
  }), [internalExpanded, setExpanded] = (0, import_react60.useState)([]), [search, setSearch] = (0, import_react60.useState)(""), timer = (0, import_react60.useRef)(void 0);
7333
7357
  (0, import_react60.useEffect)(() => () => clearTimeout(timer.current), []);
7334
7358
  const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
7335
- const rows = sortable && sortMode !== "server" && sort.key ? [...data].sort((a, b) => {
7336
- const x = getValue(a, sort.key), y = getValue(b, sort.key);
7337
- const order = x === y ? 0 : typeof x === "number" && typeof y === "number" ? x > y ? 1 : -1 : String(x) > String(y) ? 1 : -1;
7338
- return sort.order === "asc" ? order : -order;
7339
- }) : data;
7340
- const key = (row, index = 0) => {
7341
- var _a2;
7342
- return (_a2 = getValue(row, rowKey)) != null ? _a2 : index;
7343
- };
7344
- const selectedRow = (row) => selected.some((r) => getValue(r, rowKey) === getValue(row, rowKey));
7345
- const all = rows.length > 0 && rows.every(selectedRow), some = rows.some(selectedRow) && !all, expanded = expandedRows != null ? expandedRows : internalExpanded;
7359
+ const rows = sortTableRows(data, sort, { sortable, sortMode });
7360
+ const key = (row, index = 0) => tableRowKey(row, rowKey, index);
7361
+ const { isSelected: selectedRow, all, some } = tableSelection(rows, selected, rowKey), expanded = expandedRows != null ? expandedRows : internalExpanded;
7346
7362
  return {
7347
7363
  rows,
7348
7364
  key,
@@ -7367,14 +7383,10 @@ function useTableModel(props) {
7367
7383
  if (props.sort === void 0) setSort(next);
7368
7384
  (_a2 = props.onSortChange) == null ? void 0 : _a2.call(props, next);
7369
7385
  },
7370
- toggleRow: (row) => onSelectionChange == null ? void 0 : onSelectionChange(
7371
- selectedRow(row) ? selected.filter(
7372
- (r) => getValue(r, rowKey) !== getValue(row, rowKey)
7373
- ) : [...selected, row]
7374
- ),
7375
- toggleAll: () => onSelectionChange == null ? void 0 : onSelectionChange(all ? [] : [...rows]),
7386
+ toggleRow: (row) => onSelectionChange == null ? void 0 : onSelectionChange(toggleSelectedRow(selected, row, rowKey)),
7387
+ toggleAll: () => onSelectionChange == null ? void 0 : onSelectionChange(toggleAllRows(rows, all)),
7376
7388
  toggleExpand: (row, index) => {
7377
- const id = key(row, index), next = expanded.includes(id) ? expanded.filter((v) => v !== id) : [...expandSingle ? [] : expanded, id];
7389
+ const next = toggleExpandedRow(expanded, key(row, index), expandSingle);
7378
7390
  setExpanded(next);
7379
7391
  onExpandedRowsChange == null ? void 0 : onExpandedRowsChange(next);
7380
7392
  }
@@ -9858,7 +9870,8 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
9858
9870
  };
9859
9871
  }, []);
9860
9872
  const surfaceBox = { position: "absolute", left: 0, right: 0, top: "50%", height: import_tokens61.tokens.input[size].height, marginTop: -import_tokens61.tokens.input[size].height / 2, borderRadius: surface.spec.radius };
9861
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_react_native62.View, { style: { flexDirection: "row", alignItems: "center", alignSelf: block ? "stretch" : "flex-start", maxWidth: "100%" }, children: [
9873
+ const hug = import_react_native62.Platform.OS === "web" && !block ? { width: "fit-content" } : {};
9874
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_react_native62.View, { style: { flexDirection: "row", alignItems: "center", alignSelf: block ? "stretch" : "flex-start", maxWidth: "100%", borderRadius: surface.spec.radius, ...hug }, children: [
9862
9875
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react_native62.View, { pointerEvents: "none", "aria-hidden": true, style: { ...surfaceBox, backgroundColor: colors.inputBg } }),
9863
9876
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(CompoundTarget, { square: true, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(KjunButton, { size, style: decreaseStyle, variant: "ghost", ariaLabel: "\uC218\uB7C9 \uC904\uC774\uAE30", disabled: blocked || value <= min, onPress: () => move(-1), prefixIcon: "minus" }) }),
9864
9877
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react_native62.View, { style: { flex: block ? 1 : void 0, width: block ? void 0 : geometry2.valueWidth, minWidth: 0, minHeight: finePointer() ? void 0 : import_tokens61.tokens.native.minimumTouchTarget, justifyContent: "center" }, ...fieldTarget(() => {
package/dist/index.web.js CHANGED
@@ -4241,7 +4241,7 @@ function KjunTooltip({
4241
4241
  }
4242
4242
  };
4243
4243
  return /* @__PURE__ */ jsxs16(Fragment6, { children: [
4244
- /* @__PURE__ */ jsx25(View20, { ref, collapsable: false, style: { alignSelf: "flex-start" }, children: child ? cloneElement3(child, handlers) : /* @__PURE__ */ jsx25(AccessiblePressable, { ...handlers, children }) }),
4244
+ /* @__PURE__ */ jsx25(View20, { ref, collapsable: false, style: { alignSelf: (childProps == null ? void 0 : childProps.block) ? "stretch" : "flex-start" }, children: child ? cloneElement3(child, handlers) : /* @__PURE__ */ jsx25(AccessiblePressable, { ...handlers, children }) }),
4245
4245
  /* @__PURE__ */ jsx25(
4246
4246
  FloatingPanel,
4247
4247
  {
@@ -7346,12 +7346,36 @@ function KjunSparkline({
7346
7346
  // shared/package-runtime/table.ts
7347
7347
  import { nextTableSort } from "@kjun-ui/tokens";
7348
7348
  import { useEffect as useEffect23, useRef as useRef33, useState as useState34 } from "react";
7349
+
7350
+ // shared/package-runtime/table-model.ts
7349
7351
  function getValue(row, key) {
7350
7352
  return key.split(".").reduce(
7351
7353
  (value, part) => value != null && typeof value === "object" ? value[part] : void 0,
7352
7354
  row
7353
7355
  );
7354
7356
  }
7357
+ function sortTableRows(data, sort, { sortable = true, sortMode = "client" }) {
7358
+ if (!sortable || sortMode === "server" || !sort.key) return data;
7359
+ return [...data].sort((a, b) => {
7360
+ const x = getValue(a, sort.key), y = getValue(b, sort.key);
7361
+ const order = x === y ? 0 : typeof x === "number" && typeof y === "number" ? x > y ? 1 : -1 : String(x) > String(y) ? 1 : -1;
7362
+ return sort.order === "asc" ? order : -order;
7363
+ });
7364
+ }
7365
+ var tableRowKey = (row, rowKey, index = 0) => {
7366
+ var _a;
7367
+ return (_a = getValue(row, rowKey)) != null ? _a : index;
7368
+ };
7369
+ function tableSelection(rows, selected, rowKey) {
7370
+ const isSelected = (row) => selected.some((r) => getValue(r, rowKey) === getValue(row, rowKey));
7371
+ const all = rows.length > 0 && rows.every(isSelected);
7372
+ return { isSelected, all, some: rows.some(isSelected) && !all };
7373
+ }
7374
+ var toggleSelectedRow = (selected, row, rowKey) => selected.some((r) => getValue(r, rowKey) === getValue(row, rowKey)) ? selected.filter((r) => getValue(r, rowKey) !== getValue(row, rowKey)) : [...selected, row];
7375
+ var toggleAllRows = (rows, all) => all ? [] : [...rows];
7376
+ var toggleExpandedRow = (expanded, id, single) => expanded.includes(id) ? expanded.filter((v) => v !== id) : [...single ? [] : expanded, id];
7377
+
7378
+ // shared/package-runtime/table.ts
7355
7379
  function useTableModel(props) {
7356
7380
  var _a;
7357
7381
  const {
@@ -7371,17 +7395,9 @@ function useTableModel(props) {
7371
7395
  }), [internalExpanded, setExpanded] = useState34([]), [search, setSearch] = useState34(""), timer = useRef33(void 0);
7372
7396
  useEffect23(() => () => clearTimeout(timer.current), []);
7373
7397
  const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
7374
- const rows = sortable && sortMode !== "server" && sort.key ? [...data].sort((a, b) => {
7375
- const x = getValue(a, sort.key), y = getValue(b, sort.key);
7376
- const order = x === y ? 0 : typeof x === "number" && typeof y === "number" ? x > y ? 1 : -1 : String(x) > String(y) ? 1 : -1;
7377
- return sort.order === "asc" ? order : -order;
7378
- }) : data;
7379
- const key = (row, index = 0) => {
7380
- var _a2;
7381
- return (_a2 = getValue(row, rowKey)) != null ? _a2 : index;
7382
- };
7383
- const selectedRow = (row) => selected.some((r) => getValue(r, rowKey) === getValue(row, rowKey));
7384
- const all = rows.length > 0 && rows.every(selectedRow), some = rows.some(selectedRow) && !all, expanded = expandedRows != null ? expandedRows : internalExpanded;
7398
+ const rows = sortTableRows(data, sort, { sortable, sortMode });
7399
+ const key = (row, index = 0) => tableRowKey(row, rowKey, index);
7400
+ const { isSelected: selectedRow, all, some } = tableSelection(rows, selected, rowKey), expanded = expandedRows != null ? expandedRows : internalExpanded;
7385
7401
  return {
7386
7402
  rows,
7387
7403
  key,
@@ -7406,14 +7422,10 @@ function useTableModel(props) {
7406
7422
  if (props.sort === void 0) setSort(next);
7407
7423
  (_a2 = props.onSortChange) == null ? void 0 : _a2.call(props, next);
7408
7424
  },
7409
- toggleRow: (row) => onSelectionChange == null ? void 0 : onSelectionChange(
7410
- selectedRow(row) ? selected.filter(
7411
- (r) => getValue(r, rowKey) !== getValue(row, rowKey)
7412
- ) : [...selected, row]
7413
- ),
7414
- toggleAll: () => onSelectionChange == null ? void 0 : onSelectionChange(all ? [] : [...rows]),
7425
+ toggleRow: (row) => onSelectionChange == null ? void 0 : onSelectionChange(toggleSelectedRow(selected, row, rowKey)),
7426
+ toggleAll: () => onSelectionChange == null ? void 0 : onSelectionChange(toggleAllRows(rows, all)),
7415
7427
  toggleExpand: (row, index) => {
7416
- const id = key(row, index), next = expanded.includes(id) ? expanded.filter((v) => v !== id) : [...expandSingle ? [] : expanded, id];
7428
+ const next = toggleExpandedRow(expanded, key(row, index), expandSingle);
7417
7429
  setExpanded(next);
7418
7430
  onExpandedRowsChange == null ? void 0 : onExpandedRowsChange(next);
7419
7431
  }
@@ -9909,7 +9921,8 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
9909
9921
  };
9910
9922
  }, []);
9911
9923
  const surfaceBox = { position: "absolute", left: 0, right: 0, top: "50%", height: tokens58.input[size].height, marginTop: -tokens58.input[size].height / 2, borderRadius: surface.spec.radius };
9912
- return /* @__PURE__ */ jsx59(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ jsxs46(View53, { style: { flexDirection: "row", alignItems: "center", alignSelf: block ? "stretch" : "flex-start", maxWidth: "100%" }, children: [
9924
+ const hug = Platform27.OS === "web" && !block ? { width: "fit-content" } : {};
9925
+ return /* @__PURE__ */ jsx59(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ jsxs46(View53, { style: { flexDirection: "row", alignItems: "center", alignSelf: block ? "stretch" : "flex-start", maxWidth: "100%", borderRadius: surface.spec.radius, ...hug }, children: [
9913
9926
  /* @__PURE__ */ jsx59(View53, { pointerEvents: "none", "aria-hidden": true, style: { ...surfaceBox, backgroundColor: colors.inputBg } }),
9914
9927
  /* @__PURE__ */ jsx59(CompoundTarget, { square: true, children: /* @__PURE__ */ jsx59(KjunButton, { size, style: decreaseStyle, variant: "ghost", ariaLabel: "\uC218\uB7C9 \uC904\uC774\uAE30", disabled: blocked || value <= min, onPress: () => move(-1), prefixIcon: "minus" }) }),
9915
9928
  /* @__PURE__ */ jsx59(View53, { style: { flex: block ? 1 : void 0, width: block ? void 0 : geometry2.valueWidth, minWidth: 0, minHeight: finePointer() ? void 0 : tokens58.native.minimumTouchTarget, justifyContent: "center" }, ...fieldTarget(() => {