asterui 0.12.22 → 0.12.23

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/index97.js CHANGED
@@ -3,57 +3,57 @@ import { useRef as o } from "react";
3
3
  import { useVirtualizer as S } from "./index110.js";
4
4
  function N({
5
5
  items: e,
6
- height: a,
6
+ height: u,
7
7
  itemHeight: i,
8
- renderItem: u,
9
- overscan: d = 5,
10
- className: f = "",
11
- innerClassName: h = "",
12
- itemClassName: p = "",
13
- width: m,
14
- gap: g = 0,
8
+ renderItem: d,
9
+ overscan: f = 5,
10
+ className: h = "",
11
+ innerClassName: p = "",
12
+ itemClassName: m = "",
13
+ width: g,
14
+ gap: s = 0,
15
15
  onScroll: x
16
16
  }) {
17
- const s = o(null), r = o(i), l = o(e);
18
- r.current = i, l.current = e;
19
- const c = S({
17
+ const l = o(null), r = o(i), c = o(e);
18
+ r.current = i, c.current = e;
19
+ const a = S({
20
20
  count: e.length,
21
- getScrollElement: () => s.current,
22
- estimateSize: (t) => (typeof r.current == "function" ? r.current(l.current[t], t) : r.current) + g,
23
- overscan: d
24
- }), y = c.getVirtualItems(), z = (t) => {
21
+ getScrollElement: () => l.current,
22
+ estimateSize: (t) => (typeof r.current == "function" ? r.current(c.current[t], t) : r.current) + s,
23
+ overscan: f
24
+ }), y = a.getVirtualItems(), z = (t) => {
25
25
  x?.(t.currentTarget.scrollTop);
26
26
  };
27
27
  return /* @__PURE__ */ n(
28
28
  "div",
29
29
  {
30
- ref: s,
31
- className: `overflow-auto ${f}`,
32
- style: { height: a, width: m },
30
+ ref: l,
31
+ className: `overflow-auto ${h}`,
32
+ style: { height: u, width: g },
33
33
  onScroll: z,
34
34
  children: /* @__PURE__ */ n(
35
35
  "div",
36
36
  {
37
- className: h,
37
+ className: p,
38
38
  style: {
39
- height: c.getTotalSize(),
39
+ height: a.getTotalSize(),
40
40
  width: "100%",
41
41
  position: "relative"
42
42
  },
43
43
  children: y.map((t) => /* @__PURE__ */ n(
44
44
  "div",
45
45
  {
46
- className: p,
46
+ className: m,
47
47
  "data-index": t.index,
48
48
  style: {
49
49
  position: "absolute",
50
50
  top: 0,
51
51
  left: 0,
52
52
  width: "100%",
53
- height: t.size,
53
+ height: t.size - s,
54
54
  transform: `translateY(${t.start}px)`
55
55
  },
56
- children: u(e[t.index], t.index)
56
+ children: d(e[t.index], t.index)
57
57
  },
58
58
  t.key
59
59
  ))
@@ -1 +1 @@
1
- {"version":3,"file":"index97.js","sources":["../src/components/VirtualList.tsx"],"sourcesContent":["import React, { useRef } from 'react'\nimport { useVirtualizer } from '@tanstack/react-virtual'\n\nexport interface VirtualListProps<T> {\n /** Array of items to render */\n items: T[]\n /** Height of the scrollable container */\n height: number | string\n /** Height of each item, or function returning estimated height per item */\n itemHeight: number | ((item: T, index: number) => number)\n /** Render function for each item */\n renderItem: (item: T, index: number) => React.ReactNode\n /** Number of items to render outside visible area */\n overscan?: number\n /** Additional class for the scroll container */\n className?: string\n /** Additional class for the inner container */\n innerClassName?: string\n /** Additional class for each item wrapper */\n itemClassName?: string\n /** Width of the container */\n width?: number | string\n /** Gap between items */\n gap?: number\n /** Callback when scroll position changes */\n onScroll?: (scrollTop: number) => void\n}\n\nexport function VirtualList<T>({\n items,\n height,\n itemHeight,\n renderItem,\n overscan = 5,\n className = '',\n innerClassName = '',\n itemClassName = '',\n width,\n gap = 0,\n onScroll,\n}: VirtualListProps<T>) {\n const parentRef = useRef<HTMLDivElement>(null)\n const itemHeightRef = useRef(itemHeight)\n const itemsRef = useRef(items)\n itemHeightRef.current = itemHeight\n itemsRef.current = items\n\n const virtualizer = useVirtualizer({\n count: items.length,\n getScrollElement: () => parentRef.current,\n estimateSize: (index) => {\n const h = typeof itemHeightRef.current === 'function'\n ? itemHeightRef.current(itemsRef.current[index], index)\n : itemHeightRef.current\n return h + gap\n },\n overscan,\n })\n\n const virtualItems = virtualizer.getVirtualItems()\n\n const handleScroll = (e: React.UIEvent<HTMLDivElement>) => {\n onScroll?.(e.currentTarget.scrollTop)\n }\n\n return (\n <div\n ref={parentRef}\n className={`overflow-auto ${className}`}\n style={{ height, width }}\n onScroll={handleScroll}\n >\n <div\n className={innerClassName}\n style={{\n height: virtualizer.getTotalSize(),\n width: '100%',\n position: 'relative',\n }}\n >\n {virtualItems.map((virtualItem) => (\n <div\n key={virtualItem.key}\n className={itemClassName}\n data-index={virtualItem.index}\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: virtualItem.size,\n transform: `translateY(${virtualItem.start}px)`,\n }}\n >\n {renderItem(items[virtualItem.index], virtualItem.index)}\n </div>\n ))}\n </div>\n </div>\n )\n}\n\nVirtualList.displayName = 'VirtualList'\n"],"names":["VirtualList","items","height","itemHeight","renderItem","overscan","className","innerClassName","itemClassName","width","gap","onScroll","parentRef","useRef","itemHeightRef","itemsRef","virtualizer","useVirtualizer","index","virtualItems","handleScroll","e","jsx","virtualItem"],"mappings":";;;AA4BO,SAASA,EAAe;AAAA,EAC7B,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,WAAAC,IAAY;AAAA,EACZ,gBAAAC,IAAiB;AAAA,EACjB,eAAAC,IAAgB;AAAA,EAChB,OAAAC;AAAA,EACA,KAAAC,IAAM;AAAA,EACN,UAAAC;AACF,GAAwB;AACtB,QAAMC,IAAYC,EAAuB,IAAI,GACvCC,IAAgBD,EAAOV,CAAU,GACjCY,IAAWF,EAAOZ,CAAK;AAC7B,EAAAa,EAAc,UAAUX,GACxBY,EAAS,UAAUd;AAEnB,QAAMe,IAAcC,EAAe;AAAA,IACjC,OAAOhB,EAAM;AAAA,IACb,kBAAkB,MAAMW,EAAU;AAAA,IAClC,cAAc,CAACM,OACH,OAAOJ,EAAc,WAAY,aACvCA,EAAc,QAAQC,EAAS,QAAQG,CAAK,GAAGA,CAAK,IACpDJ,EAAc,WACPJ;AAAA,IAEb,UAAAL;AAAA,EAAA,CACD,GAEKc,IAAeH,EAAY,gBAAA,GAE3BI,IAAe,CAACC,MAAqC;AACzD,IAAAV,IAAWU,EAAE,cAAc,SAAS;AAAA,EACtC;AAEA,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAKV;AAAA,MACL,WAAW,iBAAiBN,CAAS;AAAA,MACrC,OAAO,EAAE,QAAAJ,GAAQ,OAAAO,EAAA;AAAA,MACjB,UAAUW;AAAA,MAEV,UAAA,gBAAAE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAWf;AAAA,UACX,OAAO;AAAA,YACL,QAAQS,EAAY,aAAA;AAAA,YACpB,OAAO;AAAA,YACP,UAAU;AAAA,UAAA;AAAA,UAGX,UAAAG,EAAa,IAAI,CAACI,MACjB,gBAAAD;AAAA,YAAC;AAAA,YAAA;AAAA,cAEC,WAAWd;AAAA,cACX,cAAYe,EAAY;AAAA,cACxB,OAAO;AAAA,gBACL,UAAU;AAAA,gBACV,KAAK;AAAA,gBACL,MAAM;AAAA,gBACN,OAAO;AAAA,gBACP,QAAQA,EAAY;AAAA,gBACpB,WAAW,cAAcA,EAAY,KAAK;AAAA,cAAA;AAAA,cAG3C,YAAWtB,EAAMsB,EAAY,KAAK,GAAGA,EAAY,KAAK;AAAA,YAAA;AAAA,YAZlDA,EAAY;AAAA,UAAA,CAcpB;AAAA,QAAA;AAAA,MAAA;AAAA,IACH;AAAA,EAAA;AAGN;AAEAvB,EAAY,cAAc;"}
1
+ {"version":3,"file":"index97.js","sources":["../src/components/VirtualList.tsx"],"sourcesContent":["import React, { useRef } from 'react'\nimport { useVirtualizer } from '@tanstack/react-virtual'\n\nexport interface VirtualListProps<T> {\n /** Array of items to render */\n items: T[]\n /** Height of the scrollable container */\n height: number | string\n /** Height of each item, or function returning estimated height per item */\n itemHeight: number | ((item: T, index: number) => number)\n /** Render function for each item */\n renderItem: (item: T, index: number) => React.ReactNode\n /** Number of items to render outside visible area */\n overscan?: number\n /** Additional class for the scroll container */\n className?: string\n /** Additional class for the inner container */\n innerClassName?: string\n /** Additional class for each item wrapper */\n itemClassName?: string\n /** Width of the container */\n width?: number | string\n /** Gap between items */\n gap?: number\n /** Callback when scroll position changes */\n onScroll?: (scrollTop: number) => void\n}\n\nexport function VirtualList<T>({\n items,\n height,\n itemHeight,\n renderItem,\n overscan = 5,\n className = '',\n innerClassName = '',\n itemClassName = '',\n width,\n gap = 0,\n onScroll,\n}: VirtualListProps<T>) {\n const parentRef = useRef<HTMLDivElement>(null)\n const itemHeightRef = useRef(itemHeight)\n const itemsRef = useRef(items)\n itemHeightRef.current = itemHeight\n itemsRef.current = items\n\n const virtualizer = useVirtualizer({\n count: items.length,\n getScrollElement: () => parentRef.current,\n estimateSize: (index) => {\n const h = typeof itemHeightRef.current === 'function'\n ? itemHeightRef.current(itemsRef.current[index], index)\n : itemHeightRef.current\n return h + gap\n },\n overscan,\n })\n\n const virtualItems = virtualizer.getVirtualItems()\n\n const handleScroll = (e: React.UIEvent<HTMLDivElement>) => {\n onScroll?.(e.currentTarget.scrollTop)\n }\n\n return (\n <div\n ref={parentRef}\n className={`overflow-auto ${className}`}\n style={{ height, width }}\n onScroll={handleScroll}\n >\n <div\n className={innerClassName}\n style={{\n height: virtualizer.getTotalSize(),\n width: '100%',\n position: 'relative',\n }}\n >\n {virtualItems.map((virtualItem) => (\n <div\n key={virtualItem.key}\n className={itemClassName}\n data-index={virtualItem.index}\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: virtualItem.size - gap,\n transform: `translateY(${virtualItem.start}px)`,\n }}\n >\n {renderItem(items[virtualItem.index], virtualItem.index)}\n </div>\n ))}\n </div>\n </div>\n )\n}\n\nVirtualList.displayName = 'VirtualList'\n"],"names":["VirtualList","items","height","itemHeight","renderItem","overscan","className","innerClassName","itemClassName","width","gap","onScroll","parentRef","useRef","itemHeightRef","itemsRef","virtualizer","useVirtualizer","index","virtualItems","handleScroll","e","jsx","virtualItem"],"mappings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AAAA,gBACL,UAAU;AAAA,gBACV,KAAK;AAAA,gBACL,MAAM;AAAA,gBACN,OAAO;AAAA,gBACP,QAAQA,EAAY,OAAOb;AAAA,gBAC3B,WAAW,cAAca,EAAY,KAAK;AAAA,cAAA;AAAA,cAG3C,YAAWtB,EAAMsB,EAAY,KAAK,GAAGA,EAAY,KAAK;AAAA,YAAA;AAAA,YAZlDA,EAAY;AAAA,UAAA,CAcpB;AAAA,QAAA;AAAA,MAAA;AAAA,IACH;AAAA,EAAA;AAGN;AAEAvB,EAAY,cAAc;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asterui",
3
- "version": "0.12.22",
3
+ "version": "0.12.23",
4
4
  "description": "React UI component library with DaisyUI",
5
5
  "homepage": "https://asterui.com",
6
6
  "repository": {