@xonic0506/sonic-ui 0.6.0 → 0.6.1

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.
@@ -184,7 +184,7 @@ function Oe({ id: e, draggable: t, renderCells: n, ...r }) {
184
184
  });
185
185
  }
186
186
  function ke({ rows: t, getRowId: r, columns: a, "aria-label": o, sorting: s, defaultSorting: c = null, onSortingChange: l, selection: u, onSelectionChange: h, columnOrder: g, onColumnOrderChange: _, onRowOrderChange: y, loading: b, emptyState: C, errorState: w, pagination: T, className: ie }) {
187
- let E = u !== void 0 || h !== void 0, D = y !== void 0, O = _ !== void 0, [k, me] = L(s, c, l), [A, P] = L(u, [], h), [F, Te] = L(g, a.map(N), _), [ke, R] = L(T?.page, T?.defaultPage ?? 1, T?.onPageChange), [z, Ae] = L(T?.pageSize, T?.defaultPageSize ?? 20, T?.onPageSizeChange), B = T?.rowCount !== void 0, je = T ? Math.max(1, Math.ceil((B ? T.rowCount : t.length) / z)) : 1, V = Math.min(ke, je), H = v.useMemo(() => new Map(a.map((e) => [N(e), e])), [a]), Me = v.useMemo(() => {
187
+ let E = u !== void 0 || h !== void 0, D = y !== void 0, O = _ !== void 0, [k, me] = L(s, c, l), [A, P] = L(u, [], h), [F, Te] = L(g, a.map(N), _), [ke, R] = L(T?.page, T?.defaultPage ?? 1, T?.onPageChange), [z, Ae] = L(T?.pageSize, T?.defaultPageSize ?? 20, T?.onPageSizeChange), B = T?.rowCount !== void 0, je = T ? Math.max(1, Math.ceil((B ? T.rowCount : t.length) / z)) : 1, V = Math.min(ke, je), Me = v.useId(), H = v.useMemo(() => new Map(a.map((e) => [N(e), e])), [a]), Ne = v.useMemo(() => {
188
188
  let e = [];
189
189
  E && e.push({
190
190
  id: j,
@@ -214,7 +214,7 @@ function ke({ rows: t, getRowId: r, columns: a, "aria-label": o, sorting: s, def
214
214
  a,
215
215
  E,
216
216
  D
217
- ]), Ne = v.useMemo(() => ({
217
+ ]), Pe = v.useMemo(() => ({
218
218
  start: [
219
219
  ...E ? [j] : [],
220
220
  ...D ? [M] : [],
@@ -227,13 +227,13 @@ function ke({ rows: t, getRowId: r, columns: a, "aria-label": o, sorting: s, def
227
227
  D
228
228
  ]), U = ae({
229
229
  features: ye,
230
- columns: Me,
230
+ columns: Ne,
231
231
  data: t,
232
232
  getRowId: (e) => r(e),
233
233
  state: {
234
234
  sorting: k ? [k] : [],
235
235
  columnOrder: F,
236
- columnPinning: Ne,
236
+ columnPinning: Pe,
237
237
  pagination: {
238
238
  pageIndex: V - 1,
239
239
  pageSize: T ? z : t.length
@@ -245,12 +245,12 @@ function ke({ rows: t, getRowId: r, columns: a, "aria-label": o, sorting: s, def
245
245
  ...U.getStartFlatHeaders(),
246
246
  ...U.getCenterFlatHeaders(),
247
247
  ...U.getEndFlatHeaders()
248
- ], G = U.getRowModel().rows, Pe = t.map(r), K = G.map((e) => e.id), q = U.getCenterFlatHeaders().map((e) => e.column.id), Fe = D && !k, J = v.useRef(null), Y = !T && G.length > ve, Ie = oe({
249
- count: Y ? G.length : 0,
250
- getScrollElement: () => J.current,
248
+ ], G = U.getRowModel().rows, Fe = t.map(r), K = G.map((e) => e.id), q = U.getCenterFlatHeaders().map((e) => e.column.id), Ie = D && !k, Le = v.useRef(null), J = !T && G.length > ve, Re = oe({
249
+ count: J ? G.length : 0,
250
+ getScrollElement: () => Le.current,
251
251
  estimateSize: () => 40,
252
252
  overscan: 8
253
- }), X = Y ? Ie.getVirtualItems() : null, Le = X ? X.map((e) => G[e.index]) : G, Re = X?.[0]?.start ?? 0, ze = X ? Ie.getTotalSize() - (X.at(-1)?.end ?? 0) : 0, Be = typeof document > "u" ? void 0 : document.body, Ve = fe(de(le, { activationConstraint: { distance: 4 } }), de(ce, { coordinateGetter: ge })), Z = Ce(Pe, (e) => y?.(e)), Q = Ce(q, (e) => Te([...F.filter((t) => !e.includes(t)), ...e])), He = (e) => {
253
+ }), Y = J ? Re.getVirtualItems() : null, ze = Y ? Y.map((e) => G[e.index]) : G, Be = Y?.[0]?.start ?? 0, X = Y ? Re.getTotalSize() - (Y.at(-1)?.end ?? 0) : 0, Ve = typeof document > "u" ? void 0 : document.body, He = fe(de(le, { activationConstraint: { distance: 4 } }), de(ce, { coordinateGetter: ge })), Z = Ce(Fe, (e) => y?.(e)), Q = Ce(q, (e) => Te([...F.filter((t) => !e.includes(t)), ...e])), Ue = (e) => {
254
254
  me(k?.id === e ? k.desc ? null : {
255
255
  id: e,
256
256
  desc: !0
@@ -258,7 +258,7 @@ function ke({ rows: t, getRowId: r, columns: a, "aria-label": o, sorting: s, def
258
258
  id: e,
259
259
  desc: !1
260
260
  }), T && V !== 1 && R(1);
261
- }, Ue = K.length > 0 && K.every((e) => A.includes(e)), We = !Ue && K.some((e) => A.includes(e)), Ge = (e) => P([...A.filter((e) => !K.includes(e)), ...e ? K : []]), Ke = (t) => {
261
+ }, We = K.length > 0 && K.every((e) => A.includes(e)), Ge = !We && K.some((e) => A.includes(e)), Ke = (e) => P([...A.filter((e) => !K.includes(e)), ...e ? K : []]), qe = (t) => {
262
262
  let { column: r } = t, i = r.id, a = r.getIsPinned(), o = a === "start" ? "left" : a === "end" ? "right" : void 0, s = {
263
263
  pinned: o,
264
264
  style: we(r, i === j || i === M || H.get(i)?.width !== void 0),
@@ -267,9 +267,9 @@ function ke({ rows: t, getRowId: r, columns: a, "aria-label": o, sorting: s, def
267
267
  if (i === j) return /* @__PURE__ */ x(p, {
268
268
  ...s,
269
269
  children: /* @__PURE__ */ x(n, {
270
- checked: Ue,
271
- indeterminate: We,
272
- onCheckedChange: Ge,
270
+ checked: We,
271
+ indeterminate: Ge,
272
+ onCheckedChange: Ke,
273
273
  children: /* @__PURE__ */ x("span", {
274
274
  className: "sn:sr-only",
275
275
  children: "모든 행 선택"
@@ -285,7 +285,7 @@ function ke({ rows: t, getRowId: r, columns: a, "aria-label": o, sorting: s, def
285
285
  }, i);
286
286
  let c = H.get(i), l = c.header ?? "", u = "sortable" in c && c.sortable ? {
287
287
  sort: k?.id === i ? k.desc ? "desc" : "asc" : "none",
288
- onSort: () => He(i)
288
+ onSort: () => Ue(i)
289
289
  } : {}, d = c.type === "actions" && !c.header ? /* @__PURE__ */ x("span", {
290
290
  className: "sn:sr-only",
291
291
  children: "동작"
@@ -304,20 +304,20 @@ function ke({ rows: t, getRowId: r, columns: a, "aria-label": o, sorting: s, def
304
304
  ...u,
305
305
  children: d
306
306
  }, i);
307
- }, qe = (e) => /* @__PURE__ */ x(m, { children: /* @__PURE__ */ x(f, {
307
+ }, Je = (e) => /* @__PURE__ */ x(m, { children: /* @__PURE__ */ x(f, {
308
308
  colSpan: W.length,
309
309
  className: "sn:h-auto sn:p-0",
310
310
  children: e
311
311
  }) }), $;
312
- return $ = w ? qe(w) : b ? Array.from({ length: 5 }, (e, t) => /* @__PURE__ */ x(m, { children: W.map((e) => /* @__PURE__ */ x(f, { children: e.column.id === j || e.column.id === M ? null : /* @__PURE__ */ x(i, {
312
+ return $ = w ? Je(w) : b ? Array.from({ length: 5 }, (e, t) => /* @__PURE__ */ x(m, { children: W.map((e) => /* @__PURE__ */ x(f, { children: e.column.id === j || e.column.id === M ? null : /* @__PURE__ */ x(i, {
313
313
  shape: "text",
314
314
  className: "sn:w-2/3"
315
- }) }, e.id)) }, t)) : G.length === 0 ? C ? qe(C) : null : /* @__PURE__ */ S(re, { children: [
316
- Re > 0 && /* @__PURE__ */ x("tr", {
315
+ }) }, e.id)) }, t)) : G.length === 0 ? C ? Je(C) : null : /* @__PURE__ */ S(re, { children: [
316
+ Be > 0 && /* @__PURE__ */ x("tr", {
317
317
  "aria-hidden": !0,
318
- style: { height: Re }
318
+ style: { height: Be }
319
319
  }),
320
- Le.map((t) => {
320
+ ze.map((t) => {
321
321
  let r = A.includes(t.id), i = Z.drop?.id === t.id ? xe[Z.drop.side] : void 0, a = [
322
322
  ...t.getStartVisibleCells(),
323
323
  ...t.getCenterVisibleCells(),
@@ -325,10 +325,10 @@ function ke({ rows: t, getRowId: r, columns: a, "aria-label": o, sorting: s, def
325
325
  ];
326
326
  return /* @__PURE__ */ x(Oe, {
327
327
  id: t.id,
328
- draggable: Fe,
328
+ draggable: Ie,
329
329
  selected: r,
330
330
  "aria-selected": E ? r : void 0,
331
- "aria-rowindex": Y ? t.index + 2 : void 0,
331
+ "aria-rowindex": J ? t.index + 2 : void 0,
332
332
  renderCells: (o) => a.map((a) => {
333
333
  let { column: s } = a, c = s.id, l = s.getIsPinned(), u = l === "start" ? "left" : l === "end" ? "right" : void 0, d = H.get(c), p;
334
334
  return p = c === j ? /* @__PURE__ */ x(n, {
@@ -348,25 +348,26 @@ function ke({ rows: t, getRowId: r, columns: a, "aria-label": o, sorting: s, def
348
348
  })
349
349
  }, t.id);
350
350
  }),
351
- ze > 0 && /* @__PURE__ */ x("tr", {
351
+ X > 0 && /* @__PURE__ */ x("tr", {
352
352
  "aria-hidden": !0,
353
- style: { height: ze }
353
+ style: { height: X }
354
354
  })
355
355
  ] }), /* @__PURE__ */ S("div", {
356
356
  className: e("sn:flex sn:w-full sn:flex-col sn:gap-4", ie),
357
357
  children: [/* @__PURE__ */ x("div", {
358
- ref: J,
359
- className: "sn:min-h-0 sn:w-full sn:flex-1 sn:overflow-auto",
358
+ ref: Le,
359
+ className: "sn:relative sn:min-h-0 sn:w-full sn:flex-1 sn:overflow-auto",
360
360
  children: /* @__PURE__ */ S("table", {
361
361
  "aria-label": o,
362
362
  "aria-busy": b || void 0,
363
- "aria-rowcount": Y ? G.length + 1 : void 0,
363
+ "aria-rowcount": J ? G.length + 1 : void 0,
364
364
  className: e(te, "sn:bg-surface"),
365
365
  children: [/* @__PURE__ */ x(se, {
366
- sensors: Ve,
366
+ id: `DndDescribedBy-${Me}-columns`,
367
+ sensors: He,
367
368
  collisionDetection: ue,
368
369
  accessibility: {
369
- container: Be,
370
+ container: Ve,
370
371
  announcements: I("열", () => q),
371
372
  screenReaderInstructions: Se
372
373
  },
@@ -376,13 +377,14 @@ function ke({ rows: t, getRowId: r, columns: a, "aria-label": o, sorting: s, def
376
377
  children: /* @__PURE__ */ x(ee, { children: /* @__PURE__ */ x(pe, {
377
378
  items: O ? q : [],
378
379
  strategy: he,
379
- children: /* @__PURE__ */ x(m, { children: W.map(Ke) })
380
+ children: /* @__PURE__ */ x(m, { children: W.map(qe) })
380
381
  }) })
381
382
  }), /* @__PURE__ */ x(se, {
382
- sensors: Ve,
383
+ id: `DndDescribedBy-${Me}-rows`,
384
+ sensors: He,
383
385
  collisionDetection: ue,
384
386
  accessibility: {
385
- container: Be,
387
+ container: Ve,
386
388
  announcements: I("행", () => K),
387
389
  screenReaderInstructions: Se
388
390
  },
@@ -390,7 +392,7 @@ function ke({ rows: t, getRowId: r, columns: a, "aria-label": o, sorting: s, def
390
392
  onDragEnd: Z.onDragEnd,
391
393
  onDragCancel: Z.onDragCancel,
392
394
  children: /* @__PURE__ */ x(pe, {
393
- items: Fe ? K : [],
395
+ items: Ie ? K : [],
394
396
  strategy: _e,
395
397
  children: /* @__PURE__ */ x(d, { children: $ })
396
398
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xonic0506/sonic-ui",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Figma-first personal design system (Base UI + Tailwind v4, prebuilt CSS)",
5
5
  "license": "MIT",
6
6
  "repository": {