asterui 0.12.20 → 0.12.22
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/components/VirtualList.d.ts +29 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +46 -44
- package/dist/index.js.map +1 -1
- package/dist/index10.js +1 -1
- package/dist/index100.js +32 -5
- package/dist/index100.js.map +1 -1
- package/dist/index101.js +5 -13
- package/dist/index101.js.map +1 -1
- package/dist/index102.js +11 -43
- package/dist/index102.js.map +1 -1
- package/dist/index103.js +44 -11
- package/dist/index103.js.map +1 -1
- package/dist/index104.js +10 -12
- package/dist/index104.js.map +1 -1
- package/dist/index105.js +14 -7
- package/dist/index105.js.map +1 -1
- package/dist/index106.js +7 -12
- package/dist/index106.js.map +1 -1
- package/dist/index107.js +11 -29
- package/dist/index107.js.map +1 -1
- package/dist/index108.js +29 -16
- package/dist/index108.js.map +1 -1
- package/dist/index109.js +21 -0
- package/dist/index109.js.map +1 -0
- package/dist/index11.js +14 -14
- package/dist/index110.js +36 -0
- package/dist/index110.js.map +1 -0
- package/dist/index111.js +523 -0
- package/dist/index111.js.map +1 -0
- package/dist/index112.js +53 -0
- package/dist/index112.js.map +1 -0
- package/dist/index20.js +8 -8
- package/dist/index23.js +13 -13
- package/dist/index28.js +2 -2
- package/dist/index36.js +5 -5
- package/dist/index40.js +6 -6
- package/dist/index41.js +30 -30
- package/dist/index45.js +5 -5
- package/dist/index47.js +15 -15
- package/dist/index51.js +18 -18
- package/dist/index51.js.map +1 -1
- package/dist/index55.js +4 -4
- package/dist/index55.js.map +1 -1
- package/dist/index58.js +22 -22
- package/dist/index60.js +3 -3
- package/dist/index60.js.map +1 -1
- package/dist/index62.js +12 -12
- package/dist/index64.js +13 -13
- package/dist/index68.js +12 -12
- package/dist/index71.js +19 -19
- package/dist/index76.js +2 -2
- package/dist/index77.js +21 -21
- package/dist/index8.js +18 -18
- package/dist/index80.js +13 -13
- package/dist/index82.js +23 -23
- package/dist/index88.js +2 -2
- package/dist/index97.js +61 -121
- package/dist/index97.js.map +1 -1
- package/dist/index98.js +126 -14
- package/dist/index98.js.map +1 -1
- package/dist/index99.js +12 -31
- package/dist/index99.js.map +1 -1
- package/package.json +6 -1
package/dist/index51.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index51.js","sources":["../src/components/Masonry.tsx"],"sourcesContent":["import React, { useRef, useState, useLayoutEffect, useCallback } from 'react'\n\nexport interface MasonryProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n columns?:\n | number\n | {\n xs?: number\n sm?: number\n md?: number\n lg?: number\n xl?: number\n '2xl'?: number\n }\n gap?: number\n}\n\n// Tailwind breakpoints in pixels\nconst BREAKPOINTS = {\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n '2xl': 1536,\n}\n\nfunction getColumnsForWidth(\n columns: MasonryProps['columns'],\n width: number\n): number {\n if (typeof columns === 'number') {\n return columns\n }\n\n if (!columns) return 3\n\n // Find the appropriate column count for current width\n // Start from largest breakpoint and work down\n if (columns['2xl'] !== undefined && width >= BREAKPOINTS['2xl']) {\n return columns['2xl']\n }\n if (columns.xl !== undefined && width >= BREAKPOINTS.xl) {\n return columns.xl\n }\n if (columns.lg !== undefined && width >= BREAKPOINTS.lg) {\n return columns.lg\n }\n if (columns.md !== undefined && width >= BREAKPOINTS.md) {\n return columns.md\n }\n if (columns.sm !== undefined && width >= BREAKPOINTS.sm) {\n return columns.sm\n }\n if (columns.xs !== undefined) {\n return columns.xs\n }\n\n // Default fallback\n return 3\n}\n\nexport const Masonry: React.FC<MasonryProps> = ({\n children,\n columns = 3,\n gap = 16,\n className = '',\n style,\n ...rest\n}) => {\n const containerRef = useRef<HTMLDivElement>(null)\n const [positions, setPositions] = useState<\n Array<{ left: number; top: number }>\n >([])\n const [containerHeight, setContainerHeight] = useState(0)\n const itemRefs = useRef<(HTMLDivElement | null)[]>([])\n\n const childArray = React.Children.toArray(children)\n\n const calculateLayout = useCallback(() => {\n const container = containerRef.current\n if (!container || childArray.length === 0) return\n\n const containerWidth = container.offsetWidth\n // Use viewport width for responsive breakpoints (matches Tailwind behavior)\n const viewportWidth = typeof window !== 'undefined' ? window.innerWidth : containerWidth\n const numColumns = getColumnsForWidth(columns, viewportWidth)\n const columnWidth = (containerWidth - gap * (numColumns - 1)) / numColumns\n\n // Track height of each column\n const columnHeights = new Array(numColumns).fill(0)\n const newPositions: Array<{ left: number; top: number }> = []\n\n // Place each item in the shortest column\n childArray.forEach((_, index) => {\n const itemEl = itemRefs.current[index]\n if (!itemEl) return\n\n // Find shortest column\n let shortestColumn = 0\n let minHeight = columnHeights[0]\n for (let i = 1; i < numColumns; i++) {\n if (columnHeights[i] < minHeight) {\n minHeight = columnHeights[i]\n shortestColumn = i\n }\n }\n\n // Calculate position\n const left = shortestColumn * (columnWidth + gap)\n const top = columnHeights[shortestColumn]\n\n newPositions[index] = { left, top }\n\n // Update column height\n const itemHeight = itemEl.offsetHeight\n columnHeights[shortestColumn] += itemHeight + gap\n })\n\n setPositions(newPositions)\n setContainerHeight(Math.max(...columnHeights) - gap)\n }, [children, columns, gap, childArray.length])\n\n // Calculate layout after render and on resize\n useLayoutEffect(() => {\n calculateLayout()\n\n const handleResize = () => {\n calculateLayout()\n }\n\n window.addEventListener('resize', handleResize)\n return () => window.removeEventListener('resize', handleResize)\n }, [calculateLayout])\n\n // Recalculate when children change\n useLayoutEffect(() => {\n // Small delay to ensure refs are populated\n const timer = setTimeout(calculateLayout, 0)\n return () => clearTimeout(timer)\n }, [children, calculateLayout])\n\n const containerWidth = containerRef.current?.offsetWidth ?? 0\n const viewportWidth = typeof window !== 'undefined' ? window.innerWidth : containerWidth\n const numColumns = getColumnsForWidth(columns, viewportWidth)\n const columnWidth =\n containerWidth > 0\n ? (containerWidth - gap * (numColumns - 1)) / numColumns\n : 0\n\n return (\n <div\n ref={containerRef}\n className={className}\n style={{\n position: 'relative',\n height: containerHeight > 0 ? containerHeight : undefined,\n ...style,\n }}\n {...rest}\n >\n {childArray.map((child, index) => (\n <div\n key={index}\n ref={(el) => {\n itemRefs.current[index] = el\n }}\n style={{\n position: positions.length > 0 ? 'absolute' : 'relative',\n left: positions[index]?.left ?? 0,\n top: positions[index]?.top ?? 0,\n width: columnWidth > 0 ? columnWidth : '100%',\n visibility: positions.length > 0 ? 'visible' : 'hidden',\n }}\n >\n {child}\n </div>\n ))}\n </div>\n )\n}\n\nMasonry.displayName = 'Masonry'\n\nexport default Masonry\n"],"names":["BREAKPOINTS","getColumnsForWidth","columns","width","Masonry","children","gap","className","style","rest","containerRef","useRef","positions","setPositions","useState","containerHeight","setContainerHeight","itemRefs","childArray","React","calculateLayout","useCallback","container","containerWidth","viewportWidth","numColumns","columnWidth","columnHeights","newPositions","index","itemEl","shortestColumn","minHeight","i","left","top","itemHeight","useLayoutEffect","handleResize","timer","jsx","child","el"],"mappings":";;AAkBA,MAAMA,IAAc;AAAA,EAClB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT;AAEA,SAASC,EACPC,GACAC,GACQ;AACR,SAAI,OAAOD,KAAY,WACdA,IAGJA,IAIDA,EAAQ,KAAK,MAAM,UAAaC,KAASH,EAAY,KAAK,IACrDE,EAAQ,KAAK,IAElBA,EAAQ,OAAO,UAAaC,KAASH,EAAY,KAC5CE,EAAQ,KAEbA,EAAQ,OAAO,UAAaC,KAASH,EAAY,KAC5CE,EAAQ,KAEbA,EAAQ,OAAO,UAAaC,KAASH,EAAY,KAC5CE,EAAQ,KAEbA,EAAQ,OAAO,UAAaC,KAASH,EAAY,KAC5CE,EAAQ,KAEbA,EAAQ,OAAO,SACVA,EAAQ,KAIV,IAxBc;AAyBvB;AAEO,MAAME,IAAkC,CAAC;AAAA,EAC9C,UAAAC;AAAA,EACA,SAAAH,IAAU;AAAA,EACV,KAAAI,IAAM;AAAA,EACN,WAAAC,IAAY;AAAA,EACZ,OAAAC;AAAA,EACA,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAeC,EAAuB,IAAI,GAC1C,CAACC,GAAWC,CAAY,IAAIC,EAEhC,CAAA,CAAE,GACE,CAACC,GAAiBC,CAAkB,IAAIF,EAAS,CAAC,GAClDG,IAAWN,EAAkC,EAAE,GAE/CO,IAAaC,EAAM,SAAS,QAAQd,CAAQ,GAE5Ce,IAAkBC,EAAY,MAAM;AACxC,UAAMC,IAAYZ,EAAa;AAC/B,QAAI,CAACY,KAAaJ,EAAW,WAAW,EAAG;AAE3C,UAAMK,IAAiBD,EAAU,aAE3BE,IAAgB,OAAO,SAAW,MAAc,OAAO,aAAaD,GACpEE,IAAaxB,EAAmBC,GAASsB,CAAa,GACtDE,KAAeH,IAAiBjB,KAAOmB,IAAa,MAAMA,GAG1DE,IAAgB,IAAI,MAAMF,CAAU,EAAE,KAAK,CAAC,GAC5CG,IAAqD,CAAA;AAG3D,IAAAV,EAAW,QAAQ,
|
|
1
|
+
{"version":3,"file":"index51.js","sources":["../src/components/Masonry.tsx"],"sourcesContent":["import React, { useRef, useState, useLayoutEffect, useCallback } from 'react'\n\nexport interface MasonryProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n columns?:\n | number\n | {\n xs?: number\n sm?: number\n md?: number\n lg?: number\n xl?: number\n '2xl'?: number\n }\n gap?: number\n}\n\n// Tailwind breakpoints in pixels\nconst BREAKPOINTS = {\n sm: 640,\n md: 768,\n lg: 1024,\n xl: 1280,\n '2xl': 1536,\n}\n\nfunction getColumnsForWidth(\n columns: MasonryProps['columns'],\n width: number\n): number {\n if (typeof columns === 'number') {\n return columns\n }\n\n if (!columns) return 3\n\n // Find the appropriate column count for current width\n // Start from largest breakpoint and work down\n if (columns['2xl'] !== undefined && width >= BREAKPOINTS['2xl']) {\n return columns['2xl']\n }\n if (columns.xl !== undefined && width >= BREAKPOINTS.xl) {\n return columns.xl\n }\n if (columns.lg !== undefined && width >= BREAKPOINTS.lg) {\n return columns.lg\n }\n if (columns.md !== undefined && width >= BREAKPOINTS.md) {\n return columns.md\n }\n if (columns.sm !== undefined && width >= BREAKPOINTS.sm) {\n return columns.sm\n }\n if (columns.xs !== undefined) {\n return columns.xs\n }\n\n // Default fallback\n return 3\n}\n\nexport const Masonry: React.FC<MasonryProps> = ({\n children,\n columns = 3,\n gap = 16,\n className = '',\n style,\n ...rest\n}) => {\n const containerRef = useRef<HTMLDivElement>(null)\n const [positions, setPositions] = useState<\n Array<{ left: number; top: number }>\n >([])\n const [containerHeight, setContainerHeight] = useState(0)\n const itemRefs = useRef<(HTMLDivElement | null)[]>([])\n\n const childArray = React.Children.toArray(children)\n\n const calculateLayout = useCallback(() => {\n const container = containerRef.current\n if (!container || childArray.length === 0) return\n\n const containerWidth = container.offsetWidth\n // Use viewport width for responsive breakpoints (matches Tailwind behavior)\n const viewportWidth = typeof window !== 'undefined' ? window.innerWidth : containerWidth\n const numColumns = getColumnsForWidth(columns, viewportWidth)\n const columnWidth = (containerWidth - gap * (numColumns - 1)) / numColumns\n\n // Track height of each column\n const columnHeights = new Array(numColumns).fill(0)\n const newPositions: Array<{ left: number; top: number }> = []\n\n // Place each item in the shortest column\n childArray.forEach((_, index) => {\n const itemEl = itemRefs.current[index]\n if (!itemEl) return\n\n // Find shortest column\n let shortestColumn = 0\n let minHeight = columnHeights[0]\n for (let i = 1; i < numColumns; i++) {\n if (columnHeights[i] < minHeight) {\n minHeight = columnHeights[i]\n shortestColumn = i\n }\n }\n\n // Calculate position\n const left = shortestColumn * (columnWidth + gap)\n const top = columnHeights[shortestColumn]\n\n newPositions[index] = { left, top }\n\n // Update column height\n const itemHeight = itemEl.offsetHeight\n columnHeights[shortestColumn] += itemHeight + gap\n })\n\n setPositions(newPositions)\n setContainerHeight(Math.max(...columnHeights) - gap)\n }, [children, columns, gap, childArray.length])\n\n // Calculate layout after render and on resize\n useLayoutEffect(() => {\n calculateLayout()\n\n const handleResize = () => {\n calculateLayout()\n }\n\n window.addEventListener('resize', handleResize)\n return () => window.removeEventListener('resize', handleResize)\n }, [calculateLayout])\n\n // Recalculate when children change\n useLayoutEffect(() => {\n // Small delay to ensure refs are populated\n const timer = setTimeout(calculateLayout, 0)\n return () => clearTimeout(timer)\n }, [children, calculateLayout])\n\n const containerWidth = containerRef.current?.offsetWidth ?? 0\n const viewportWidth = typeof window !== 'undefined' ? window.innerWidth : containerWidth\n const numColumns = getColumnsForWidth(columns, viewportWidth)\n const columnWidth =\n containerWidth > 0\n ? (containerWidth - gap * (numColumns - 1)) / numColumns\n : 0\n\n return (\n <div\n ref={containerRef}\n className={className}\n style={{\n position: 'relative',\n height: containerHeight > 0 ? containerHeight : undefined,\n ...style,\n }}\n {...rest}\n >\n {childArray.map((child, index) => (\n <div\n key={index}\n ref={(el) => {\n itemRefs.current[index] = el\n }}\n style={{\n position: positions.length > 0 ? 'absolute' : 'relative',\n left: positions[index]?.left ?? 0,\n top: positions[index]?.top ?? 0,\n width: columnWidth > 0 ? columnWidth : '100%',\n visibility: positions.length > 0 ? 'visible' : 'hidden',\n }}\n >\n {child}\n </div>\n ))}\n </div>\n )\n}\n\nMasonry.displayName = 'Masonry'\n\nexport default Masonry\n"],"names":["BREAKPOINTS","getColumnsForWidth","columns","width","Masonry","children","gap","className","style","rest","containerRef","useRef","positions","setPositions","useState","containerHeight","setContainerHeight","itemRefs","childArray","React","calculateLayout","useCallback","container","containerWidth","viewportWidth","numColumns","columnWidth","columnHeights","newPositions","_","index","itemEl","shortestColumn","minHeight","i","left","top","itemHeight","useLayoutEffect","handleResize","timer","jsx","child","el"],"mappings":";;AAkBA,MAAMA,IAAc;AAAA,EAClB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,OAAO;AACT;AAEA,SAASC,EACPC,GACAC,GACQ;AACR,SAAI,OAAOD,KAAY,WACdA,IAGJA,IAIDA,EAAQ,KAAK,MAAM,UAAaC,KAASH,EAAY,KAAK,IACrDE,EA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;AAAA,QAAA;AAAA,UAEC,KAAK,CAACE,MAAO;AACX,YAAA1B,EAAS,QAAQa,CAAK,IAAIa;AAAA,UAC5B;AAAA,UACA,OAAO;AAAA,YACL,UAAU/B,EAAU,SAAS,IAAI,aAAa;AAAA,YAC9C,MAAMA,EAAUkB,CAAK,GAAG,QAAQ;AAAA,YAChC,KAAKlB,EAAUkB,CAAK,GAAG,OAAO;AAAA,YAC9B,OAAOJ,IAAc,IAAIA,IAAc;AAAA,YACvC,YAAYd,EAAU,SAAS,IAAI,YAAY;AAAA,UAAA;AAAA,UAGhD,UAAA8B;AAAA,QAAA;AAAA,QAZIZ;AAAA,MAAA,CAcR;AAAA,IAAA;AAAA,EAAA;AAGP;AAEA1B,EAAQ,cAAc;"}
|
package/dist/index55.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as l, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import p from "react";
|
|
3
|
-
import { CopyButton as
|
|
4
|
-
const
|
|
3
|
+
import { CopyButton as a } from "./index10.js";
|
|
4
|
+
const c = ({
|
|
5
5
|
children: e,
|
|
6
6
|
prefix: o = "$",
|
|
7
7
|
highlight: t = !1,
|
|
@@ -41,7 +41,7 @@ const a = ({
|
|
|
41
41
|
children: [
|
|
42
42
|
e,
|
|
43
43
|
s !== null && /* @__PURE__ */ r("div", { style: { position: "absolute", top: 8, right: 8 }, children: /* @__PURE__ */ r(
|
|
44
|
-
|
|
44
|
+
a,
|
|
45
45
|
{
|
|
46
46
|
text: s,
|
|
47
47
|
size: "xs",
|
|
@@ -53,7 +53,7 @@ const a = ({
|
|
|
53
53
|
}
|
|
54
54
|
);
|
|
55
55
|
};
|
|
56
|
-
f.Line =
|
|
56
|
+
f.Line = c;
|
|
57
57
|
export {
|
|
58
58
|
f as Code
|
|
59
59
|
};
|
package/dist/index55.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index55.js","sources":["../src/components/Code.tsx"],"sourcesContent":["import React from 'react'\nimport { CopyButton } from './CopyButton'\n\nexport interface CodeLineProps extends React.HTMLAttributes<HTMLPreElement> {\n children: React.ReactNode\n prefix?: string\n highlight?: boolean\n}\n\nconst Line: React.FC<CodeLineProps> = ({\n children,\n prefix = '$',\n highlight = false,\n className = '',\n ...rest\n}) => {\n return (\n <pre\n data-prefix={prefix}\n className={`${highlight ? 'bg-warning text-warning-content' : ''} ${className}`}\n {...rest}\n >\n <code>{children}</code>\n </pre>\n )\n}\n\nexport interface CodeProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n /** Show copy button. Pass true to auto-extract text, or a string to specify custom copy text */\n copyable?: boolean | string\n}\n\nconst extractTextFromChildren = (children: React.ReactNode): string => {\n const lines: string[] = []\n React.Children.forEach(children, (child) => {\n if (React.isValidElement(child) && child.props?.children) {\n const text = typeof child.props.children === 'string'\n ? child.props.children\n : ''\n if (text) lines.push(text)\n }\n })\n return lines.join('\\n')\n}\n\nexport const Code: React.FC<CodeProps> & { Line: typeof Line } = ({\n children,\n className = '',\n copyable,\n style,\n ...rest\n}) => {\n const copyText = typeof copyable === 'string'\n ? copyable\n : copyable\n ? extractTextFromChildren(children)\n : null\n\n return (\n <div\n className={`mockup-code ${className}`}\n style={{ position: 'relative', overflow: 'hidden', ...style }}\n {...rest}\n >\n {children}\n {copyText !== null && (\n <div style={{ position: 'absolute', top: 8, right: 8 }}>\n <CopyButton\n text={copyText}\n size=\"xs\"\n variant=\"ghost\"\n showTooltip\n />\n </div>\n )}\n </div>\n )\n}\n\nCode.Line = Line\n"],"names":["Line","children","prefix","highlight","className","rest","jsx","extractTextFromChildren","lines","React","child","text","Code","copyable","style","copyText","jsxs","CopyButton"],"mappings":";;;AASA,MAAMA,IAAgC,CAAC;AAAA,EACrC,UAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,WAAAC,IAAY;AAAA,EACZ,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,MAEI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,eAAaJ;AAAA,IACb,WAAW,GAAGC,IAAY,oCAAoC,EAAE,IAAIC,CAAS;AAAA,IAC5E,GAAGC;AAAA,IAEJ,UAAA,gBAAAC,EAAC,UAAM,UAAAL,EAAA,CAAS;AAAA,EAAA;AAAA,GAWhBM,IAA0B,CAACN,MAAsC;AACrE,QAAMO,IAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"index55.js","sources":["../src/components/Code.tsx"],"sourcesContent":["import React from 'react'\nimport { CopyButton } from './CopyButton'\n\nexport interface CodeLineProps extends React.HTMLAttributes<HTMLPreElement> {\n children: React.ReactNode\n prefix?: string\n highlight?: boolean\n}\n\nconst Line: React.FC<CodeLineProps> = ({\n children,\n prefix = '$',\n highlight = false,\n className = '',\n ...rest\n}) => {\n return (\n <pre\n data-prefix={prefix}\n className={`${highlight ? 'bg-warning text-warning-content' : ''} ${className}`}\n {...rest}\n >\n <code>{children}</code>\n </pre>\n )\n}\n\nexport interface CodeProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n /** Show copy button. Pass true to auto-extract text, or a string to specify custom copy text */\n copyable?: boolean | string\n}\n\nconst extractTextFromChildren = (children: React.ReactNode): string => {\n const lines: string[] = []\n React.Children.forEach(children, (child) => {\n if (React.isValidElement<{ children?: React.ReactNode }>(child) && child.props?.children) {\n const text = typeof child.props.children === 'string'\n ? child.props.children\n : ''\n if (text) lines.push(text)\n }\n })\n return lines.join('\\n')\n}\n\nexport const Code: React.FC<CodeProps> & { Line: typeof Line } = ({\n children,\n className = '',\n copyable,\n style,\n ...rest\n}) => {\n const copyText = typeof copyable === 'string'\n ? copyable\n : copyable\n ? extractTextFromChildren(children)\n : null\n\n return (\n <div\n className={`mockup-code ${className}`}\n style={{ position: 'relative', overflow: 'hidden', ...style }}\n {...rest}\n >\n {children}\n {copyText !== null && (\n <div style={{ position: 'absolute', top: 8, right: 8 }}>\n <CopyButton\n text={copyText}\n size=\"xs\"\n variant=\"ghost\"\n showTooltip\n />\n </div>\n )}\n </div>\n )\n}\n\nCode.Line = Line\n"],"names":["Line","children","prefix","highlight","className","rest","jsx","extractTextFromChildren","lines","React","child","text","Code","copyable","style","copyText","jsxs","CopyButton"],"mappings":";;;AASA,MAAMA,IAAgC,CAAC;AAAA,EACrC,UAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,WAAAC,IAAY;AAAA,EACZ,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,MAEI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,eAAaJ;AAAA,IACb,WAAW,GAAGC,IAAY,oCAAoC,EAAE,IAAIC,CAAS;AAAA,IAC5E,GAAGC;AAAA,IAEJ,UAAA,gBAAAC,EAAC,UAAM,UAAAL,EAAA,CAAS;AAAA,EAAA;AAAA,GAWhBM,IAA0B,CAACN,MAAsC;AACrE,QAAMO,IAAkB,CAAA;AACxBC,SAAAA,EAAM,SAAS,QAAQR,GAAU,CAACS,MAAU;AAC1C,QAAID,EAAM,eAA+CC,CAAK,KAAKA,EAAM,OAAO,UAAU;AACxF,YAAMC,IAAO,OAAOD,EAAM,MAAM,YAAa,WACzCA,EAAM,MAAM,WACZ;AACJ,MAAIC,KAAMH,EAAM,KAAKG,CAAI;AAAA,IAC3B;AAAA,EACF,CAAC,GACMH,EAAM,KAAK;AAAA,CAAI;AACxB,GAEaI,IAAoD,CAAC;AAAA,EAChE,UAAAX;AAAA,EACA,WAAAG,IAAY;AAAA,EACZ,UAAAS;AAAA,EACA,OAAAC;AAAA,EACA,GAAGT;AACL,MAAM;AACJ,QAAMU,IAAW,OAAOF,KAAa,WACjCA,IACAA,IACEN,EAAwBN,CAAQ,IAChC;AAEN,SACE,gBAAAe;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,eAAeZ,CAAS;AAAA,MACnC,OAAO,EAAE,UAAU,YAAY,UAAU,UAAU,GAAGU,EAAA;AAAA,MACrD,GAAGT;AAAA,MAEH,UAAA;AAAA,QAAAJ;AAAA,QACAc,MAAa,QACZ,gBAAAT,EAAC,OAAA,EAAI,OAAO,EAAE,UAAU,YAAY,KAAK,GAAG,OAAO,EAAA,GACjD,UAAA,gBAAAA;AAAA,UAACW;AAAA,UAAA;AAAA,YACC,MAAMF;AAAA,YACN,MAAK;AAAA,YACL,SAAQ;AAAA,YACR,aAAW;AAAA,UAAA;AAAA,QAAA,EACb,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;AAEAH,EAAK,OAAOZ;"}
|
package/dist/index58.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsxs as m, jsx as t, Fragment as
|
|
1
|
+
import { jsxs as m, jsx as t, Fragment as U } from "react/jsx-runtime";
|
|
2
2
|
import M, { useRef as f, useId as I, useEffect as S } from "react";
|
|
3
|
-
import { createRoot as
|
|
3
|
+
import { createRoot as V } from "react-dom/client";
|
|
4
4
|
function u({
|
|
5
5
|
children: e,
|
|
6
6
|
title: r,
|
|
@@ -83,10 +83,10 @@ function u({
|
|
|
83
83
|
middle: "2xl:modal-middle",
|
|
84
84
|
bottom: "2xl:modal-bottom"
|
|
85
85
|
}
|
|
86
|
-
},
|
|
86
|
+
}, _ = {
|
|
87
87
|
start: "modal-start",
|
|
88
88
|
end: "modal-end"
|
|
89
|
-
},
|
|
89
|
+
}, F = [
|
|
90
90
|
"modal",
|
|
91
91
|
...(() => {
|
|
92
92
|
if (C)
|
|
@@ -100,9 +100,9 @@ function u({
|
|
|
100
100
|
z && o.push(P[x][z]);
|
|
101
101
|
return o;
|
|
102
102
|
})(),
|
|
103
|
-
b &&
|
|
103
|
+
b && _[b],
|
|
104
104
|
D
|
|
105
|
-
].filter(Boolean).join(" "),
|
|
105
|
+
].filter(Boolean).join(" "), H = async () => {
|
|
106
106
|
if (a) {
|
|
107
107
|
B(!0);
|
|
108
108
|
try {
|
|
@@ -111,41 +111,41 @@ function u({
|
|
|
111
111
|
throw B(!1), o;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
},
|
|
114
|
+
}, q = () => {
|
|
115
115
|
h && v && v();
|
|
116
|
-
},
|
|
116
|
+
}, G = i ? { width: typeof i == "number" ? `${i}px` : i, maxWidth: "90vw" } : {}, J = !s && (a || d), Q = s != null;
|
|
117
117
|
return /* @__PURE__ */ m(
|
|
118
118
|
"dialog",
|
|
119
119
|
{
|
|
120
120
|
ref: N,
|
|
121
121
|
role: A ? "alertdialog" : "dialog",
|
|
122
122
|
"aria-modal": "true",
|
|
123
|
-
className:
|
|
123
|
+
className: F,
|
|
124
124
|
"data-state": l ? "open" : "closed",
|
|
125
125
|
"aria-labelledby": r ? $ : void 0,
|
|
126
126
|
"aria-describedby": E,
|
|
127
127
|
...K,
|
|
128
128
|
children: [
|
|
129
|
-
/* @__PURE__ */ m("div", { className: "modal-box", style:
|
|
129
|
+
/* @__PURE__ */ m("div", { className: "modal-box", style: G, children: [
|
|
130
130
|
r && /* @__PURE__ */ t("h3", { id: $, className: "text-lg font-bold mb-4", children: r }),
|
|
131
131
|
/* @__PURE__ */ t("div", { id: E, className: "py-4", children: e }),
|
|
132
|
-
|
|
132
|
+
J && /* @__PURE__ */ m("div", { className: "modal-action", children: [
|
|
133
133
|
d && /* @__PURE__ */ t("button", { ref: T, className: "btn", onClick: d, children: c }),
|
|
134
134
|
a && /* @__PURE__ */ t(
|
|
135
135
|
"button",
|
|
136
136
|
{
|
|
137
137
|
ref: R,
|
|
138
138
|
className: `btn btn-primary ${L ? "loading" : ""}`,
|
|
139
|
-
onClick:
|
|
139
|
+
onClick: H,
|
|
140
140
|
disabled: L,
|
|
141
141
|
"aria-busy": L || void 0,
|
|
142
142
|
children: y
|
|
143
143
|
}
|
|
144
144
|
)
|
|
145
145
|
] }),
|
|
146
|
-
|
|
146
|
+
Q && /* @__PURE__ */ t("div", { className: "modal-action", children: s })
|
|
147
147
|
] }),
|
|
148
|
-
p && h && /* @__PURE__ */ t("form", { method: "dialog", className: "modal-backdrop", children: /* @__PURE__ */ t("button", { ref: j, onClick:
|
|
148
|
+
p && h && /* @__PURE__ */ t("form", { method: "dialog", className: "modal-backdrop", children: /* @__PURE__ */ t("button", { ref: j, onClick: q, children: /* @__PURE__ */ t("span", { className: "sr-only", children: "Close modal" }) }) })
|
|
149
149
|
]
|
|
150
150
|
}
|
|
151
151
|
);
|
|
@@ -153,7 +153,7 @@ function u({
|
|
|
153
153
|
function w(e) {
|
|
154
154
|
const r = document.createElement("div");
|
|
155
155
|
document.body.appendChild(r);
|
|
156
|
-
const s =
|
|
156
|
+
const s = V(r), l = () => {
|
|
157
157
|
s.unmount(), r.parentNode && r.parentNode.removeChild(r);
|
|
158
158
|
}, a = () => {
|
|
159
159
|
const [d, y] = M.useState(!0), [c, h] = M.useState(!1), p = () => {
|
|
@@ -280,7 +280,7 @@ function w(e) {
|
|
|
280
280
|
] }) : e.title,
|
|
281
281
|
okText: e.okText,
|
|
282
282
|
cancelText: e.cancelText,
|
|
283
|
-
footer: e.showCancel ? /* @__PURE__ */ m(
|
|
283
|
+
footer: e.showCancel ? /* @__PURE__ */ m(U, { children: [
|
|
284
284
|
/* @__PURE__ */ t("button", { className: "btn", onClick: b, children: e.cancelText || "Cancel" }),
|
|
285
285
|
/* @__PURE__ */ t(
|
|
286
286
|
"button",
|
|
@@ -311,13 +311,13 @@ function w(e) {
|
|
|
311
311
|
destroy: l
|
|
312
312
|
};
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function X(e) {
|
|
315
315
|
return w({ ...e, showCancel: !0 });
|
|
316
316
|
}
|
|
317
|
-
function
|
|
317
|
+
function Y(e) {
|
|
318
318
|
return w({ ...e, type: "info", showCancel: !1 });
|
|
319
319
|
}
|
|
320
|
-
function
|
|
320
|
+
function Z(e) {
|
|
321
321
|
return w({ ...e, type: "success", showCancel: !1 });
|
|
322
322
|
}
|
|
323
323
|
function ee(e) {
|
|
@@ -326,9 +326,9 @@ function ee(e) {
|
|
|
326
326
|
function te(e) {
|
|
327
327
|
return w({ ...e, type: "error", showCancel: !1 });
|
|
328
328
|
}
|
|
329
|
-
u.confirm =
|
|
330
|
-
u.info =
|
|
331
|
-
u.success =
|
|
329
|
+
u.confirm = X;
|
|
330
|
+
u.info = Y;
|
|
331
|
+
u.success = Z;
|
|
332
332
|
u.warning = ee;
|
|
333
333
|
u.error = te;
|
|
334
334
|
export {
|
package/dist/index60.js
CHANGED
|
@@ -97,17 +97,17 @@ function b({ notification: e, onClose: t }) {
|
|
|
97
97
|
return /* @__PURE__ */ l(
|
|
98
98
|
"div",
|
|
99
99
|
{
|
|
100
|
-
className: `alert ${o[e.type]} shadow-lg cursor-pointer min-w-[300px] max-w-[400px]`,
|
|
100
|
+
className: `alert ${o[e.type]} shadow-lg cursor-pointer min-w-[300px] max-w-[400px] relative`,
|
|
101
101
|
onClick: s,
|
|
102
102
|
children: [
|
|
103
|
-
/* @__PURE__ */ l("div", { className: "
|
|
103
|
+
/* @__PURE__ */ l("div", { className: e.closable ? "pr-8" : "", children: [
|
|
104
104
|
e.message && /* @__PURE__ */ i("div", { className: "font-bold", children: e.message }),
|
|
105
105
|
e.description && /* @__PURE__ */ i("div", { className: "text-sm", children: e.description })
|
|
106
106
|
] }),
|
|
107
107
|
e.closable && /* @__PURE__ */ i(
|
|
108
108
|
"button",
|
|
109
109
|
{
|
|
110
|
-
className: "btn btn-
|
|
110
|
+
className: "btn btn-xs btn-ghost btn-circle absolute top-2 right-2",
|
|
111
111
|
onClick: (r) => {
|
|
112
112
|
r.stopPropagation(), t();
|
|
113
113
|
},
|
package/dist/index60.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index60.js","sources":["../src/components/Notification.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\nimport ReactDOM from 'react-dom/client'\n\nexport type NotificationType = 'success' | 'info' | 'warning' | 'error'\nexport type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight'\n\nexport interface NotificationConfig {\n message: React.ReactNode\n description?: React.ReactNode\n type?: NotificationType\n duration?: number // in seconds, 0 = no auto close\n placement?: NotificationPlacement\n closable?: boolean\n onClick?: () => void\n onClose?: () => void\n}\n\ninterface NotificationItem extends NotificationConfig {\n id: string\n createdAt: number\n}\n\ntype Listener = () => void\n\nclass NotificationManager {\n private notifications: NotificationItem[] = []\n private listeners: Listener[] = []\n private container: HTMLDivElement | null = null\n private root: ReactDOM.Root | null = null\n private idCounter = 0\n\n subscribe(listener: Listener) {\n this.listeners.push(listener)\n return () => {\n this.listeners = this.listeners.filter((l) => l !== listener)\n }\n }\n\n getNotifications() {\n return this.notifications\n }\n\n private emit() {\n this.listeners.forEach((listener) => listener())\n }\n\n private ensureContainer() {\n if (!this.container) {\n this.container = document.createElement('div')\n document.body.appendChild(this.container)\n this.root = ReactDOM.createRoot(this.container)\n this.root.render(<NotificationContainer manager={this} />)\n }\n }\n\n open(config: NotificationConfig) {\n this.ensureContainer()\n\n const id = `notification-${++this.idCounter}`\n const notification: NotificationItem = {\n ...config,\n id,\n createdAt: Date.now(),\n duration: config.duration ?? 4.5,\n placement: config.placement ?? 'topRight',\n closable: config.closable ?? true,\n type: config.type ?? 'info',\n }\n\n this.notifications.push(notification)\n this.emit()\n\n // Auto-dismiss\n if (notification.duration && notification.duration > 0) {\n setTimeout(() => {\n this.close(id)\n }, notification.duration * 1000)\n }\n\n return id\n }\n\n close(id: string) {\n const notification = this.notifications.find((n) => n.id === id)\n this.notifications = this.notifications.filter((n) => n.id !== id)\n this.emit()\n\n if (notification?.onClose) {\n notification.onClose()\n }\n }\n\n success(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'success' })\n }\n\n error(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'error' })\n }\n\n info(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'info' })\n }\n\n warning(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'warning' })\n }\n\n destroy() {\n this.notifications = []\n this.emit()\n }\n}\n\ninterface NotificationContainerProps {\n manager: NotificationManager\n}\n\nfunction NotificationContainer({ manager }: NotificationContainerProps) {\n const [, forceUpdate] = useState({})\n\n useEffect(() => {\n const unsubscribe = manager.subscribe(() => {\n forceUpdate({})\n })\n return unsubscribe\n }, [manager])\n\n const notifications = manager.getNotifications()\n\n // Group by placement\n const grouped: Record<NotificationPlacement, NotificationItem[]> = {\n topLeft: [],\n topRight: [],\n bottomLeft: [],\n bottomRight: [],\n }\n\n notifications.forEach((notification) => {\n grouped[notification.placement!].push(notification)\n })\n\n const placementClasses: Record<NotificationPlacement, string> = {\n topRight: 'toast toast-top toast-end',\n topLeft: 'toast toast-top toast-start',\n bottomRight: 'toast toast-bottom toast-end',\n bottomLeft: 'toast toast-bottom toast-start',\n }\n\n return (\n <>\n {Object.entries(grouped).map(([placement, items]) => {\n if (items.length === 0) return null\n\n return (\n <div key={placement} className={placementClasses[placement as NotificationPlacement]}>\n {items.map((notification) => (\n <NotificationItem\n key={notification.id}\n notification={notification}\n onClose={() => manager.close(notification.id)}\n />\n ))}\n </div>\n )\n })}\n </>\n )\n}\n\ninterface NotificationItemProps {\n notification: NotificationItem\n onClose: () => void\n}\n\nfunction NotificationItem({ notification, onClose }: NotificationItemProps) {\n const alertTypeClasses: Record<NotificationType, string> = {\n success: 'alert-success',\n error: 'alert-error',\n info: 'alert-info',\n warning: 'alert-warning',\n }\n\n const handleClick = () => {\n if (notification.onClick) {\n notification.onClick()\n }\n }\n\n return (\n <div\n className={`alert ${alertTypeClasses[notification.type!]} shadow-lg cursor-pointer min-w-[300px] max-w-[400px]`}\n onClick={handleClick}\n >\n <div className
|
|
1
|
+
{"version":3,"file":"index60.js","sources":["../src/components/Notification.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\nimport ReactDOM from 'react-dom/client'\n\nexport type NotificationType = 'success' | 'info' | 'warning' | 'error'\nexport type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight'\n\nexport interface NotificationConfig {\n message: React.ReactNode\n description?: React.ReactNode\n type?: NotificationType\n duration?: number // in seconds, 0 = no auto close\n placement?: NotificationPlacement\n closable?: boolean\n onClick?: () => void\n onClose?: () => void\n}\n\ninterface NotificationItem extends NotificationConfig {\n id: string\n createdAt: number\n}\n\ntype Listener = () => void\n\nclass NotificationManager {\n private notifications: NotificationItem[] = []\n private listeners: Listener[] = []\n private container: HTMLDivElement | null = null\n private root: ReactDOM.Root | null = null\n private idCounter = 0\n\n subscribe(listener: Listener) {\n this.listeners.push(listener)\n return () => {\n this.listeners = this.listeners.filter((l) => l !== listener)\n }\n }\n\n getNotifications() {\n return this.notifications\n }\n\n private emit() {\n this.listeners.forEach((listener) => listener())\n }\n\n private ensureContainer() {\n if (!this.container) {\n this.container = document.createElement('div')\n document.body.appendChild(this.container)\n this.root = ReactDOM.createRoot(this.container)\n this.root.render(<NotificationContainer manager={this} />)\n }\n }\n\n open(config: NotificationConfig) {\n this.ensureContainer()\n\n const id = `notification-${++this.idCounter}`\n const notification: NotificationItem = {\n ...config,\n id,\n createdAt: Date.now(),\n duration: config.duration ?? 4.5,\n placement: config.placement ?? 'topRight',\n closable: config.closable ?? true,\n type: config.type ?? 'info',\n }\n\n this.notifications.push(notification)\n this.emit()\n\n // Auto-dismiss\n if (notification.duration && notification.duration > 0) {\n setTimeout(() => {\n this.close(id)\n }, notification.duration * 1000)\n }\n\n return id\n }\n\n close(id: string) {\n const notification = this.notifications.find((n) => n.id === id)\n this.notifications = this.notifications.filter((n) => n.id !== id)\n this.emit()\n\n if (notification?.onClose) {\n notification.onClose()\n }\n }\n\n success(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'success' })\n }\n\n error(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'error' })\n }\n\n info(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'info' })\n }\n\n warning(config: Omit<NotificationConfig, 'type'>) {\n return this.open({ ...config, type: 'warning' })\n }\n\n destroy() {\n this.notifications = []\n this.emit()\n }\n}\n\ninterface NotificationContainerProps {\n manager: NotificationManager\n}\n\nfunction NotificationContainer({ manager }: NotificationContainerProps) {\n const [, forceUpdate] = useState({})\n\n useEffect(() => {\n const unsubscribe = manager.subscribe(() => {\n forceUpdate({})\n })\n return unsubscribe\n }, [manager])\n\n const notifications = manager.getNotifications()\n\n // Group by placement\n const grouped: Record<NotificationPlacement, NotificationItem[]> = {\n topLeft: [],\n topRight: [],\n bottomLeft: [],\n bottomRight: [],\n }\n\n notifications.forEach((notification) => {\n grouped[notification.placement!].push(notification)\n })\n\n const placementClasses: Record<NotificationPlacement, string> = {\n topRight: 'toast toast-top toast-end',\n topLeft: 'toast toast-top toast-start',\n bottomRight: 'toast toast-bottom toast-end',\n bottomLeft: 'toast toast-bottom toast-start',\n }\n\n return (\n <>\n {Object.entries(grouped).map(([placement, items]) => {\n if (items.length === 0) return null\n\n return (\n <div key={placement} className={placementClasses[placement as NotificationPlacement]}>\n {items.map((notification) => (\n <NotificationItem\n key={notification.id}\n notification={notification}\n onClose={() => manager.close(notification.id)}\n />\n ))}\n </div>\n )\n })}\n </>\n )\n}\n\ninterface NotificationItemProps {\n notification: NotificationItem\n onClose: () => void\n}\n\nfunction NotificationItem({ notification, onClose }: NotificationItemProps) {\n const alertTypeClasses: Record<NotificationType, string> = {\n success: 'alert-success',\n error: 'alert-error',\n info: 'alert-info',\n warning: 'alert-warning',\n }\n\n const handleClick = () => {\n if (notification.onClick) {\n notification.onClick()\n }\n }\n\n return (\n <div\n className={`alert ${alertTypeClasses[notification.type!]} shadow-lg cursor-pointer min-w-[300px] max-w-[400px] relative`}\n onClick={handleClick}\n >\n <div className={notification.closable ? 'pr-8' : ''}>\n {notification.message && <div className=\"font-bold\">{notification.message}</div>}\n {notification.description && <div className=\"text-sm\">{notification.description}</div>}\n </div>\n {notification.closable && (\n <button\n className=\"btn btn-xs btn-ghost btn-circle absolute top-2 right-2\"\n onClick={(e) => {\n e.stopPropagation()\n onClose()\n }}\n >\n ✕\n </button>\n )}\n </div>\n )\n}\n\nexport const notification = new NotificationManager()\n"],"names":["NotificationManager","listener","l","ReactDOM","jsx","NotificationContainer","config","id","notification","n","manager","forceUpdate","useState","useEffect","notifications","grouped","placementClasses","Fragment","placement","items","NotificationItem","onClose","alertTypeClasses","handleClick","jsxs","e"],"mappings":";;;AAwBA,MAAMA,EAAoB;AAAA,EAChB,gBAAoC,CAAA;AAAA,EACpC,YAAwB,CAAA;AAAA,EACxB,YAAmC;AAAA,EACnC,OAA6B;AAAA,EAC7B,YAAY;AAAA,EAEpB,UAAUC,GAAoB;AAC5B,gBAAK,UAAU,KAAKA,CAAQ,GACrB,MAAM;AACX,WAAK,YAAY,KAAK,UAAU,OAAO,CAACC,MAAMA,MAAMD,CAAQ;AAAA,IAC9D;AAAA,EACF;AAAA,EAEA,mBAAmB;AACjB,WAAO,KAAK;AAAA,EACd;AAAA,EAEQ,OAAO;AACb,SAAK,UAAU,QAAQ,CAACA,MAAaA,GAAU;AAAA,EACjD;AAAA,EAEQ,kBAAkB;AACxB,IAAK,KAAK,cACR,KAAK,YAAY,SAAS,cAAc,KAAK,GAC7C,SAAS,KAAK,YAAY,KAAK,SAAS,GACxC,KAAK,OAAOE,EAAS,WAAW,KAAK,SAAS,GAC9C,KAAK,KAAK,OAAO,gBAAAC,EAACC,GAAA,EAAsB,SAAS,MAAM,CAAE;AAAA,EAE7D;AAAA,EAEA,KAAKC,GAA4B;AAC/B,SAAK,gBAAA;AAEL,UAAMC,IAAK,gBAAgB,EAAE,KAAK,SAAS,IACrCC,IAAiC;AAAA,MACrC,GAAGF;AAAA,MACH,IAAAC;AAAA,MACA,WAAW,KAAK,IAAA;AAAA,MAChB,UAAUD,EAAO,YAAY;AAAA,MAC7B,WAAWA,EAAO,aAAa;AAAA,MAC/B,UAAUA,EAAO,YAAY;AAAA,MAC7B,MAAMA,EAAO,QAAQ;AAAA,IAAA;AAGvB,gBAAK,cAAc,KAAKE,CAAY,GAC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,EAAa,YACZ,gBAAAJ;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAU;AAAA,YACV,SAAS,CAACqB,MAAM;AACd,cAAAA,EAAE,gBAAA,GACFJ,EAAA;AAAA,YACF;AAAA,YACD,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAED;AAAA,IAAA;AAAA,EAAA;AAIR;AAEO,MAAMb,IAAe,IAAIR,EAAA;"}
|
package/dist/index62.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as o, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import f from "react";
|
|
3
|
-
const
|
|
3
|
+
const R = ({
|
|
4
4
|
current: p,
|
|
5
5
|
defaultCurrent: P = 1,
|
|
6
6
|
total: m,
|
|
@@ -18,17 +18,17 @@ const q = ({
|
|
|
18
18
|
className: b = "",
|
|
19
19
|
...N
|
|
20
20
|
}) => {
|
|
21
|
-
const [w, v] = f.useState(P), [J,
|
|
21
|
+
const [w, v] = f.useState(P), [J, _] = f.useState(C), [x, $] = f.useState(""), t = p !== void 0 ? p : w, u = h !== void 0 ? h : J, n = Math.ceil(m / u), r = (e) => {
|
|
22
22
|
e < 1 || e > n || a || (p === void 0 && v(e), g?.(e, u));
|
|
23
|
-
},
|
|
23
|
+
}, D = (e) => {
|
|
24
24
|
const c = Math.ceil(m / e), s = t > c ? c : t;
|
|
25
|
-
h === void 0 &&
|
|
26
|
-
},
|
|
25
|
+
h === void 0 && _(e), p === void 0 && s !== t && v(s), k?.(s, e), g?.(s, e);
|
|
26
|
+
}, E = (e) => {
|
|
27
27
|
if (e.key === "Enter") {
|
|
28
28
|
const c = parseInt(x);
|
|
29
29
|
!isNaN(c) && c >= 1 && c <= n && (r(c), $(""));
|
|
30
30
|
}
|
|
31
|
-
},
|
|
31
|
+
}, F = () => {
|
|
32
32
|
const e = [];
|
|
33
33
|
if (n <= 7)
|
|
34
34
|
for (let s = 1; s <= n; s++)
|
|
@@ -53,7 +53,7 @@ const q = ({
|
|
|
53
53
|
sm: "btn-sm",
|
|
54
54
|
md: "",
|
|
55
55
|
lg: "btn-lg"
|
|
56
|
-
}[M],
|
|
56
|
+
}[M], G = [
|
|
57
57
|
(t - 1) * u + 1,
|
|
58
58
|
Math.min(t * u, m)
|
|
59
59
|
];
|
|
@@ -82,13 +82,13 @@ const q = ({
|
|
|
82
82
|
}
|
|
83
83
|
)
|
|
84
84
|
] }) : /* @__PURE__ */ o("div", { className: `flex flex-wrap items-center gap-4 ${b}`, ...N, children: [
|
|
85
|
-
d && /* @__PURE__ */ i("div", { className: "text-sm text-base-content/70", children: typeof d == "function" ? d(m,
|
|
85
|
+
d && /* @__PURE__ */ i("div", { className: "text-sm text-base-content/70", children: typeof d == "function" ? d(m, G) : `Total ${m} items` }),
|
|
86
86
|
y && /* @__PURE__ */ i(
|
|
87
87
|
"select",
|
|
88
88
|
{
|
|
89
89
|
className: `select select-bordered ${l}`,
|
|
90
90
|
value: u,
|
|
91
|
-
onChange: (e) =>
|
|
91
|
+
onChange: (e) => D(Number(e.target.value)),
|
|
92
92
|
disabled: a,
|
|
93
93
|
children: j.map((e) => /* @__PURE__ */ o("option", { value: e, children: [
|
|
94
94
|
e,
|
|
@@ -117,7 +117,7 @@ const q = ({
|
|
|
117
117
|
children: "‹"
|
|
118
118
|
}
|
|
119
119
|
),
|
|
120
|
-
|
|
120
|
+
F().map((e, c) => e === "ellipsis" ? /* @__PURE__ */ i("button", { className: `join-item btn btn-disabled ${l}`, children: "..." }, `ellipsis-${c}`) : /* @__PURE__ */ i(
|
|
121
121
|
"button",
|
|
122
122
|
{
|
|
123
123
|
className: `join-item btn ${l} ${t === e ? "btn-active" : ""}`,
|
|
@@ -159,7 +159,7 @@ const q = ({
|
|
|
159
159
|
max: n,
|
|
160
160
|
value: x,
|
|
161
161
|
onChange: (e) => $(e.target.value),
|
|
162
|
-
onKeyDown:
|
|
162
|
+
onKeyDown: E,
|
|
163
163
|
disabled: a,
|
|
164
164
|
placeholder: String(t)
|
|
165
165
|
}
|
|
@@ -168,6 +168,6 @@ const q = ({
|
|
|
168
168
|
] });
|
|
169
169
|
};
|
|
170
170
|
export {
|
|
171
|
-
|
|
171
|
+
R as Pagination
|
|
172
172
|
};
|
|
173
173
|
//# sourceMappingURL=index62.js.map
|
package/dist/index64.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
const
|
|
2
|
+
import A, { useState as g, useRef as h, useEffect as K } from "react";
|
|
3
|
+
const T = ({
|
|
4
4
|
children: c,
|
|
5
5
|
title: x,
|
|
6
6
|
description: d,
|
|
7
|
-
onConfirm:
|
|
7
|
+
onConfirm: f,
|
|
8
8
|
onCancel: v,
|
|
9
9
|
okText: C = "OK",
|
|
10
10
|
cancelText: w = "Cancel",
|
|
11
11
|
okType: N = "primary",
|
|
12
12
|
cancelType: k = "ghost",
|
|
13
|
-
placement:
|
|
13
|
+
placement: m = "top",
|
|
14
14
|
disabled: y = !1,
|
|
15
15
|
icon: p,
|
|
16
16
|
showCancel: L = !0,
|
|
@@ -18,7 +18,7 @@ const W = ({
|
|
|
18
18
|
...O
|
|
19
19
|
}) => {
|
|
20
20
|
const [a, o] = g(!1), [l, u] = g(!1), r = h(null), i = h(null);
|
|
21
|
-
|
|
21
|
+
K(() => {
|
|
22
22
|
const t = (s) => {
|
|
23
23
|
r.current && !r.current.contains(s.target) && i.current && !i.current.contains(s.target) && o(!1);
|
|
24
24
|
};
|
|
@@ -28,10 +28,10 @@ const W = ({
|
|
|
28
28
|
const j = (t) => {
|
|
29
29
|
y || (t.stopPropagation(), o(!a));
|
|
30
30
|
}, E = async () => {
|
|
31
|
-
if (
|
|
31
|
+
if (f) {
|
|
32
32
|
u(!0);
|
|
33
33
|
try {
|
|
34
|
-
await
|
|
34
|
+
await f(), o(!1);
|
|
35
35
|
} finally {
|
|
36
36
|
u(!1);
|
|
37
37
|
}
|
|
@@ -44,12 +44,12 @@ const W = ({
|
|
|
44
44
|
bottom: "top-full left-1/2 -translate-x-1/2 mt-3",
|
|
45
45
|
left: "right-full top-1/2 -translate-y-1/2 mr-3",
|
|
46
46
|
right: "left-full top-1/2 -translate-y-1/2 ml-3"
|
|
47
|
-
}[
|
|
47
|
+
}[m]}`, z = () => "bg-base-100 rounded-lg p-4 min-w-[200px] max-w-[300px] shadow-lg", B = () => `absolute w-2.5 h-2.5 bg-base-100 rotate-45 shadow-lg ${{
|
|
48
48
|
top: "bottom-[-5px] left-1/2 -translate-x-1/2",
|
|
49
49
|
bottom: "top-[-5px] left-1/2 -translate-x-1/2",
|
|
50
50
|
left: "right-[-5px] top-1/2 -translate-y-1/2",
|
|
51
51
|
right: "left-[-5px] top-1/2 -translate-y-1/2"
|
|
52
|
-
}[
|
|
52
|
+
}[m]}`, I = {
|
|
53
53
|
primary: "btn-primary",
|
|
54
54
|
secondary: "btn-secondary",
|
|
55
55
|
accent: "btn-accent",
|
|
@@ -58,7 +58,7 @@ const W = ({
|
|
|
58
58
|
error: "btn-error",
|
|
59
59
|
info: "btn-info",
|
|
60
60
|
ghost: "btn-ghost"
|
|
61
|
-
}, b = (t) => I[t],
|
|
61
|
+
}, b = (t) => I[t], _ = /* @__PURE__ */ e(
|
|
62
62
|
"svg",
|
|
63
63
|
{
|
|
64
64
|
className: "w-5 h-5 text-warning",
|
|
@@ -77,7 +77,7 @@ const W = ({
|
|
|
77
77
|
}
|
|
78
78
|
);
|
|
79
79
|
return /* @__PURE__ */ n("div", { ref: r, className: `relative inline-block ${$ || ""}`, "data-state": a ? "open" : "closed", ...O, children: [
|
|
80
|
-
|
|
80
|
+
A.cloneElement(c, {
|
|
81
81
|
onClick: (t) => {
|
|
82
82
|
j(t);
|
|
83
83
|
const s = c.props?.onClick;
|
|
@@ -86,7 +86,7 @@ const W = ({
|
|
|
86
86
|
}),
|
|
87
87
|
a && /* @__PURE__ */ e("div", { className: R(), children: /* @__PURE__ */ n("div", { ref: i, className: z(), children: [
|
|
88
88
|
/* @__PURE__ */ n("div", { className: "flex gap-3 relative z-10", children: [
|
|
89
|
-
/* @__PURE__ */ e("div", { className: "flex-shrink-0 mt-0.5", children: p !== void 0 ? p :
|
|
89
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0 mt-0.5", children: p !== void 0 ? p : _ }),
|
|
90
90
|
/* @__PURE__ */ n("div", { className: "flex-1", children: [
|
|
91
91
|
/* @__PURE__ */ e("div", { className: "font-semibold text-base-content mb-1", children: x }),
|
|
92
92
|
d && /* @__PURE__ */ e("div", { className: "text-sm text-base-content/70 mb-3", children: d }),
|
|
@@ -120,6 +120,6 @@ const W = ({
|
|
|
120
120
|
] });
|
|
121
121
|
};
|
|
122
122
|
export {
|
|
123
|
-
|
|
123
|
+
T as Popconfirm
|
|
124
124
|
};
|
|
125
125
|
//# sourceMappingURL=index64.js.map
|
package/dist/index68.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as r, jsxs as N } from "react/jsx-runtime";
|
|
2
2
|
import S, { forwardRef as b, useContext as G, createContext as V } from "react";
|
|
3
|
-
const
|
|
4
|
-
function w({ children: n, value: e, defaultValue: i, onChange: o, name: t, className:
|
|
5
|
-
const [
|
|
3
|
+
const f = V(null);
|
|
4
|
+
function w({ children: n, value: e, defaultValue: i, onChange: o, name: t, className: d = "" }) {
|
|
5
|
+
const [c, s] = S.useState(i), l = e !== void 0 ? e : c, u = (a) => {
|
|
6
6
|
e === void 0 && s(a), o?.({ target: { value: a, name: t } });
|
|
7
7
|
};
|
|
8
|
-
return /* @__PURE__ */ r(
|
|
8
|
+
return /* @__PURE__ */ r(f.Provider, { value: { value: l, onChange: u, name: t }, children: /* @__PURE__ */ r("div", { role: "radiogroup", className: d, children: n }) });
|
|
9
9
|
}
|
|
10
|
-
const
|
|
11
|
-
({ size: n, color: e, className: i = "", value: o, checked: t, onChange:
|
|
12
|
-
const a = G(
|
|
10
|
+
const g = b(
|
|
11
|
+
({ size: n, color: e, className: i = "", value: o, checked: t, onChange: d, name: c, children: s, ...l }, u) => {
|
|
12
|
+
const a = G(f), h = {
|
|
13
13
|
xs: "radio-xs",
|
|
14
14
|
sm: "radio-sm",
|
|
15
15
|
md: "radio-md",
|
|
@@ -29,8 +29,8 @@ const f = b(
|
|
|
29
29
|
const j = typeof o == "string" || typeof o == "number" ? o : String(o);
|
|
30
30
|
a.onChange?.(j);
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
}, R = a?.name ||
|
|
32
|
+
d?.(k);
|
|
33
|
+
}, R = a?.name || c, m = /* @__PURE__ */ r(
|
|
34
34
|
"input",
|
|
35
35
|
{
|
|
36
36
|
ref: u,
|
|
@@ -50,11 +50,11 @@ const f = b(
|
|
|
50
50
|
] }) : m;
|
|
51
51
|
}
|
|
52
52
|
);
|
|
53
|
-
|
|
54
|
-
const
|
|
53
|
+
g.displayName = "Radio";
|
|
54
|
+
const B = Object.assign(g, {
|
|
55
55
|
Group: w
|
|
56
56
|
});
|
|
57
57
|
export {
|
|
58
|
-
|
|
58
|
+
B as Radio
|
|
59
59
|
};
|
|
60
60
|
//# sourceMappingURL=index68.js.map
|
package/dist/index71.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsxs as G, Fragment as
|
|
2
|
-
import L, { useState as
|
|
3
|
-
const
|
|
1
|
+
import { jsxs as G, Fragment as F, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import L, { useState as _, useId as O, createContext as P, useContext as S } from "react";
|
|
3
|
+
const M = P(null);
|
|
4
4
|
function q({
|
|
5
5
|
children: n,
|
|
6
6
|
value: i,
|
|
@@ -11,16 +11,16 @@ function q({
|
|
|
11
11
|
size: e,
|
|
12
12
|
gap: l = "md",
|
|
13
13
|
color: o = "bg-warning",
|
|
14
|
-
mask:
|
|
15
|
-
allowClear:
|
|
14
|
+
mask: u = "star-2",
|
|
15
|
+
allowClear: h = !0,
|
|
16
16
|
allowHalf: s = !1,
|
|
17
17
|
disabled: m = !1,
|
|
18
18
|
className: f = "",
|
|
19
19
|
...C
|
|
20
20
|
}) {
|
|
21
|
-
const [j, R] =
|
|
21
|
+
const [j, R] = _(v), [p, k] = _(0), V = i !== void 0 ? i : j, N = O(), $ = (r) => {
|
|
22
22
|
if (m) return;
|
|
23
|
-
const a =
|
|
23
|
+
const a = h && r === V ? 0 : r;
|
|
24
24
|
i === void 0 && R(a), k(0), x?.(a);
|
|
25
25
|
}, I = (r) => {
|
|
26
26
|
m || (k(r), g?.(r));
|
|
@@ -30,20 +30,20 @@ function q({
|
|
|
30
30
|
md: "rating-md",
|
|
31
31
|
lg: "rating-lg",
|
|
32
32
|
xl: "rating-xl"
|
|
33
|
-
},
|
|
33
|
+
}, A = {
|
|
34
34
|
none: "gap-0",
|
|
35
35
|
xs: "gap-0.5",
|
|
36
36
|
sm: "gap-1",
|
|
37
37
|
md: "gap-2",
|
|
38
38
|
lg: "gap-3"
|
|
39
|
-
},
|
|
39
|
+
}, B = [
|
|
40
40
|
"rating",
|
|
41
41
|
// Half-star mode requires a size class to render correctly, default to md
|
|
42
42
|
s ? y[e || "md"] : e && y[e],
|
|
43
|
-
s ? "rating-half" : l &&
|
|
43
|
+
s ? "rating-half" : l && A[l],
|
|
44
44
|
f
|
|
45
|
-
].filter(Boolean).join(" "), b = s ? "star-2" :
|
|
46
|
-
|
|
45
|
+
].filter(Boolean).join(" "), b = s ? "star-2" : u, E = n || /* @__PURE__ */ G(F, { children: [
|
|
46
|
+
h && /* @__PURE__ */ t(c, { value: 0, hidden: !0 }),
|
|
47
47
|
s ? (
|
|
48
48
|
// Half-star mode: each star is two inputs
|
|
49
49
|
Array.from({ length: d }, (r, a) => /* @__PURE__ */ G(L.Fragment, { children: [
|
|
@@ -55,24 +55,24 @@ function q({
|
|
|
55
55
|
Array.from({ length: d }, (r, a) => /* @__PURE__ */ t(c, { value: a + 1, mask: b, color: o }, a + 1))
|
|
56
56
|
)
|
|
57
57
|
] });
|
|
58
|
-
return /* @__PURE__ */ t(
|
|
58
|
+
return /* @__PURE__ */ t(M.Provider, { value: { name: N, currentValue: V, hoverValue: p, onChange: $, onHover: I, size: e, disabled: m, halfGap: s ? l : void 0 }, children: /* @__PURE__ */ t(
|
|
59
59
|
"div",
|
|
60
60
|
{
|
|
61
61
|
role: "radiogroup",
|
|
62
62
|
"aria-label": "Rating",
|
|
63
|
-
className:
|
|
63
|
+
className: B,
|
|
64
64
|
"data-value": V,
|
|
65
65
|
onMouseLeave: () => I(0),
|
|
66
66
|
...C,
|
|
67
|
-
children:
|
|
67
|
+
children: E
|
|
68
68
|
}
|
|
69
69
|
) });
|
|
70
70
|
}
|
|
71
71
|
function c({ value: n, mask: i = "star-2", color: v = "bg-warning", hidden: x = !1, half: g, className: d = "" }) {
|
|
72
|
-
const e = S(
|
|
72
|
+
const e = S(M);
|
|
73
73
|
if (!e)
|
|
74
74
|
throw new Error("Rating.Item must be used within Rating");
|
|
75
|
-
const { name: l, currentValue: o, hoverValue:
|
|
75
|
+
const { name: l, currentValue: o, hoverValue: u, onChange: h, onHover: s, disabled: m, halfGap: f } = e, C = {
|
|
76
76
|
star: "mask-star",
|
|
77
77
|
"star-2": "mask-star-2",
|
|
78
78
|
heart: "mask-heart"
|
|
@@ -101,7 +101,7 @@ function c({ value: n, mask: i = "star-2", color: v = "bg-warning", hidden: x =
|
|
|
101
101
|
"aria-label": `Rating ${n}`
|
|
102
102
|
}
|
|
103
103
|
);
|
|
104
|
-
const k =
|
|
104
|
+
const k = u > 0 ? u : o;
|
|
105
105
|
return /* @__PURE__ */ t(
|
|
106
106
|
"input",
|
|
107
107
|
{
|
|
@@ -111,7 +111,7 @@ function c({ value: n, mask: i = "star-2", color: v = "bg-warning", hidden: x =
|
|
|
111
111
|
checked: k === n,
|
|
112
112
|
onChange: () => {
|
|
113
113
|
},
|
|
114
|
-
onClick: () =>
|
|
114
|
+
onClick: () => h(n),
|
|
115
115
|
onMouseEnter: () => s(n),
|
|
116
116
|
"aria-label": `Rating ${n}`
|
|
117
117
|
}
|
package/dist/index76.js
CHANGED
|
@@ -19,7 +19,7 @@ const w = {
|
|
|
19
19
|
between: "justify-between",
|
|
20
20
|
around: "justify-around",
|
|
21
21
|
evenly: "justify-evenly"
|
|
22
|
-
},
|
|
22
|
+
}, k = ({
|
|
23
23
|
direction: f = "horizontal",
|
|
24
24
|
size: s = "md",
|
|
25
25
|
align: r,
|
|
@@ -56,6 +56,6 @@ const w = {
|
|
|
56
56
|
})() });
|
|
57
57
|
};
|
|
58
58
|
export {
|
|
59
|
-
|
|
59
|
+
k as Space
|
|
60
60
|
};
|
|
61
61
|
//# sourceMappingURL=index76.js.map
|