@lobehub/ui 5.19.3 → 5.20.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.
- package/es/Markdown/SyntaxMarkdown/CachedMarkdown.mjs +3 -2
- package/es/Markdown/SyntaxMarkdown/CachedMarkdown.mjs.map +1 -1
- package/es/Markdown/plugins/rehypeStreamAnimated.mjs.map +1 -1
- package/es/ThemeProvider/GlobalStyle/global.mjs +3 -2
- package/es/ThemeProvider/GlobalStyle/global.mjs.map +1 -1
- package/es/ThemeProvider/ThemeProvider.mjs +1 -1
- package/es/ThemeProvider/ThemeProvider.mjs.map +1 -1
- package/es/base-ui/AutoComplete/AutoComplete.d.mts +8 -0
- package/es/base-ui/AutoComplete/AutoComplete.mjs +91 -0
- package/es/base-ui/AutoComplete/AutoComplete.mjs.map +1 -0
- package/es/base-ui/AutoComplete/index.d.mts +3 -0
- package/es/base-ui/AutoComplete/style.d.mts +12 -0
- package/es/base-ui/AutoComplete/style.mjs +76 -0
- package/es/base-ui/AutoComplete/style.mjs.map +1 -0
- package/es/base-ui/AutoComplete/type.d.mts +40 -0
- package/es/base-ui/Button/style.mjs +6 -3
- package/es/base-ui/Button/style.mjs.map +1 -1
- package/es/base-ui/Checkbox/Checkbox.d.mts +8 -0
- package/es/base-ui/Checkbox/Checkbox.mjs +61 -0
- package/es/base-ui/Checkbox/Checkbox.mjs.map +1 -0
- package/es/base-ui/Checkbox/CheckboxGroup.d.mts +8 -0
- package/es/base-ui/Checkbox/CheckboxGroup.mjs +37 -0
- package/es/base-ui/Checkbox/CheckboxGroup.mjs.map +1 -0
- package/es/base-ui/Checkbox/index.d.mts +4 -0
- package/es/base-ui/Checkbox/style.d.mts +9 -0
- package/es/base-ui/Checkbox/style.mjs +70 -0
- package/es/base-ui/Checkbox/style.mjs.map +1 -0
- package/es/base-ui/Checkbox/type.d.mts +51 -0
- package/es/base-ui/Form/Form.mjs +155 -0
- package/es/base-ui/Form/Form.mjs.map +1 -0
- package/es/base-ui/Form/components/FormDivider.d.mts +8 -0
- package/es/base-ui/Form/components/FormDivider.mjs +19 -0
- package/es/base-ui/Form/components/FormDivider.mjs.map +1 -0
- package/es/base-ui/Form/components/FormField.d.mts +8 -0
- package/es/base-ui/Form/components/FormField.mjs +59 -0
- package/es/base-ui/Form/components/FormField.mjs.map +1 -0
- package/es/base-ui/Form/components/FormFlatGroup.d.mts +8 -0
- package/es/base-ui/Form/components/FormFlatGroup.mjs +20 -0
- package/es/base-ui/Form/components/FormFlatGroup.mjs.map +1 -0
- package/es/base-ui/Form/components/FormFooter.d.mts +8 -0
- package/es/base-ui/Form/components/FormFooter.mjs +20 -0
- package/es/base-ui/Form/components/FormFooter.mjs.map +1 -0
- package/es/base-ui/Form/components/FormGroup.d.mts +8 -0
- package/es/base-ui/Form/components/FormGroup.mjs +87 -0
- package/es/base-ui/Form/components/FormGroup.mjs.map +1 -0
- package/es/base-ui/Form/components/FormSubmitFooter.d.mts +8 -0
- package/es/base-ui/Form/components/FormSubmitFooter.mjs +118 -0
- package/es/base-ui/Form/components/FormSubmitFooter.mjs.map +1 -0
- package/es/base-ui/Form/components/FormTitle.d.mts +8 -0
- package/es/base-ui/Form/components/FormTitle.mjs +42 -0
- package/es/base-ui/Form/components/FormTitle.mjs.map +1 -0
- package/es/base-ui/Form/context.d.mts +6 -0
- package/es/base-ui/Form/context.mjs +15 -0
- package/es/base-ui/Form/context.mjs.map +1 -0
- package/es/base-ui/Form/index.d.mts +25 -0
- package/es/base-ui/Form/index.mjs +24 -0
- package/es/base-ui/Form/index.mjs.map +1 -0
- package/es/base-ui/Form/style.mjs +288 -0
- package/es/base-ui/Form/style.mjs.map +1 -0
- package/es/base-ui/Form/type.d.mts +139 -0
- package/es/base-ui/Input/Input.d.mts +8 -0
- package/es/base-ui/Input/Input.mjs +43 -0
- package/es/base-ui/Input/Input.mjs.map +1 -0
- package/es/base-ui/Input/InputNumber.d.mts +8 -0
- package/es/base-ui/Input/InputNumber.mjs +50 -0
- package/es/base-ui/Input/InputNumber.mjs.map +1 -0
- package/es/base-ui/Input/InputOTP.d.mts +8 -0
- package/es/base-ui/Input/InputOTP.mjs +31 -0
- package/es/base-ui/Input/InputOTP.mjs.map +1 -0
- package/es/base-ui/Input/InputPassword.d.mts +8 -0
- package/es/base-ui/Input/InputPassword.mjs +31 -0
- package/es/base-ui/Input/InputPassword.mjs.map +1 -0
- package/es/base-ui/Input/TextArea.d.mts +8 -0
- package/es/base-ui/Input/TextArea.mjs +43 -0
- package/es/base-ui/Input/TextArea.mjs.map +1 -0
- package/es/base-ui/Input/index.d.mts +7 -0
- package/es/base-ui/Input/style.d.mts +33 -0
- package/es/base-ui/Input/style.mjs +230 -0
- package/es/base-ui/Input/style.mjs.map +1 -0
- package/es/base-ui/Input/type.d.mts +122 -0
- package/es/base-ui/Select/style.mjs +4 -3
- package/es/base-ui/Select/style.mjs.map +1 -1
- package/es/base-ui/Slider/Slider.d.mts +8 -0
- package/es/base-ui/Slider/Slider.mjs +34 -0
- package/es/base-ui/Slider/Slider.mjs.map +1 -0
- package/es/base-ui/Slider/SliderWithInput.d.mts +8 -0
- package/es/base-ui/Slider/SliderWithInput.mjs +64 -0
- package/es/base-ui/Slider/SliderWithInput.mjs.map +1 -0
- package/es/base-ui/Slider/index.d.mts +4 -0
- package/es/base-ui/Slider/style.d.mts +11 -0
- package/es/base-ui/Slider/style.mjs +69 -0
- package/es/base-ui/Slider/style.mjs.map +1 -0
- package/es/base-ui/Slider/type.d.mts +47 -0
- package/es/base-ui/controlSize.d.mts +10 -0
- package/es/base-ui/controlSize.mjs +10 -0
- package/es/base-ui/controlSize.mjs.map +1 -0
- package/es/base-ui/index.d.mts +33 -4
- package/es/base-ui/index.mjs +28 -4
- package/es/eslint/index.mjs +25 -15
- package/es/eslint/index.mjs.map +1 -1
- package/es/node_modules/@types/hast/index.d.mts +642 -0
- package/package.json +4 -3
|
@@ -41,11 +41,12 @@ function post(tree, options) {
|
|
|
41
41
|
const urlTransform = options.urlTransform || defaultUrlTransform;
|
|
42
42
|
if (allowedElements && disallowedElements) throw new Error("Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other");
|
|
43
43
|
const transform = (node, index, parent) => {
|
|
44
|
-
|
|
44
|
+
const rawNode = node;
|
|
45
|
+
if (rawNode.type === "raw" && typeof rawNode.value === "string" && parent && typeof index === "number") {
|
|
45
46
|
if (skipHtml) parent.children.splice(index, 1);
|
|
46
47
|
else parent.children[index] = {
|
|
47
48
|
type: "text",
|
|
48
|
-
value:
|
|
49
|
+
value: rawNode.value
|
|
49
50
|
};
|
|
50
51
|
return index;
|
|
51
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CachedMarkdown.mjs","names":[],"sources":["../../../src/Markdown/SyntaxMarkdown/CachedMarkdown.tsx"],"sourcesContent":["'use client';\n\nimport { type Nodes, type Root } from 'hast';\nimport { toJsxRuntime } from 'hast-util-to-jsx-runtime';\nimport { urlAttributes } from 'html-url-attributes';\nimport { useMemo } from 'react';\nimport { Fragment, jsx, jsxs } from 'react/jsx-runtime';\nimport { defaultUrlTransform, type Options } from 'react-markdown';\nimport remarkParse from 'remark-parse';\nimport remarkRehype from 'remark-rehype';\nimport { type PluggableList, unified } from 'unified';\nimport { type BuildVisitor, visit } from 'unist-util-visit';\nimport { VFile } from 'vfile';\n\nconst EMPTY_PLUGINS: PluggableList = [];\nconst DEFAULT_REMARK_REHYPE_OPTIONS = { allowDangerousHtml: true };\n\n/**\n * Render-equivalent of react-markdown's synchronous `<Markdown>` that keeps\n * the unified processor across renders. react-markdown rebuilds the whole\n * plugin chain on every render; the streaming tail block re-renders on every\n * reveal commit (~20/s) with identical plugin identities, so caching the\n * processor removes the per-commit chain construction. `post`/`transform`\n * mirror react-markdown@10 — keep them in sync when upgrading it.\n */\nexport const CachedMarkdown = (options: Options) => {\n const { children, rehypePlugins, remarkPlugins, remarkRehypeOptions } = options;\n\n const processor = useMemo(() => {\n return unified()\n .use(remarkParse)\n .use(remarkPlugins || EMPTY_PLUGINS)\n .use(\n remarkRehype,\n remarkRehypeOptions\n ? { ...remarkRehypeOptions, ...DEFAULT_REMARK_REHYPE_OPTIONS }\n : DEFAULT_REMARK_REHYPE_OPTIONS,\n )\n .use(rehypePlugins || EMPTY_PLUGINS);\n }, [rehypePlugins, remarkPlugins, remarkRehypeOptions]);\n\n const file = new VFile();\n file.value = typeof children === 'string' ? children : '';\n\n return post(processor.runSync(processor.parse(file), file) as Nodes, options);\n};\n\nfunction post(tree: Nodes, options: Options) {\n const {\n allowedElements,\n allowElement,\n components,\n disallowedElements,\n skipHtml,\n unwrapDisallowed,\n } = options;\n const urlTransform = options.urlTransform || defaultUrlTransform;\n\n if (allowedElements && disallowedElements) {\n throw new Error(\n 'Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other',\n );\n }\n\n const transform: BuildVisitor<Root> = (node, index, parent) => {\n if (
|
|
1
|
+
{"version":3,"file":"CachedMarkdown.mjs","names":[],"sources":["../../../src/Markdown/SyntaxMarkdown/CachedMarkdown.tsx"],"sourcesContent":["'use client';\n\nimport { type Nodes, type Root } from 'hast';\nimport { toJsxRuntime } from 'hast-util-to-jsx-runtime';\nimport { urlAttributes } from 'html-url-attributes';\nimport { useMemo } from 'react';\nimport { Fragment, jsx, jsxs } from 'react/jsx-runtime';\nimport { defaultUrlTransform, type Options } from 'react-markdown';\nimport remarkParse from 'remark-parse';\nimport remarkRehype from 'remark-rehype';\nimport { type PluggableList, unified } from 'unified';\nimport { type BuildVisitor, visit } from 'unist-util-visit';\nimport { VFile } from 'vfile';\n\nconst EMPTY_PLUGINS: PluggableList = [];\nconst DEFAULT_REMARK_REHYPE_OPTIONS = { allowDangerousHtml: true };\n\n/**\n * Render-equivalent of react-markdown's synchronous `<Markdown>` that keeps\n * the unified processor across renders. react-markdown rebuilds the whole\n * plugin chain on every render; the streaming tail block re-renders on every\n * reveal commit (~20/s) with identical plugin identities, so caching the\n * processor removes the per-commit chain construction. `post`/`transform`\n * mirror react-markdown@10 — keep them in sync when upgrading it.\n */\nexport const CachedMarkdown = (options: Options) => {\n const { children, rehypePlugins, remarkPlugins, remarkRehypeOptions } = options;\n\n const processor = useMemo(() => {\n return unified()\n .use(remarkParse)\n .use(remarkPlugins || EMPTY_PLUGINS)\n .use(\n remarkRehype,\n remarkRehypeOptions\n ? { ...remarkRehypeOptions, ...DEFAULT_REMARK_REHYPE_OPTIONS }\n : DEFAULT_REMARK_REHYPE_OPTIONS,\n )\n .use(rehypePlugins || EMPTY_PLUGINS);\n }, [rehypePlugins, remarkPlugins, remarkRehypeOptions]);\n\n const file = new VFile();\n file.value = typeof children === 'string' ? children : '';\n\n return post(processor.runSync(processor.parse(file), file) as Nodes, options);\n};\n\nfunction post(tree: Nodes, options: Options) {\n const {\n allowedElements,\n allowElement,\n components,\n disallowedElements,\n skipHtml,\n unwrapDisallowed,\n } = options;\n const urlTransform = options.urlTransform || defaultUrlTransform;\n\n if (allowedElements && disallowedElements) {\n throw new Error(\n 'Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other',\n );\n }\n\n const transform: BuildVisitor<Root> = (node, index, parent) => {\n const rawNode = node as unknown as { type?: string; value?: unknown };\n if (\n rawNode.type === 'raw' &&\n typeof rawNode.value === 'string' &&\n parent &&\n typeof index === 'number'\n ) {\n if (skipHtml) {\n parent.children.splice(index, 1);\n } else {\n parent.children[index] = { type: 'text', value: rawNode.value };\n }\n\n return index;\n }\n\n if (node.type === 'element') {\n let key: string;\n\n for (key in urlAttributes) {\n if (Object.hasOwn(urlAttributes, key) && Object.hasOwn(node.properties, key)) {\n const value = node.properties[key];\n const test = urlAttributes[key];\n if (test === null || test.includes(node.tagName)) {\n node.properties[key] = urlTransform(String(value || ''), key, node);\n }\n }\n }\n\n let remove = allowedElements\n ? !allowedElements.includes(node.tagName)\n : disallowedElements\n ? disallowedElements.includes(node.tagName)\n : false;\n\n if (!remove && allowElement && typeof index === 'number') {\n remove = !allowElement(node, index, parent);\n }\n\n if (remove && parent && typeof index === 'number') {\n if (unwrapDisallowed && node.children) {\n parent.children.splice(index, 1, ...node.children);\n } else {\n parent.children.splice(index, 1);\n }\n\n return index;\n }\n }\n };\n\n visit(tree as Root, transform);\n\n return toJsxRuntime(tree, {\n Fragment,\n components,\n ignoreInvalidStyle: true,\n jsx,\n jsxs,\n passKeys: true,\n passNode: true,\n });\n}\n"],"mappings":";;;;;;;;;;;;AAcA,MAAM,gBAA+B,EAAE;AACvC,MAAM,gCAAgC,EAAE,oBAAoB,MAAM;;;;;;;;;AAUlE,MAAa,kBAAkB,YAAqB;CAClD,MAAM,EAAE,UAAU,eAAe,eAAe,wBAAwB;CAExE,MAAM,YAAY,cAAc;AAC9B,SAAO,SAAS,CACb,IAAI,YAAY,CAChB,IAAI,iBAAiB,cAAc,CACnC,IACC,cACA,sBACI;GAAE,GAAG;GAAqB,GAAG;GAA+B,GAC5D,8BACL,CACA,IAAI,iBAAiB,cAAc;IACrC;EAAC;EAAe;EAAe;EAAoB,CAAC;CAEvD,MAAM,OAAO,IAAI,OAAO;AACxB,MAAK,QAAQ,OAAO,aAAa,WAAW,WAAW;AAEvD,QAAO,KAAK,UAAU,QAAQ,UAAU,MAAM,KAAK,EAAE,KAAK,EAAW,QAAQ;;AAG/E,SAAS,KAAK,MAAa,SAAkB;CAC3C,MAAM,EACJ,iBACA,cACA,YACA,oBACA,UACA,qBACE;CACJ,MAAM,eAAe,QAAQ,gBAAgB;AAE7C,KAAI,mBAAmB,mBACrB,OAAM,IAAI,MACR,4FACD;CAGH,MAAM,aAAiC,MAAM,OAAO,WAAW;EAC7D,MAAM,UAAU;AAChB,MACE,QAAQ,SAAS,SACjB,OAAO,QAAQ,UAAU,YACzB,UACA,OAAO,UAAU,UACjB;AACA,OAAI,SACF,QAAO,SAAS,OAAO,OAAO,EAAE;OAEhC,QAAO,SAAS,SAAS;IAAE,MAAM;IAAQ,OAAO,QAAQ;IAAO;AAGjE,UAAO;;AAGT,MAAI,KAAK,SAAS,WAAW;GAC3B,IAAI;AAEJ,QAAK,OAAO,cACV,KAAI,OAAO,OAAO,eAAe,IAAI,IAAI,OAAO,OAAO,KAAK,YAAY,IAAI,EAAE;IAC5E,MAAM,QAAQ,KAAK,WAAW;IAC9B,MAAM,OAAO,cAAc;AAC3B,QAAI,SAAS,QAAQ,KAAK,SAAS,KAAK,QAAQ,CAC9C,MAAK,WAAW,OAAO,aAAa,OAAO,SAAS,GAAG,EAAE,KAAK,KAAK;;GAKzE,IAAI,SAAS,kBACT,CAAC,gBAAgB,SAAS,KAAK,QAAQ,GACvC,qBACE,mBAAmB,SAAS,KAAK,QAAQ,GACzC;AAEN,OAAI,CAAC,UAAU,gBAAgB,OAAO,UAAU,SAC9C,UAAS,CAAC,aAAa,MAAM,OAAO,OAAO;AAG7C,OAAI,UAAU,UAAU,OAAO,UAAU,UAAU;AACjD,QAAI,oBAAoB,KAAK,SAC3B,QAAO,SAAS,OAAO,OAAO,GAAG,GAAG,KAAK,SAAS;QAElD,QAAO,SAAS,OAAO,OAAO,EAAE;AAGlC,WAAO;;;;AAKb,OAAM,MAAc,UAAU;AAE9B,QAAO,aAAa,MAAM;EACxB,UAAA;EACA;EACA,oBAAoB;EACpB;EACA;EACA,UAAU;EACV,UAAU;EACX,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rehypeStreamAnimated.mjs","names":[],"sources":["../../../src/Markdown/plugins/rehypeStreamAnimated.ts"],"sourcesContent":["import { type Element, type ElementContent, type Root } from 'hast';\nimport { type BuildVisitor } from 'unist-util-visit';\nimport { visit } from 'unist-util-visit';\n\nimport { getNow } from '@/utils/getNow';\n\nexport interface StreamAnimatedRuntime {\n births: number[];\n /**\n * Write-once per-char render cache, indexed like `births`:\n * `undefined` = char not rendered yet, `null` = born fully revealed,\n * string = inline style frozen at first render.\n * Freezing the style keeps span props referentially stable across the\n * tail block's re-renders, so React never rewrites `animation-delay`\n * on an in-flight fade (a rewrite restarts the CSS animation).\n */\n styles: (string | null | undefined)[];\n}\n\nexport interface StreamAnimatedOptions {\n births?: number[];\n fadeDuration?: number;\n /**\n * `'word'` wraps whitespace-delimited runs in one span instead of one\n * span per char. Every concurrent CSS animation keeps the compositor\n * producing frames and fires animationstart/end through React's root\n * event delegation, so animating ~5x fewer nodes is the main CPU lever —\n * char-level remains available for the finer-grained look.\n */\n granularity?: 'char' | 'word';\n nowMs?: number;\n revealed?: boolean;\n runtime?: StreamAnimatedRuntime;\n}\n\n// Intl.Segmenter splits CJK runs into words too — the whitespace regex\n// fallback would otherwise fade an entire unspaced CJK paragraph as one\n// unit.\nconst WORD_SEGMENT_RE = /\\s+|\\S+/g;\n\nconst wordSegmenter =\n typeof Intl !== 'undefined' && 'Segmenter' in Intl\n ? new Intl.Segmenter(undefined, { granularity: 'word' })\n : null;\n\nconst segmentWords = (value: string): string[] => {\n if (!wordSegmenter) return value.match(WORD_SEGMENT_RE) ?? [];\n\n const segments: string[] = [];\n for (const item of wordSegmenter.segment(value)) {\n segments.push(item.segment);\n }\n return segments;\n};\n\nconst BLOCK_TAGS = new Set(['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'li']);\nconst SKIP_TAGS = new Set(['pre', 'code', 'table', 'svg']);\n\nfunction hasClass(node: Element, cls: string): boolean {\n const cn = node.properties?.className;\n if (Array.isArray(cn)) return cn.some((c) => String(c).includes(cls));\n if (typeof cn === 'string') return cn.includes(cls);\n return false;\n}\n\nexport const rehypeStreamAnimated = (options: StreamAnimatedOptions = {}) => {\n const {\n births,\n fadeDuration = 150,\n granularity = 'char',\n nowMs,\n revealed = false,\n runtime,\n } = options;\n // Legacy births/nowMs callers share the runtime path through a throwaway\n // cache: the plugin factory runs once per render, so their styles are\n // recomputed against the caller's nowMs each run, exactly as before.\n const resolvedRuntime = revealed\n ? undefined\n : (runtime ??\n (Array.isArray(births) && typeof nowMs === 'number' ? { births, styles: [] } : undefined));\n const nowOverride = runtime ? undefined : nowMs;\n\n return (tree: Root) => {\n let globalCharIndex = 0;\n const now = nowOverride ?? (resolvedRuntime ? getNow() : 0);\n\n const shouldSkip = (node: Element): boolean => {\n return SKIP_TAGS.has(node.tagName) || hasClass(node, 'katex');\n };\n\n const resolveStyle = (index: number): string | null => {\n const styles = resolvedRuntime!.styles;\n const cached = styles[index];\n if (cached !== undefined) return cached;\n\n const birthTs = resolvedRuntime!.births[index];\n let resolved: string | null;\n if (birthTs === undefined) {\n resolved = null;\n } else {\n const elapsed = now - birthTs;\n // Negative delay = already elapsed ms into the fade. Positive\n // delay = not started yet (char born in the future, i.e.\n // staggered within the same commit).\n resolved = elapsed >= fadeDuration ? null : `animation-delay:${-elapsed}ms`;\n }\n styles[index] = resolved;\n return resolved;\n };\n\n const buildSpan = (value: string, startIndex: number): ElementContent => {\n let className = 'stream-char';\n let style: string | undefined;\n\n if (revealed) {\n className = 'stream-char stream-char-revealed';\n } else if (resolvedRuntime) {\n const resolved = resolveStyle(startIndex);\n if (resolved === null) {\n className = 'stream-char stream-char-revealed';\n } else {\n style = resolved;\n }\n }\n\n const properties: Record<string, any> = { className };\n if (style !== undefined) {\n properties.style = style;\n }\n return {\n children: [{ type: 'text', value }],\n properties,\n tagName: 'span',\n type: 'element',\n };\n };\n\n const wrapText = (node: Element) => {\n const newChildren: ElementContent[] = [];\n for (const child of node.children) {\n if (child.type === 'text') {\n if (granularity === 'word') {\n for (const segment of segmentWords(child.value)) {\n const startIndex = globalCharIndex;\n for (const _char of segment) globalCharIndex++;\n\n if (segment.trim() === '') {\n newChildren.push({ type: 'text', value: segment });\n } else {\n newChildren.push(buildSpan(segment, startIndex));\n }\n }\n } else {\n for (const char of child.value) {\n newChildren.push(buildSpan(char, globalCharIndex));\n globalCharIndex++;\n }\n }\n } else if (child.type === 'element') {\n if (!shouldSkip(child)) {\n wrapText(child);\n }\n newChildren.push(child);\n } else {\n newChildren.push(child);\n }\n }\n node.children = newChildren;\n };\n\n visit(tree, 'element', ((node: Element) => {\n if (shouldSkip(node)) return 'skip';\n if (BLOCK_TAGS.has(node.tagName)) {\n wrapText(node);\n return 'skip';\n }\n }) as BuildVisitor<Root, 'element'>);\n };\n};\n"],"mappings":";;;AAsCA,MAAM,kBAAkB;AAExB,MAAM,gBACJ,OAAO,SAAS,eAAe,eAAe,OAC1C,IAAI,KAAK,UAAU,KAAA,GAAW,EAAE,aAAa,QAAQ,CAAC,GACtD;AAEN,MAAM,gBAAgB,UAA4B;AAChD,KAAI,CAAC,cAAe,QAAO,MAAM,MAAM,gBAAgB,IAAI,EAAE;CAE7D,MAAM,WAAqB,EAAE;AAC7B,MAAK,MAAM,QAAQ,cAAc,QAAQ,MAAM,CAC7C,UAAS,KAAK,KAAK,QAAQ;AAE7B,QAAO;;AAGT,MAAM,aAAa,IAAI,IAAI;CAAC;CAAK;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAK,CAAC;AAC3E,MAAM,YAAY,IAAI,IAAI;CAAC;CAAO;CAAQ;CAAS;CAAM,CAAC;AAE1D,SAAS,SAAS,MAAe,KAAsB;CACrD,MAAM,
|
|
1
|
+
{"version":3,"file":"rehypeStreamAnimated.mjs","names":[],"sources":["../../../src/Markdown/plugins/rehypeStreamAnimated.ts"],"sourcesContent":["import { type Element, type ElementContent, type Root } from 'hast';\nimport { type BuildVisitor } from 'unist-util-visit';\nimport { visit } from 'unist-util-visit';\n\nimport { getNow } from '@/utils/getNow';\n\nexport interface StreamAnimatedRuntime {\n births: number[];\n /**\n * Write-once per-char render cache, indexed like `births`:\n * `undefined` = char not rendered yet, `null` = born fully revealed,\n * string = inline style frozen at first render.\n * Freezing the style keeps span props referentially stable across the\n * tail block's re-renders, so React never rewrites `animation-delay`\n * on an in-flight fade (a rewrite restarts the CSS animation).\n */\n styles: (string | null | undefined)[];\n}\n\nexport interface StreamAnimatedOptions {\n births?: number[];\n fadeDuration?: number;\n /**\n * `'word'` wraps whitespace-delimited runs in one span instead of one\n * span per char. Every concurrent CSS animation keeps the compositor\n * producing frames and fires animationstart/end through React's root\n * event delegation, so animating ~5x fewer nodes is the main CPU lever —\n * char-level remains available for the finer-grained look.\n */\n granularity?: 'char' | 'word';\n nowMs?: number;\n revealed?: boolean;\n runtime?: StreamAnimatedRuntime;\n}\n\n// Intl.Segmenter splits CJK runs into words too — the whitespace regex\n// fallback would otherwise fade an entire unspaced CJK paragraph as one\n// unit.\nconst WORD_SEGMENT_RE = /\\s+|\\S+/g;\n\nconst wordSegmenter =\n typeof Intl !== 'undefined' && 'Segmenter' in Intl\n ? new Intl.Segmenter(undefined, { granularity: 'word' })\n : null;\n\nconst segmentWords = (value: string): string[] => {\n if (!wordSegmenter) return value.match(WORD_SEGMENT_RE) ?? [];\n\n const segments: string[] = [];\n for (const item of wordSegmenter.segment(value)) {\n segments.push(item.segment);\n }\n return segments;\n};\n\nconst BLOCK_TAGS = new Set(['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'li']);\nconst SKIP_TAGS = new Set(['pre', 'code', 'table', 'svg']);\n\nfunction hasClass(node: Element, cls: string): boolean {\n const cn: unknown = node.properties?.className;\n if (Array.isArray(cn)) return cn.some((c) => String(c).includes(cls));\n if (typeof cn === 'string') return cn.includes(cls);\n return false;\n}\n\nexport const rehypeStreamAnimated = (options: StreamAnimatedOptions = {}) => {\n const {\n births,\n fadeDuration = 150,\n granularity = 'char',\n nowMs,\n revealed = false,\n runtime,\n } = options;\n // Legacy births/nowMs callers share the runtime path through a throwaway\n // cache: the plugin factory runs once per render, so their styles are\n // recomputed against the caller's nowMs each run, exactly as before.\n const resolvedRuntime = revealed\n ? undefined\n : (runtime ??\n (Array.isArray(births) && typeof nowMs === 'number' ? { births, styles: [] } : undefined));\n const nowOverride = runtime ? undefined : nowMs;\n\n return (tree: Root) => {\n let globalCharIndex = 0;\n const now = nowOverride ?? (resolvedRuntime ? getNow() : 0);\n\n const shouldSkip = (node: Element): boolean => {\n return SKIP_TAGS.has(node.tagName) || hasClass(node, 'katex');\n };\n\n const resolveStyle = (index: number): string | null => {\n const styles = resolvedRuntime!.styles;\n const cached = styles[index];\n if (cached !== undefined) return cached;\n\n const birthTs = resolvedRuntime!.births[index];\n let resolved: string | null;\n if (birthTs === undefined) {\n resolved = null;\n } else {\n const elapsed = now - birthTs;\n // Negative delay = already elapsed ms into the fade. Positive\n // delay = not started yet (char born in the future, i.e.\n // staggered within the same commit).\n resolved = elapsed >= fadeDuration ? null : `animation-delay:${-elapsed}ms`;\n }\n styles[index] = resolved;\n return resolved;\n };\n\n const buildSpan = (value: string, startIndex: number): ElementContent => {\n let className = 'stream-char';\n let style: string | undefined;\n\n if (revealed) {\n className = 'stream-char stream-char-revealed';\n } else if (resolvedRuntime) {\n const resolved = resolveStyle(startIndex);\n if (resolved === null) {\n className = 'stream-char stream-char-revealed';\n } else {\n style = resolved;\n }\n }\n\n const properties: Record<string, any> = { className };\n if (style !== undefined) {\n properties.style = style;\n }\n return {\n children: [{ type: 'text', value }],\n properties,\n tagName: 'span',\n type: 'element',\n };\n };\n\n const wrapText = (node: Element) => {\n const newChildren: ElementContent[] = [];\n for (const child of node.children) {\n if (child.type === 'text') {\n if (granularity === 'word') {\n for (const segment of segmentWords(child.value)) {\n const startIndex = globalCharIndex;\n for (const _char of segment) globalCharIndex++;\n\n if (segment.trim() === '') {\n newChildren.push({ type: 'text', value: segment });\n } else {\n newChildren.push(buildSpan(segment, startIndex));\n }\n }\n } else {\n for (const char of child.value) {\n newChildren.push(buildSpan(char, globalCharIndex));\n globalCharIndex++;\n }\n }\n } else if (child.type === 'element') {\n if (!shouldSkip(child)) {\n wrapText(child);\n }\n newChildren.push(child);\n } else {\n newChildren.push(child);\n }\n }\n node.children = newChildren;\n };\n\n visit(tree, 'element', ((node: Element) => {\n if (shouldSkip(node)) return 'skip';\n if (BLOCK_TAGS.has(node.tagName)) {\n wrapText(node);\n return 'skip';\n }\n }) as BuildVisitor<Root, 'element'>);\n };\n};\n"],"mappings":";;;AAsCA,MAAM,kBAAkB;AAExB,MAAM,gBACJ,OAAO,SAAS,eAAe,eAAe,OAC1C,I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E;AAChC,aAAS,KAAK;AACd,WAAO;;KAEyB"}
|
|
@@ -6,7 +6,8 @@ var global_default = (token) => css`
|
|
|
6
6
|
--font-settings: 'cv01', 'tnum', 'kern';
|
|
7
7
|
--font-variations: 'opsz' auto, tabular-nums;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
/* Real Geist italic for Latin; synthesize style for CJK fallback faces. */
|
|
10
|
+
font-synthesis: style;
|
|
10
11
|
text-autospace: normal;
|
|
11
12
|
}
|
|
12
13
|
|
|
@@ -44,7 +45,7 @@ var global_default = (token) => css`
|
|
|
44
45
|
|
|
45
46
|
background-color: ${token.colorBgLayout};
|
|
46
47
|
|
|
47
|
-
font-synthesis:
|
|
48
|
+
font-synthesis: style;
|
|
48
49
|
|
|
49
50
|
-webkit-overflow-scrolling: touch;
|
|
50
51
|
-webkit-tap-highlight-color: transparent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global.mjs","names":[],"sources":["../../../src/ThemeProvider/GlobalStyle/global.ts"],"sourcesContent":["import { css, type Theme } from 'antd-style';\n\nimport { CLASSNAMES } from '@/styles/classNames';\n\nexport default (token: Theme) => css`\n :root {\n --font-settings: 'cv01', 'tnum', 'kern';\n --font-variations: 'opsz' auto, tabular-nums;\n\n font-synthesis:
|
|
1
|
+
{"version":3,"file":"global.mjs","names":[],"sources":["../../../src/ThemeProvider/GlobalStyle/global.ts"],"sourcesContent":["import { css, type Theme } from 'antd-style';\n\nimport { CLASSNAMES } from '@/styles/classNames';\n\nexport default (token: Theme) => css`\n :root {\n --font-settings: 'cv01', 'tnum', 'kern';\n --font-variations: 'opsz' auto, tabular-nums;\n\n /* Real Geist italic for Latin; synthesize style for CJK fallback faces. */\n font-synthesis: style;\n text-autospace: normal;\n }\n\n html {\n overscroll-behavior: none;\n color-scheme: ${token.isDarkMode ? 'dark' : 'light'};\n }\n\n body {\n overflow: hidden auto;\n\n min-height: 100vh;\n margin: 0;\n padding: 0;\n\n font-family: ${token.fontFamily};\n font-size: ${token.fontSize}px;\n font-feature-settings: var(--font-settings);\n font-variation-settings: var(--font-variations);\n font-optical-sizing: auto;\n font-kerning: normal;\n font-variant-ligatures: common-ligatures contextual;\n font-variant-numeric: tabular-nums;\n font-size-adjust: from-font;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n line-height: 1;\n color: ${token.colorTextBase};\n text-wrap: pretty;\n text-size-adjust: 100%;\n text-size-adjust: 100%;\n text-rendering: optimizelegibility;\n overflow-wrap: anywhere;\n vertical-align: baseline;\n\n background-color: ${token.colorBgLayout};\n\n font-synthesis: style;\n\n -webkit-overflow-scrolling: touch;\n -webkit-tap-highlight-color: transparent;\n }\n\n code,\n kbd,\n samp,\n pre {\n font-family: ${token.fontFamilyCode} !important;\n font-feature-settings:\n 'liga' 0,\n 'calt' 0;\n font-variant-ligatures: none;\n\n span {\n font-family: ${token.fontFamilyCode} !important;\n }\n }\n\n ::selection {\n color: #000;\n background: ${token.yellow9};\n\n -webkit-text-fill-color: unset !important;\n }\n\n * {\n scrollbar-color: ${token.colorFill} transparent;\n scrollbar-width: thin;\n box-sizing: border-box;\n vertical-align: baseline;\n }\n\n @layer lobe-popup {\n .${CLASSNAMES.ContextTrigger}[data-popup-open],\n .${CLASSNAMES.DropdownMenuTrigger}[data-popup-open] {\n background: ${token.colorFillTertiary};\n }\n }\n\n @layer lobe-base {\n :where(.lobe-flex) {\n /* Define defaults on the element itself to avoid CSS variable inheritance leaking to nested Flex */\n --lobe-flex: 0 1 auto;\n --lobe-flex-direction: column;\n --lobe-flex-wrap: nowrap;\n --lobe-flex-justify: flex-start;\n --lobe-flex-align: stretch;\n --lobe-flex-width: auto;\n --lobe-flex-height: auto;\n --lobe-flex-padding: 0;\n\n /* Keep padding-inline/block aligned with padding by default, and prevent inheriting from parent */\n --lobe-flex-padding-inline: var(--lobe-flex-padding);\n --lobe-flex-padding-block: var(--lobe-flex-padding);\n --lobe-flex-gap: 0;\n\n display: flex;\n flex: var(--lobe-flex);\n flex-flow: var(--lobe-flex-direction) var(--lobe-flex-wrap);\n gap: var(--lobe-flex-gap);\n align-items: var(--lobe-flex-align);\n justify-content: var(--lobe-flex-justify);\n\n width: var(--lobe-flex-width);\n height: var(--lobe-flex-height);\n padding: var(--lobe-flex-padding);\n padding-block: var(--lobe-flex-padding-block);\n padding-inline: var(--lobe-flex-padding-inline);\n }\n\n .lobe-flex-hidden {\n display: none;\n }\n }\n\n /* Brand Loading */\n @keyframes draw {\n 0% {\n stroke-dashoffset: 1000;\n }\n\n 100% {\n stroke-dashoffset: 0;\n }\n }\n\n @keyframes fill {\n 30% {\n fill-opacity: 0.05;\n }\n\n 100% {\n fill-opacity: 1;\n }\n }\n\n .lobe-brand-loading path {\n fill: currentcolor;\n fill-opacity: 0;\n stroke: currentcolor;\n stroke-dasharray: 1000;\n stroke-dashoffset: 1000;\n stroke-width: 0.25em;\n\n animation:\n draw 2s cubic-bezier(0.4, 0, 0.2, 1) infinite,\n fill 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;\n }\n`;\n"],"mappings":";;;AAIA,IAAA,kBAAgB,UAAiB,GAAG;;;;;;;;;;;;oBAYhB,MAAM,aAAa,SAAS,QAAQ;;;;;;;;;;mBAUrC,MAAM,WAAW;iBACnB,MAAM,SAAS;;;;;;;;;;;aAWnB,MAAM,cAAc;;;;;;;;wBAQT,MAAM,cAAc;;;;;;;;;;;;mBAYzB,MAAM,eAAe;;;;;;;qBAOnB,MAAM,eAAe;;;;;;kBAMxB,MAAM,QAAQ;;;;;;uBAMT,MAAM,UAAU;;;;;;;OAOhC,WAAW,eAAe;SACxB,WAAW,oBAAoB;oBACpB,MAAM,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.mjs","names":["ThemeProvider","lobeCustomStylish","lobeCustomToken","AntdThemeProvider","AntdConfigProvider"],"sources":["../../src/ThemeProvider/ThemeProvider.tsx"],"sourcesContent":["'use client';\n\nimport { App } from 'antd';\nimport {\n type CustomStylishParams,\n type CustomTokenParams,\n type GetAntdTheme,\n ThemeProvider as AntdThemeProvider,\n} from 'antd-style';\nimport { merge } from 'es-toolkit/compat';\nimport { memo, useCallback, useMemo, useState } from 'react';\n\nimport { useCdnFn } from '@/ConfigProvider';\nimport FontLoader from '@/FontLoader';\nimport { lobeCustomStylish, lobeCustomToken } from '@/styles';\nimport { createLobeAntdTheme } from '@/styles/theme/antdTheme';\nimport { type LobeCustomToken } from '@/types/customToken';\n\nimport AppElementContext from './AppElementContext';\nimport AntdConfigProvider from './ConfigProvider';\nimport { LOBE_THEME_APP_ID } from './constants';\nimport GlobalStyle from './GlobalStyle';\nimport { type ThemeProviderProps } from './type';\n\nconst ThemeProvider = memo<ThemeProviderProps>(\n ({\n children,\n customStylish,\n customToken,\n enableCustomFonts = true,\n enableGlobalStyle = true,\n customFonts,\n customTheme = {},\n className,\n style,\n theme: antdTheme,\n ...rest\n }) => {\n const genCdnUrl = useCdnFn();\n const [appRef, setAppRef] = useState<HTMLDivElement | null>(null);\n\n const webfontUrls = useMemo(\n () =>\n customFonts || [\n genCdnUrl({\n path: 'css/index.css',\n pkg: '@lobehub/webfont-geist-mono',\n version: '1.0.0',\n }),\n genCdnUrl({\n path: 'css/index.css',\n pkg: '@lobehub/webfont-geist',\n version: '1.0.0',\n }),\n genCdnUrl({\n path: 'css/index.css',\n pkg: '@lobehub/webfont-harmony-sans-sc',\n // pkg: '@lobehub/webfont-harmony-sans-sc-mini',\n version: '1.0.0',\n }),\n genCdnUrl({\n path: 'dist/katex.min.css',\n pkg: 'katex',\n version: '0.17.0',\n }),\n ],\n [customFonts, genCdnUrl],\n );\n\n const stylish = useCallback(\n (theme: CustomStylishParams) => ({ ...lobeCustomStylish(theme), ...customStylish?.(theme) }),\n [customStylish],\n );\n\n const token = useCallback(\n (theme: CustomTokenParams) => ({ ...lobeCustomToken(theme), ...customToken?.(theme) }),\n [customToken],\n );\n\n const theme = useCallback<GetAntdTheme>(\n (appearance) => {\n const lobeTheme = createLobeAntdTheme({\n appearance,\n neutralColor: customTheme.neutralColor,\n primaryColor: customTheme.primaryColor,\n });\n return merge(lobeTheme, antdTheme);\n },\n [customTheme.primaryColor, customTheme.neutralColor, antdTheme],\n );\n\n return (\n <>\n {enableCustomFonts &&\n webfontUrls?.length > 0 &&\n webfontUrls.map((webfont) => <FontLoader key={webfont} url={webfont} />)}\n <AntdThemeProvider<LobeCustomToken>\n customStylish={stylish}\n customToken={token}\n theme={theme}\n {...rest}\n >\n <AntdConfigProvider>\n {enableGlobalStyle && <GlobalStyle />}\n\n <App\n className={className}\n style={{ isolation: 'isolate', minHeight: 'inherit', width: 'inherit', ...style }}\n >\n <div id={LOBE_THEME_APP_ID} style={contentsStyle}>\n <AppElementContext value={appRef}>\n {children}\n {/*\n In-tree portal host for Base UI floating components\n (Select, Combobox, etc.). Keeping it inside `<App>` keeps\n the antd-style / emotion theme cascade intact so popups\n render with the correct tokens, while the layout-bearing\n block lets Base UI's Portal actually mount — the outer\n wrapper uses `display: contents` and cannot host portals.\n */}\n <div data-lobe-portal-host=\"\" ref={setAppRef} style={hostPortalHostStyle} />\n </AppElementContext>\n </div>\n </App>\n </AntdConfigProvider>\n </AntdThemeProvider>\n </>\n );\n },\n);\n\nThemeProvider.displayName = 'LobeThemeProvider';\n\nexport default ThemeProvider;\n\nconst hostPortalHostStyle: React.CSSProperties = {\n // `height: 0` keeps the host invisible and gives it no hit region of\n // its own; absolute children (Base UI Positioner) have their own hit\n // region, so we must NOT set `pointer-events: none` here — it would\n // be inherited by popup descendants and break clicks/hover.\n height: 0,\n left: 0,\n // `position: fixed` keeps a stacking context so portaled popups can\n // win over sibling z-indexes. `right: 0` (instead of `width: 0`)\n // gives the host a full viewport-width containing block — without it,\n // Base UI Positioner uses `position: absolute` against a 0-width\n // containing block and collapses text to one character per line.\n position: 'fixed',\n right: 0,\n top: 0,\n zIndex: 1100,\n};\n\nconst contentsStyle: React.CSSProperties = {\n display: 'contents',\n};\n"],"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W,OAAO;IAAW,GAAG;IAAO;aAEjF,oBAAC,OAAD;IAAK,IAAI;IAAmB,OAAO;cACjC,qBAAC,mBAAD;KAAmB,OAAO;eAA1B,CACG,UASD,oBAAC,OAAD;MAAK,yBAAsB;MAAG,KAAK;MAAW,OAAO;MAAuB,CAAA,CAC1D;;IAChB,CAAA;GACF,CAAA,CACa,EAAA,CAAA;EACH,CAAA,CACnB,EAAA,CAAA;EAGR;AAED,gBAAc,cAAc;AAI5B,MAAM,sBAA2C;CAK/C,QAAQ;CACR,MAAM;CAMN,UAAU;CACV,OAAO;CACP,KAAK;CACL,QAAQ;CACT;AAED,MAAM,gBAAqC,EACzC,SAAS,YACV"}
|
|
1
|
+
{"version":3,"file":"ThemeProvider.mjs","names":["ThemeProvider","lobeCustomStylish","lobeCustomToken","AntdThemeProvider","AntdConfigProvider"],"sources":["../../src/ThemeProvider/ThemeProvider.tsx"],"sourcesContent":["'use client';\n\nimport { App } from 'antd';\nimport {\n type CustomStylishParams,\n type CustomTokenParams,\n type GetAntdTheme,\n ThemeProvider as AntdThemeProvider,\n} from 'antd-style';\nimport { merge } from 'es-toolkit/compat';\nimport { memo, useCallback, useMemo, useState } from 'react';\n\nimport { useCdnFn } from '@/ConfigProvider';\nimport FontLoader from '@/FontLoader';\nimport { lobeCustomStylish, lobeCustomToken } from '@/styles';\nimport { createLobeAntdTheme } from '@/styles/theme/antdTheme';\nimport { type LobeCustomToken } from '@/types/customToken';\n\nimport AppElementContext from './AppElementContext';\nimport AntdConfigProvider from './ConfigProvider';\nimport { LOBE_THEME_APP_ID } from './constants';\nimport GlobalStyle from './GlobalStyle';\nimport { type ThemeProviderProps } from './type';\n\nconst ThemeProvider = memo<ThemeProviderProps>(\n ({\n children,\n customStylish,\n customToken,\n enableCustomFonts = true,\n enableGlobalStyle = true,\n customFonts,\n customTheme = {},\n className,\n style,\n theme: antdTheme,\n ...rest\n }) => {\n const genCdnUrl = useCdnFn();\n const [appRef, setAppRef] = useState<HTMLDivElement | null>(null);\n\n const webfontUrls = useMemo(\n () =>\n customFonts || [\n genCdnUrl({\n path: 'css/index.css',\n pkg: '@lobehub/webfont-geist-mono',\n version: '1.0.0',\n }),\n genCdnUrl({\n path: 'css/index-full.css',\n pkg: '@lobehub/webfont-geist',\n version: '1.0.0',\n }),\n genCdnUrl({\n path: 'css/index.css',\n pkg: '@lobehub/webfont-harmony-sans-sc',\n // pkg: '@lobehub/webfont-harmony-sans-sc-mini',\n version: '1.0.0',\n }),\n genCdnUrl({\n path: 'dist/katex.min.css',\n pkg: 'katex',\n version: '0.17.0',\n }),\n ],\n [customFonts, genCdnUrl],\n );\n\n const stylish = useCallback(\n (theme: CustomStylishParams) => ({ ...lobeCustomStylish(theme), ...customStylish?.(theme) }),\n [customStylish],\n );\n\n const token = useCallback(\n (theme: CustomTokenParams) => ({ ...lobeCustomToken(theme), ...customToken?.(theme) }),\n [customToken],\n );\n\n const theme = useCallback<GetAntdTheme>(\n (appearance) => {\n const lobeTheme = createLobeAntdTheme({\n appearance,\n neutralColor: customTheme.neutralColor,\n primaryColor: customTheme.primaryColor,\n });\n return merge(lobeTheme, antdTheme);\n },\n [customTheme.primaryColor, customTheme.neutralColor, antdTheme],\n );\n\n return (\n <>\n {enableCustomFonts &&\n webfontUrls?.length > 0 &&\n webfontUrls.map((webfont) => <FontLoader key={webfont} url={webfont} />)}\n <AntdThemeProvider<LobeCustomToken>\n customStylish={stylish}\n customToken={token}\n theme={theme}\n {...rest}\n >\n <AntdConfigProvider>\n {enableGlobalStyle && <GlobalStyle />}\n\n <App\n className={className}\n style={{ isolation: 'isolate', minHeight: 'inherit', width: 'inherit', ...style }}\n >\n <div id={LOBE_THEME_APP_ID} style={contentsStyle}>\n <AppElementContext value={appRef}>\n {children}\n {/*\n In-tree portal host for Base UI floating components\n (Select, Combobox, etc.). Keeping it inside `<App>` keeps\n the antd-style / emotion theme cascade intact so popups\n render with the correct tokens, while the layout-bearing\n block lets Base UI's Portal actually mount — the outer\n wrapper uses `display: contents` and cannot host portals.\n */}\n <div data-lobe-portal-host=\"\" ref={setAppRef} style={hostPortalHostStyle} />\n </AppElementContext>\n </div>\n </App>\n </AntdConfigProvider>\n </AntdThemeProvider>\n </>\n );\n },\n);\n\nThemeProvider.displayName = 'LobeThemeProvider';\n\nexport default ThemeProvider;\n\nconst hostPortalHostStyle: React.CSSProperties = {\n // `height: 0` keeps the host invisible and gives it no hit region of\n // its own; absolute children (Base UI Positioner) have their own hit\n // region, so we must NOT set `pointer-events: none` here — it would\n // be inherited by popup descendants and break clicks/hover.\n height: 0,\n left: 0,\n // `position: fixed` keeps a stacking context so portaled popups can\n // win over sibling z-indexes. `right: 0` (instead of `width: 0`)\n // gives the host a full viewport-width containing block — without it,\n // Base UI Positioner uses `position: absolute` against a 0-width\n // containing block and collapses text to one character per line.\n position: 'fixed',\n right: 0,\n top: 0,\n zIndex: 1100,\n};\n\nconst contentsStyle: React.CSSProperties = {\n display: 'contents',\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAwBA,MAAMA,kBAAgB,MACnB,EACC,UACA,eACA,aACA,oBAAoB,MACpB,oBAAoB,MACpB,aACA,cAAc,EAAE,EAChB,WACA,OACA,OAAO,WACP,GAAG,WACC;CACJ,MAAM,YAAY,UAAU;CAC5B,MAAM,CAAC,QAAQ,aAAa,SAAgC,KAAK;CAEjE,MAAM,cAAc,cAEhB,eAAe;EACb,UAAU;GACR,MAAM;GACN,KAAK;GACL,SAAS;GACV,CAAC;EACF,UAAU;GACR,MAAM;GACN,KAAK;GACL,SAAS;GACV,CAAC;EACF,UAAU;GACR,MAAM;GACN,KAAK;GAEL,SAAS;GACV,CAAC;EACF,UAAU;GACR,MAAM;GACN,KAAK;GACL,SAAS;GACV,CAAC;EACH,EACH,CAAC,aAAa,UAAU,CACzB;CAED,MAAM,UAAU,aACb,WAAgC;EAAE,GAAGC,sBAAkB,MAAM;EAAE,GAAG,gBAAgB,MAAM;EAAE,GAC3F,CAAC,cAAc,CAChB;CAED,MAAM,QAAQ,aACX,WAA8B;EAAE,GAAGC,oBAAgB,MAAM;EAAE,GAAG,cAAc,MAAM;EAAE,GACrF,CAAC,YAAY,CACd;CAED,MAAM,QAAQ,aACX,eAAe;AAMd,SAAO,MALW,oBAAoB;GACpC;GACA,cAAc,YAAY;GAC1B,cAAc,YAAY;GAC3B,CACqB,EAAE,UAAU;IAEpC;EAAC,YAAY;EAAc,YAAY;EAAc;EAAU,CAChE;AAED,QACE,qBAAA,YAAA,EAAA,UAAA,CACG,qBACC,aAAa,SAAS,KACtB,YAAY,KAAK,YAAY,oBAAC,YAAD,EAA0B,KAAK,SAAW,EAAzB,QAAyB,CAAC,EAC1E,oBAACC,eAAD;EACE,eAAe;EACf,aAAa;EACN;EACP,GAAI;YAEJ,qBAACC,kBAAD,EAAA,UAAA,CACG,qBAAqB,oBAAC,aAAD,EAAe,CAAA,EAErC,oBAAC,KAAD;GACa;GACX,OAAO;IAAE,WAAW;IAAW,WAAW;IAAW,OAAO;IAAW,GAAG;IAAO;aAEjF,oBAAC,OAAD;IAAK,IAAI;IAAmB,OAAO;cACjC,qBAAC,mBAAD;KAAmB,OAAO;eAA1B,CACG,UASD,oBAAC,OAAD;MAAK,yBAAsB;MAAG,KAAK;MAAW,OAAO;MAAuB,CAAA,CAC1D;;IAChB,CAAA;GACF,CAAA,CACa,EAAA,CAAA;EACH,CAAA,CACnB,EAAA,CAAA;EAGR;AAED,gBAAc,cAAc;AAI5B,MAAM,sBAA2C;CAK/C,QAAQ;CACR,MAAM;CAMN,UAAU;CACV,OAAO;CACP,KAAK;CACL,QAAQ;CACT;AAED,MAAM,gBAAqC,EACzC,SAAS,YACV"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AutoCompleteProps } from "./type.mjs";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/base-ui/AutoComplete/AutoComplete.d.ts
|
|
5
|
+
declare const AutoComplete: _$react.NamedExoticComponent<AutoCompleteProps>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { AutoComplete };
|
|
8
|
+
//# sourceMappingURL=AutoComplete.d.mts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useAppElement } from "../../ThemeProvider/AppElementContext.mjs";
|
|
3
|
+
import Icon from "../../Icon/Icon.mjs";
|
|
4
|
+
import { rootVariants, styles } from "../Input/style.mjs";
|
|
5
|
+
import { styles as styles$1 } from "./style.mjs";
|
|
6
|
+
import { memo, useMemo, useRef } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { cx, useThemeMode } from "antd-style";
|
|
9
|
+
import { XIcon } from "lucide-react";
|
|
10
|
+
import { Autocomplete } from "@base-ui/react/autocomplete";
|
|
11
|
+
//#region src/base-ui/AutoComplete/AutoComplete.tsx
|
|
12
|
+
const AutoComplete = memo(({ className, classNames, styles: customStyles, style, variant, shadow, size = "middle", options = [], onChange, onSearch, allowClear, disabled, placeholder, prefix, suffix, emptyText, ...rest }) => {
|
|
13
|
+
const { isDarkMode } = useThemeMode();
|
|
14
|
+
const appElement = useAppElement();
|
|
15
|
+
const anchorRef = useRef(null);
|
|
16
|
+
const mergedVariant = variant || (isDarkMode ? "filled" : "outlined");
|
|
17
|
+
const items = useMemo(() => options.map((option) => typeof option === "string" ? { value: option } : option), [options]);
|
|
18
|
+
return /* @__PURE__ */ jsxs(Autocomplete.Root, {
|
|
19
|
+
openOnInputClick: true,
|
|
20
|
+
disabled,
|
|
21
|
+
itemToStringValue: (item) => item.value,
|
|
22
|
+
items,
|
|
23
|
+
onValueChange: (value) => {
|
|
24
|
+
onChange?.(value);
|
|
25
|
+
onSearch?.(value);
|
|
26
|
+
},
|
|
27
|
+
...rest,
|
|
28
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
29
|
+
className: cx(rootVariants({
|
|
30
|
+
shadow,
|
|
31
|
+
size,
|
|
32
|
+
variant: mergedVariant
|
|
33
|
+
}), className),
|
|
34
|
+
"data-disabled": disabled ? "" : void 0,
|
|
35
|
+
ref: anchorRef,
|
|
36
|
+
style,
|
|
37
|
+
children: [
|
|
38
|
+
prefix && /* @__PURE__ */ jsx("span", {
|
|
39
|
+
className: styles.slot,
|
|
40
|
+
children: prefix
|
|
41
|
+
}),
|
|
42
|
+
/* @__PURE__ */ jsx(Autocomplete.Input, {
|
|
43
|
+
className: cx(styles.input, classNames?.input),
|
|
44
|
+
placeholder,
|
|
45
|
+
style: customStyles?.input
|
|
46
|
+
}),
|
|
47
|
+
allowClear && /* @__PURE__ */ jsx(Autocomplete.Clear, {
|
|
48
|
+
"aria-label": "Clear",
|
|
49
|
+
className: styles$1.clear,
|
|
50
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
51
|
+
icon: XIcon,
|
|
52
|
+
size: 14
|
|
53
|
+
})
|
|
54
|
+
}),
|
|
55
|
+
suffix && /* @__PURE__ */ jsx("span", {
|
|
56
|
+
className: styles.slot,
|
|
57
|
+
children: suffix
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
}), /* @__PURE__ */ jsx(Autocomplete.Portal, {
|
|
61
|
+
container: appElement ?? void 0,
|
|
62
|
+
children: /* @__PURE__ */ jsx(Autocomplete.Positioner, {
|
|
63
|
+
anchor: anchorRef,
|
|
64
|
+
className: styles$1.positioner,
|
|
65
|
+
sideOffset: 4,
|
|
66
|
+
children: /* @__PURE__ */ jsxs(Autocomplete.Popup, {
|
|
67
|
+
className: cx(styles$1.popup, classNames?.popup),
|
|
68
|
+
style: customStyles?.popup,
|
|
69
|
+
children: [emptyText && /* @__PURE__ */ jsx(Autocomplete.Empty, {
|
|
70
|
+
className: styles$1.empty,
|
|
71
|
+
children: emptyText
|
|
72
|
+
}), /* @__PURE__ */ jsx(Autocomplete.List, {
|
|
73
|
+
className: styles$1.list,
|
|
74
|
+
children: (item) => /* @__PURE__ */ jsx(Autocomplete.Item, {
|
|
75
|
+
className: cx(styles$1.item, classNames?.item),
|
|
76
|
+
disabled: item.disabled,
|
|
77
|
+
style: customStyles?.item,
|
|
78
|
+
value: item,
|
|
79
|
+
children: item.label ?? item.value
|
|
80
|
+
}, item.value)
|
|
81
|
+
})]
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
})]
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
AutoComplete.displayName = "AutoComplete";
|
|
88
|
+
//#endregion
|
|
89
|
+
export { AutoComplete as default };
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=AutoComplete.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoComplete.mjs","names":["inputVariants","inputStyles","styles"],"sources":["../../../src/base-ui/AutoComplete/AutoComplete.tsx"],"sourcesContent":["'use client';\n\nimport { Autocomplete } from '@base-ui/react/autocomplete';\nimport { cx, useThemeMode } from 'antd-style';\nimport { XIcon } from 'lucide-react';\nimport { memo, useMemo, useRef } from 'react';\n\nimport { inputStyles, inputVariants } from '@/base-ui/Input';\nimport Icon from '@/Icon';\nimport { useAppElement } from '@/ThemeProvider';\n\nimport { styles } from './style';\nimport type { AutoCompleteOption, AutoCompleteProps } from './type';\n\nconst AutoComplete = memo<AutoCompleteProps>(\n ({\n className,\n classNames,\n styles: customStyles,\n style,\n variant,\n shadow,\n size = 'middle',\n options = [],\n onChange,\n onSearch,\n allowClear,\n disabled,\n placeholder,\n prefix,\n suffix,\n emptyText,\n ...rest\n }) => {\n const { isDarkMode } = useThemeMode();\n const appElement = useAppElement();\n const anchorRef = useRef<HTMLDivElement>(null);\n const mergedVariant = variant || (isDarkMode ? 'filled' : 'outlined');\n\n const items = useMemo<AutoCompleteOption[]>(\n () => options.map((option) => (typeof option === 'string' ? { value: option } : option)),\n [options],\n );\n\n return (\n <Autocomplete.Root\n openOnInputClick\n disabled={disabled}\n itemToStringValue={(item) => (item as AutoCompleteOption).value}\n items={items}\n onValueChange={(value) => {\n onChange?.(value);\n onSearch?.(value);\n }}\n {...rest}\n >\n <div\n className={cx(inputVariants({ shadow, size, variant: mergedVariant }), className)}\n data-disabled={disabled ? '' : undefined}\n ref={anchorRef}\n style={style}\n >\n {prefix && <span className={inputStyles.slot}>{prefix}</span>}\n <Autocomplete.Input\n className={cx(inputStyles.input, classNames?.input)}\n placeholder={placeholder}\n style={customStyles?.input}\n />\n {allowClear && (\n <Autocomplete.Clear aria-label={'Clear'} className={styles.clear}>\n <Icon icon={XIcon} size={14} />\n </Autocomplete.Clear>\n )}\n {suffix && <span className={inputStyles.slot}>{suffix}</span>}\n </div>\n <Autocomplete.Portal container={appElement ?? undefined}>\n <Autocomplete.Positioner anchor={anchorRef} className={styles.positioner} sideOffset={4}>\n <Autocomplete.Popup\n className={cx(styles.popup, classNames?.popup)}\n style={customStyles?.popup}\n >\n {emptyText && (\n <Autocomplete.Empty className={styles.empty}>{emptyText}</Autocomplete.Empty>\n )}\n <Autocomplete.List className={styles.list}>\n {(item: AutoCompleteOption) => (\n <Autocomplete.Item\n className={cx(styles.item, classNames?.item)}\n disabled={item.disabled}\n key={item.value}\n style={customStyles?.item}\n value={item}\n >\n {item.label ?? item.value}\n </Autocomplete.Item>\n )}\n </Autocomplete.List>\n </Autocomplete.Popup>\n </Autocomplete.Positioner>\n </Autocomplete.Portal>\n </Autocomplete.Root>\n );\n },\n);\n\nAutoComplete.displayName = 'AutoComplete';\n\nexport default AutoComplete;\n"],"mappings":";;;;;;;;;;;AAcA,MAAM,eAAe,MAClB,EACC,WACA,YACA,QAAQ,cACR,OACA,SACA,QACA,OAAO,UACP,UAAU,EAAE,EACZ,UACA,UACA,YACA,UACA,aACA,QACA,QACA,WACA,GAAG,WACC;CACJ,MAAM,EAAE,eAAe,cAAc;CACrC,MAAM,aAAa,eAAe;CAClC,MAAM,YAAY,OAAuB,KAAK;CAC9C,MAAM,gBAAgB,YAAY,aAAa,WAAW;CAE1D,MAAM,QAAQ,cACN,QAAQ,KAAK,WAAY,OAAO,WAAW,WAAW,EAAE,OAAO,QAAQ,GAAG,OAA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,CAAA,CACJ;;EAGzB;AAED,aAAa,cAAc"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/base-ui/AutoComplete/style.d.ts
|
|
2
|
+
declare const styles: {
|
|
3
|
+
clear: string;
|
|
4
|
+
empty: string;
|
|
5
|
+
item: string;
|
|
6
|
+
list: string;
|
|
7
|
+
popup: string;
|
|
8
|
+
positioner: string;
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { styles };
|
|
12
|
+
//# sourceMappingURL=style.d.mts.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { styles as styles$1 } from "../DropdownMenu/sharedStyle.mjs";
|
|
2
|
+
import { createStaticStyles } from "antd-style";
|
|
3
|
+
//#region src/base-ui/AutoComplete/style.ts
|
|
4
|
+
const ownStyles = createStaticStyles(({ css, cssVar }) => ({
|
|
5
|
+
clear: css`
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
|
|
12
|
+
margin: 0;
|
|
13
|
+
padding: 0;
|
|
14
|
+
border: none;
|
|
15
|
+
|
|
16
|
+
color: ${cssVar.colorTextTertiary};
|
|
17
|
+
|
|
18
|
+
background: none;
|
|
19
|
+
outline: none;
|
|
20
|
+
|
|
21
|
+
transition: color 150ms ${cssVar.motionEaseOut};
|
|
22
|
+
|
|
23
|
+
&:hover {
|
|
24
|
+
color: ${cssVar.colorText};
|
|
25
|
+
}
|
|
26
|
+
`,
|
|
27
|
+
empty: css`
|
|
28
|
+
cursor: default;
|
|
29
|
+
|
|
30
|
+
&:empty {
|
|
31
|
+
display: none;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:hover {
|
|
35
|
+
background: transparent;
|
|
36
|
+
}
|
|
37
|
+
`,
|
|
38
|
+
list: css`
|
|
39
|
+
overflow-y: auto;
|
|
40
|
+
max-height: min(320px, var(--available-height));
|
|
41
|
+
|
|
42
|
+
&:empty {
|
|
43
|
+
display: none;
|
|
44
|
+
}
|
|
45
|
+
`,
|
|
46
|
+
popup: css`
|
|
47
|
+
transform-origin: var(--transform-origin);
|
|
48
|
+
width: var(--anchor-width);
|
|
49
|
+
min-width: 0;
|
|
50
|
+
transition:
|
|
51
|
+
opacity 140ms ${cssVar.motionEaseOut},
|
|
52
|
+
transform 140ms ${cssVar.motionEaseOut};
|
|
53
|
+
|
|
54
|
+
&[data-starting-style],
|
|
55
|
+
&[data-ending-style] {
|
|
56
|
+
transform: scaleY(0.92);
|
|
57
|
+
opacity: 0;
|
|
58
|
+
}
|
|
59
|
+
`
|
|
60
|
+
}));
|
|
61
|
+
const styles = {
|
|
62
|
+
clear: ownStyles.clear,
|
|
63
|
+
empty: [
|
|
64
|
+
styles$1.item,
|
|
65
|
+
styles$1.empty,
|
|
66
|
+
ownStyles.empty
|
|
67
|
+
].join(" "),
|
|
68
|
+
item: styles$1.item,
|
|
69
|
+
list: ownStyles.list,
|
|
70
|
+
popup: [styles$1.popup, ownStyles.popup].join(" "),
|
|
71
|
+
positioner: styles$1.positioner
|
|
72
|
+
};
|
|
73
|
+
//#endregion
|
|
74
|
+
export { styles };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=style.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.mjs","names":["menuStyles"],"sources":["../../../src/base-ui/AutoComplete/style.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\n\nimport { styles as menuStyles } from '@/base-ui/DropdownMenu/sharedStyle';\n\nconst ownStyles = createStaticStyles(({ css, cssVar }) => ({\n clear: css`\n cursor: pointer;\n\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n margin: 0;\n padding: 0;\n border: none;\n\n color: ${cssVar.colorTextTertiary};\n\n background: none;\n outline: none;\n\n transition: color 150ms ${cssVar.motionEaseOut};\n\n &:hover {\n color: ${cssVar.colorText};\n }\n `,\n empty: css`\n cursor: default;\n\n &:empty {\n display: none;\n }\n\n &:hover {\n background: transparent;\n }\n `,\n list: css`\n overflow-y: auto;\n max-height: min(320px, var(--available-height));\n\n &:empty {\n display: none;\n }\n `,\n popup: css`\n transform-origin: var(--transform-origin);\n width: var(--anchor-width);\n min-width: 0;\n transition:\n opacity 140ms ${cssVar.motionEaseOut},\n transform 140ms ${cssVar.motionEaseOut};\n\n &[data-starting-style],\n &[data-ending-style] {\n transform: scaleY(0.92);\n opacity: 0;\n }\n `,\n}));\n\nexport const styles = {\n clear: ownStyles.clear,\n empty: [menuStyles.item, menuStyles.empty, ownStyles.empty].join(' '),\n item: menuStyles.item,\n list: ownStyles.list,\n popup: [menuStyles.popup, ownStyles.popup].join(' '),\n positioner: menuStyles.positioner,\n};\n"],"mappings":";;;AAIA,MAAM,YAAY,oBAAoB,EAAE,KAAK,cAAc;CACzD,OAAO,GAAG;;;;;;;;;;;aAWC,OAAO,kBAAkB;;;;;8BAKR,OAAO,cAAc;;;eAGpC,OAAO,UAAU;;;CAG9B,OAAO,GAAG;;;;;;;;;;;CAWV,MAAM,GAAG;;;;;;;;CAQT,OAAO,GAAG;;;;;sBAKU,OAAO,cAAc;wBACnB,OAAO,cAAc;;;;;;;;CAQ5C,EAAE;AAEH,MAAa,SAAS;CACpB,OAAO,UAAU;CACjB,OAAO;EAACA,SAAW;EAAMA,SAAW;EAAO,UAAU;EAAM,CAAC,KAAK,IAAI;CACrE,MAAMA,SAAW;CACjB,MAAM,UAAU;CAChB,OAAO,CAACA,SAAW,OAAO,UAAU,MAAM,CAAC,KAAK,IAAI;CACpD,YAAYA,SAAW;CACxB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { InputProps } from "../Input/type.mjs";
|
|
2
|
+
import { CSSProperties, ComponentProps, ReactNode } from "react";
|
|
3
|
+
import { Autocomplete } from "@base-ui/react/autocomplete";
|
|
4
|
+
|
|
5
|
+
//#region src/base-ui/AutoComplete/type.d.ts
|
|
6
|
+
interface AutoCompleteOption {
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
label?: ReactNode;
|
|
9
|
+
value: string;
|
|
10
|
+
}
|
|
11
|
+
type BaseAutocompleteProps = Omit<ComponentProps<typeof Autocomplete.Root>, 'className' | 'style' | 'render' | 'children' | 'items' | 'onValueChange' | 'mode'>;
|
|
12
|
+
interface AutoCompleteProps extends BaseAutocompleteProps {
|
|
13
|
+
allowClear?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
classNames?: {
|
|
16
|
+
input?: string;
|
|
17
|
+
item?: string;
|
|
18
|
+
popup?: string;
|
|
19
|
+
};
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
emptyText?: ReactNode;
|
|
22
|
+
onChange?: (value: string) => void;
|
|
23
|
+
onSearch?: (value: string) => void;
|
|
24
|
+
options?: (string | AutoCompleteOption)[];
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
prefix?: InputProps['prefix'];
|
|
27
|
+
shadow?: boolean;
|
|
28
|
+
size?: InputProps['size'];
|
|
29
|
+
style?: CSSProperties;
|
|
30
|
+
styles?: {
|
|
31
|
+
input?: CSSProperties;
|
|
32
|
+
item?: CSSProperties;
|
|
33
|
+
popup?: CSSProperties;
|
|
34
|
+
};
|
|
35
|
+
suffix?: InputProps['suffix'];
|
|
36
|
+
variant?: InputProps['variant'];
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { AutoCompleteOption, AutoCompleteProps };
|
|
40
|
+
//# sourceMappingURL=type.d.mts.map
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { controlHeight } from "../controlSize.mjs";
|
|
1
2
|
import { createStaticStyles } from "antd-style";
|
|
2
3
|
//#region src/base-ui/Button/style.ts
|
|
3
4
|
const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
4
5
|
base: css`
|
|
5
6
|
cursor: pointer;
|
|
6
7
|
|
|
8
|
+
position: relative;
|
|
9
|
+
|
|
7
10
|
display: inline-flex;
|
|
8
11
|
gap: 6px;
|
|
9
12
|
align-items: center;
|
|
@@ -36,19 +39,19 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
|
|
|
36
39
|
}
|
|
37
40
|
`,
|
|
38
41
|
sizeSmall: css`
|
|
39
|
-
height:
|
|
42
|
+
height: ${controlHeight.small}px;
|
|
40
43
|
padding-inline: 8px;
|
|
41
44
|
border-radius: ${cssVar.borderRadiusSM};
|
|
42
45
|
font-size: 12px;
|
|
43
46
|
`,
|
|
44
47
|
sizeMiddle: css`
|
|
45
|
-
height:
|
|
48
|
+
height: ${controlHeight.middle}px;
|
|
46
49
|
padding-inline: 14px;
|
|
47
50
|
border-radius: ${cssVar.borderRadiusSM};
|
|
48
51
|
font-size: 13px;
|
|
49
52
|
`,
|
|
50
53
|
sizeLarge: css`
|
|
51
|
-
height:
|
|
54
|
+
height: ${controlHeight.large}px;
|
|
52
55
|
padding-inline: 16px;
|
|
53
56
|
border-radius: ${cssVar.borderRadius};
|
|
54
57
|
font-size: 14px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.mjs","names":[],"sources":["../../../src/base-ui/Button/style.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n base: css`\n cursor: pointer;\n\n display: inline-flex;\n gap: 6px;\n align-items: center;\n justify-content: center;\n\n box-sizing: border-box;\n border: 1px solid ${cssVar.colorBorder};\n\n font-weight: 500;\n line-height: 1;\n text-decoration: none;\n white-space: nowrap;\n\n transition:\n color 160ms cubic-bezier(0.32, 0.72, 0, 1),\n background 160ms cubic-bezier(0.32, 0.72, 0, 1),\n border-color 160ms cubic-bezier(0.32, 0.72, 0, 1),\n box-shadow 160ms cubic-bezier(0.32, 0.72, 0, 1);\n\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ${cssVar.colorPrimaryBorder};\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n pointer-events: none;\n cursor: not-allowed;\n opacity: 0.5;\n }\n `,\n\n sizeSmall: css`\n height: 24px;\n padding-inline: 8px;\n border-radius: ${cssVar.borderRadiusSM};\n font-size: 12px;\n `,\n\n sizeMiddle: css`\n height: 32px;\n padding-inline: 14px;\n border-radius: ${cssVar.borderRadiusSM};\n font-size: 13px;\n `,\n\n sizeLarge: css`\n height: 40px;\n padding-inline: 16px;\n border-radius: ${cssVar.borderRadius};\n font-size: 14px;\n `,\n\n shapeCircle: css`\n padding-inline: 0;\n border-radius: 50%;\n `,\n\n shapeRound: css`\n border-radius: 999px;\n `,\n\n block: css`\n width: 100%;\n `,\n\n iconEnd: css`\n flex-direction: row-reverse;\n `,\n\n iconOnlySmall: css`\n width: 24px;\n padding-inline: 0;\n `,\n\n iconOnlyMiddle: css`\n width: 32px;\n padding-inline: 0;\n `,\n\n iconOnlyLarge: css`\n width: 40px;\n padding-inline: 0;\n `,\n\n iconBox: css`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n `,\n\n spinnerSlot: css`\n overflow: hidden;\n\n width: 0;\n margin-inline-end: -6px;\n\n opacity: 0;\n\n transition:\n width 380ms cubic-bezier(0.22, 1, 0.36, 1),\n margin 380ms cubic-bezier(0.22, 1, 0.36, 1),\n opacity 260ms cubic-bezier(0.22, 1, 0.36, 1);\n `,\n\n spinnerSlotEnd: css`\n margin-inline: -6px 0;\n `,\n\n spinnerSlotShow: css`\n width: 12px;\n margin-inline: 0;\n opacity: 1;\n `,\n\n variantDefault: css`\n background: ${cssVar.colorBgContainer};\n\n /* &:hover/&:active included so the anchor form outranks antd's global a:hover/a:active link color */\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorText};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryBorder};\n color: ${cssVar.colorPrimaryText};\n }\n `,\n\n variantPrimary: css`\n border-color: ${cssVar.colorPrimary};\n background: ${cssVar.colorPrimary};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorBgLayout};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryHover};\n background: ${cssVar.colorPrimaryHover};\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryActive};\n background: ${cssVar.colorPrimaryActive};\n }\n `,\n\n variantDashed: css`\n border-style: dashed;\n background: ${cssVar.colorBgContainer};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorText};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryBorder};\n color: ${cssVar.colorPrimaryText};\n }\n `,\n\n variantFill: css`\n border-color: transparent;\n background: ${cssVar.colorFillTertiary};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorText};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n background: ${cssVar.colorFillSecondary};\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n background: ${cssVar.colorFill};\n }\n `,\n\n variantText: css`\n border-color: transparent;\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorText};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n background: ${cssVar.colorFillSecondary};\n }\n `,\n\n variantLink: css`\n padding-inline: 0;\n border-color: transparent;\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorPrimary};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n color: ${cssVar.colorPrimaryHover};\n background: transparent;\n }\n `,\n\n dangerOutlined: css`\n border-color: ${cssVar.colorError};\n background: ${cssVar.colorBgContainer};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorError};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorErrorHover};\n color: ${cssVar.colorErrorHover};\n background: ${cssVar.colorBgContainer};\n }\n `,\n\n dangerSolid: css`\n border-color: ${cssVar.colorError};\n background: ${cssVar.colorError};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorBgLayout};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorErrorHover};\n background: ${cssVar.colorErrorHover};\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorErrorActive};\n background: ${cssVar.colorErrorActive};\n }\n `,\n\n dangerFill: css`\n border-color: transparent;\n color: ${cssVar.colorError};\n background: ${cssVar.colorErrorBg};\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n color: ${cssVar.colorErrorHover};\n background: ${cssVar.colorErrorBgHover};\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n color: ${cssVar.colorErrorActive};\n background: ${cssVar.colorErrorBgHover};\n }\n `,\n\n dangerInline: css`\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorError};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n color: ${cssVar.colorErrorHover};\n }\n `,\n\n ghostDefault: css`\n border-color: rgb(255 255 255 / 65%);\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: #fff;\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: #fff;\n background: color-mix(in srgb, currentcolor 8%, transparent);\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n background: color-mix(in srgb, currentcolor 14%, transparent);\n }\n `,\n\n ghostDashed: css`\n border-style: dashed;\n `,\n\n ghostPrimary: css`\n border-color: ${cssVar.colorPrimary};\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorPrimary};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryHover};\n color: ${cssVar.colorPrimaryHover};\n background: color-mix(in srgb, currentcolor 8%, transparent);\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n background: color-mix(in srgb, currentcolor 14%, transparent);\n }\n `,\n\n ghostDanger: css`\n border-color: ${cssVar.colorError};\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorError};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorErrorHover};\n color: ${cssVar.colorErrorHover};\n background: color-mix(in srgb, currentcolor 8%, transparent);\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n background: color-mix(in srgb, currentcolor 14%, transparent);\n }\n `,\n\n spinner: css`\n @keyframes base-button-spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n display: inline-block;\n\n width: 12px;\n height: 12px;\n border: 1.5px solid currentcolor;\n border-block-start-color: transparent;\n border-radius: 50%;\n\n animation: base-button-spin 0.6s linear infinite;\n `,\n}));\n"],"mappings":";;AAEA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,MAAM,GAAG;;;;;;;;;wBASa,OAAO,YAAY;;;;;;;;;;;;;;;8BAeb,OAAO,mBAAmB;;;;;;;;;;CAWtD,WAAW,GAAG;;;qBAGK,OAAO,eAAe;;;CAIzC,YAAY,GAAG;;;qBAGI,OAAO,eAAe;;;CAIzC,WAAW,GAAG;;;qBAGK,OAAO,aAAa;;;CAIvC,aAAa,GAAG;;;;CAKhB,YAAY,GAAG;;;CAIf,OAAO,GAAG;;;CAIV,SAAS,GAAG;;;CAIZ,eAAe,GAAG;;;;CAKlB,gBAAgB,GAAG;;;;CAKnB,eAAe,GAAG;;;;CAKlB,SAAS,GAAG;;;;;CAMZ,aAAa,GAAG;;;;;;;;;;;;;CAchB,gBAAgB,GAAG;;;CAInB,iBAAiB,GAAG;;;;;CAMpB,gBAAgB,GAAG;kBACH,OAAO,iBAAiB;;;;;;eAM3B,OAAO,UAAU;;;;sBAIV,OAAO,mBAAmB;eACjC,OAAO,iBAAiB;;;CAIrC,gBAAgB,GAAG;oBACD,OAAO,aAAa;kBACtB,OAAO,aAAa;;;;;eAKvB,OAAO,cAAc;;;;sBAId,OAAO,kBAAkB;oBAC3B,OAAO,kBAAkB;;;;sBAIvB,OAAO,mBAAmB;oBAC5B,OAAO,mBAAmB;;;CAI5C,eAAe,GAAG;;kBAEF,OAAO,iBAAiB;;;;;eAK3B,OAAO,UAAU;;;;sBAIV,OAAO,mB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","names":[],"sources":["../../../src/base-ui/Button/style.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\n\nimport { controlHeight } from '@/base-ui/controlSize';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n base: css`\n cursor: pointer;\n\n position: relative;\n\n display: inline-flex;\n gap: 6px;\n align-items: center;\n justify-content: center;\n\n box-sizing: border-box;\n border: 1px solid ${cssVar.colorBorder};\n\n font-weight: 500;\n line-height: 1;\n text-decoration: none;\n white-space: nowrap;\n\n transition:\n color 160ms cubic-bezier(0.32, 0.72, 0, 1),\n background 160ms cubic-bezier(0.32, 0.72, 0, 1),\n border-color 160ms cubic-bezier(0.32, 0.72, 0, 1),\n box-shadow 160ms cubic-bezier(0.32, 0.72, 0, 1);\n\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ${cssVar.colorPrimaryBorder};\n }\n\n &:disabled,\n &[aria-disabled='true'] {\n pointer-events: none;\n cursor: not-allowed;\n opacity: 0.5;\n }\n `,\n\n sizeSmall: css`\n height: ${controlHeight.small}px;\n padding-inline: 8px;\n border-radius: ${cssVar.borderRadiusSM};\n font-size: 12px;\n `,\n\n sizeMiddle: css`\n height: ${controlHeight.middle}px;\n padding-inline: 14px;\n border-radius: ${cssVar.borderRadiusSM};\n font-size: 13px;\n `,\n\n sizeLarge: css`\n height: ${controlHeight.large}px;\n padding-inline: 16px;\n border-radius: ${cssVar.borderRadius};\n font-size: 14px;\n `,\n\n shapeCircle: css`\n padding-inline: 0;\n border-radius: 50%;\n `,\n\n shapeRound: css`\n border-radius: 999px;\n `,\n\n block: css`\n width: 100%;\n `,\n\n iconEnd: css`\n flex-direction: row-reverse;\n `,\n\n iconOnlySmall: css`\n width: 24px;\n padding-inline: 0;\n `,\n\n iconOnlyMiddle: css`\n width: 32px;\n padding-inline: 0;\n `,\n\n iconOnlyLarge: css`\n width: 40px;\n padding-inline: 0;\n `,\n\n iconBox: css`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n `,\n\n spinnerSlot: css`\n overflow: hidden;\n\n width: 0;\n margin-inline-end: -6px;\n\n opacity: 0;\n\n transition:\n width 380ms cubic-bezier(0.22, 1, 0.36, 1),\n margin 380ms cubic-bezier(0.22, 1, 0.36, 1),\n opacity 260ms cubic-bezier(0.22, 1, 0.36, 1);\n `,\n\n spinnerSlotEnd: css`\n margin-inline: -6px 0;\n `,\n\n spinnerSlotShow: css`\n width: 12px;\n margin-inline: 0;\n opacity: 1;\n `,\n\n variantDefault: css`\n background: ${cssVar.colorBgContainer};\n\n /* &:hover/&:active included so the anchor form outranks antd's global a:hover/a:active link color */\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorText};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryBorder};\n color: ${cssVar.colorPrimaryText};\n }\n `,\n\n variantPrimary: css`\n border-color: ${cssVar.colorPrimary};\n background: ${cssVar.colorPrimary};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorBgLayout};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryHover};\n background: ${cssVar.colorPrimaryHover};\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryActive};\n background: ${cssVar.colorPrimaryActive};\n }\n `,\n\n variantDashed: css`\n border-style: dashed;\n background: ${cssVar.colorBgContainer};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorText};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryBorder};\n color: ${cssVar.colorPrimaryText};\n }\n `,\n\n variantFill: css`\n border-color: transparent;\n background: ${cssVar.colorFillTertiary};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorText};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n background: ${cssVar.colorFillSecondary};\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n background: ${cssVar.colorFill};\n }\n `,\n\n variantText: css`\n border-color: transparent;\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorText};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n background: ${cssVar.colorFillSecondary};\n }\n `,\n\n variantLink: css`\n padding-inline: 0;\n border-color: transparent;\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorPrimary};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n color: ${cssVar.colorPrimaryHover};\n background: transparent;\n }\n `,\n\n dangerOutlined: css`\n border-color: ${cssVar.colorError};\n background: ${cssVar.colorBgContainer};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorError};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorErrorHover};\n color: ${cssVar.colorErrorHover};\n background: ${cssVar.colorBgContainer};\n }\n `,\n\n dangerSolid: css`\n border-color: ${cssVar.colorError};\n background: ${cssVar.colorError};\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorBgLayout};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorErrorHover};\n background: ${cssVar.colorErrorHover};\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorErrorActive};\n background: ${cssVar.colorErrorActive};\n }\n `,\n\n dangerFill: css`\n border-color: transparent;\n color: ${cssVar.colorError};\n background: ${cssVar.colorErrorBg};\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n color: ${cssVar.colorErrorHover};\n background: ${cssVar.colorErrorBgHover};\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n color: ${cssVar.colorErrorActive};\n background: ${cssVar.colorErrorBgHover};\n }\n `,\n\n dangerInline: css`\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorError};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n color: ${cssVar.colorErrorHover};\n }\n `,\n\n ghostDefault: css`\n border-color: rgb(255 255 255 / 65%);\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: #fff;\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: #fff;\n background: color-mix(in srgb, currentcolor 8%, transparent);\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n background: color-mix(in srgb, currentcolor 14%, transparent);\n }\n `,\n\n ghostDashed: css`\n border-style: dashed;\n `,\n\n ghostPrimary: css`\n border-color: ${cssVar.colorPrimary};\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorPrimary};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorPrimaryHover};\n color: ${cssVar.colorPrimaryHover};\n background: color-mix(in srgb, currentcolor 8%, transparent);\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n background: color-mix(in srgb, currentcolor 14%, transparent);\n }\n `,\n\n ghostDanger: css`\n border-color: ${cssVar.colorError};\n background: transparent;\n\n &,\n &:hover,\n &:active {\n color: ${cssVar.colorError};\n }\n\n &:hover:not(:disabled, [aria-disabled='true']) {\n border-color: ${cssVar.colorErrorHover};\n color: ${cssVar.colorErrorHover};\n background: color-mix(in srgb, currentcolor 8%, transparent);\n }\n\n &:active:not(:disabled, [aria-disabled='true']) {\n background: color-mix(in srgb, currentcolor 14%, transparent);\n }\n `,\n\n spinner: css`\n @keyframes base-button-spin {\n to {\n transform: rotate(360deg);\n }\n }\n\n display: inline-block;\n\n width: 12px;\n height: 12px;\n border: 1.5px solid currentcolor;\n border-block-start-color: transparent;\n border-radius: 50%;\n\n animation: base-button-spin 0.6s linear infinite;\n `,\n}));\n"],"mappings":";;;AAIA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,MAAM,GAAG;;;;;;;;;;;wBAWa,OAAO,YAAY;;;;;;;;;;;;;;;8BAeb,OAAO,mBAAmB;;;;;;;;;;CAWtD,WAAW,GAAG;cACF,cAAc,MAAM;;qBAEb,OAAO,eAAe;;;CAIzC,YAAY,GAAG;cACH,cAAc,OAAO;;qBAEd,OAAO,eAAe;;;CAI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;;;sBAId,OAAO,gBAAgB;oBACzB,OAAO,gBAAgB;;;;sBAIrB,OAAO,iBAAiB;oBAC1B,OAAO,iBAAiB;;;CAI1C,YAAY,GAAG;;aAEJ,OAAO,WAAW;kBACb,OAAO,aAAa;;;eAGvB,OAAO,gBAAgB;oBAClB,OAAO,kBAAkB;;;;eAI9B,OAAO,iBAAiB;oBACnB,OAAO,kBAAkB;;;CAI3C,cAAc,GAAG;;;;eAIJ,OAAO,WAAW;;;;eAIlB,OAAO,gBAAgB;;;CAIpC,cAAc,GAAG;;;;;;;;;;;;;;;;;;;CAoBjB,aAAa,GAAG;;;CAIhB,cAAc,GAAG;oBACC,OAAO,aAAa;;;;;;eAMzB,OAAO,aAAa;;;;sBAIb,OAAO,kBAAkB;eAChC,OAAO,kBAAkB;;;;;;;;CAStC,aAAa,GAAG;oBACE,OAAO,WAAW;;;;;;eAMvB,OAAO,WAAW;;;;sBAIX,OAAO,gBAAgB;eAC9B,OAAO,gBAAgB;;;;;;;;CASpC,SAAS,GAAG;;;;;;;;;;;;;;;;;CAiBb,EAAE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CheckboxProps } from "./type.mjs";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/base-ui/Checkbox/Checkbox.d.ts
|
|
5
|
+
declare const Checkbox: _$react.NamedExoticComponent<CheckboxProps>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { Checkbox };
|
|
8
|
+
//# sourceMappingURL=Checkbox.d.mts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import Text from "../../Text/Text.mjs";
|
|
3
|
+
import { styles } from "./style.mjs";
|
|
4
|
+
import { memo } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { cx } from "antd-style";
|
|
7
|
+
import { CheckIcon, Minus } from "lucide-react";
|
|
8
|
+
import { Checkbox } from "@base-ui/react/checkbox";
|
|
9
|
+
//#region src/base-ui/Checkbox/Checkbox.tsx
|
|
10
|
+
const Checkbox$1 = memo(({ size = 16, shape = "square", backgroundColor, children, className, classNames, styles: customStyles, style, textProps, onChange, disabled, indeterminate, ...rest }) => {
|
|
11
|
+
const boxStyle = {
|
|
12
|
+
borderRadius: shape === "square" ? `max(4px, ${Math.round(size / 4)}px)` : "50%",
|
|
13
|
+
height: size,
|
|
14
|
+
width: size,
|
|
15
|
+
...backgroundColor ? { "--lobe-checkbox-bg": backgroundColor } : {},
|
|
16
|
+
...children ? {} : style,
|
|
17
|
+
...customStyles?.checkbox
|
|
18
|
+
};
|
|
19
|
+
const box = /* @__PURE__ */ jsx(Checkbox.Root, {
|
|
20
|
+
disabled,
|
|
21
|
+
indeterminate,
|
|
22
|
+
style: boxStyle,
|
|
23
|
+
className: cx(styles.root, children ? classNames?.checkbox : className, classNames?.checkbox),
|
|
24
|
+
onCheckedChange: onChange,
|
|
25
|
+
...rest,
|
|
26
|
+
children: /* @__PURE__ */ jsx(Checkbox.Indicator, {
|
|
27
|
+
className: styles.indicator,
|
|
28
|
+
children: indeterminate ? /* @__PURE__ */ jsx(Minus, {
|
|
29
|
+
size,
|
|
30
|
+
strokeWidth: 3,
|
|
31
|
+
style: { transform: `scale(${shape === "square" ? .75 : .66})` }
|
|
32
|
+
}) : /* @__PURE__ */ jsx(CheckIcon, {
|
|
33
|
+
size,
|
|
34
|
+
strokeWidth: 3,
|
|
35
|
+
style: { transform: `scale(${shape === "square" ? .75 : .66})` }
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
if (!children) return box;
|
|
40
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
41
|
+
className: cx(styles.label, className, classNames?.wrapper),
|
|
42
|
+
style: {
|
|
43
|
+
gap: Math.floor(size / 2),
|
|
44
|
+
...style,
|
|
45
|
+
...customStyles?.wrapper
|
|
46
|
+
},
|
|
47
|
+
children: [box, /* @__PURE__ */ jsx(Text, {
|
|
48
|
+
as: "span",
|
|
49
|
+
className: classNames?.text,
|
|
50
|
+
style: customStyles?.text,
|
|
51
|
+
...textProps,
|
|
52
|
+
type: disabled ? "secondary" : textProps?.type,
|
|
53
|
+
children
|
|
54
|
+
})]
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
Checkbox$1.displayName = "Checkbox";
|
|
58
|
+
//#endregion
|
|
59
|
+
export { Checkbox$1 as default };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=Checkbox.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.mjs","names":["Checkbox","BaseCheckbox"],"sources":["../../../src/base-ui/Checkbox/Checkbox.tsx"],"sourcesContent":["'use client';\n\nimport { Checkbox as BaseCheckbox } from '@base-ui/react/checkbox';\nimport { cx } from 'antd-style';\nimport { CheckIcon, Minus } from 'lucide-react';\nimport { type CSSProperties, memo } from 'react';\n\nimport Text from '@/Text';\n\nimport { styles } from './style';\nimport type { CheckboxProps } from './type';\n\nconst Checkbox = memo<CheckboxProps>(\n ({\n size = 16,\n shape = 'square',\n backgroundColor,\n children,\n className,\n classNames,\n styles: customStyles,\n style,\n textProps,\n onChange,\n disabled,\n indeterminate,\n ...rest\n }) => {\n const boxStyle: CSSProperties = {\n borderRadius: shape === 'square' ? `max(4px, ${Math.round(size / 4)}px)` : '50%',\n height: size,\n width: size,\n ...(backgroundColor ? { '--lobe-checkbox-bg': backgroundColor } : {}),\n ...(children ? {} : style),\n ...customStyles?.checkbox,\n };\n\n const box = (\n <BaseCheckbox.Root\n disabled={disabled}\n indeterminate={indeterminate}\n style={boxStyle}\n className={cx(\n styles.root,\n children ? classNames?.checkbox : className,\n classNames?.checkbox,\n )}\n onCheckedChange={onChange}\n {...rest}\n >\n <BaseCheckbox.Indicator className={styles.indicator}>\n {indeterminate ? (\n <Minus\n size={size}\n strokeWidth={3}\n style={{ transform: `scale(${shape === 'square' ? 0.75 : 0.66})` }}\n />\n ) : (\n <CheckIcon\n size={size}\n strokeWidth={3}\n style={{ transform: `scale(${shape === 'square' ? 0.75 : 0.66})` }}\n />\n )}\n </BaseCheckbox.Indicator>\n </BaseCheckbox.Root>\n );\n\n if (!children) return box;\n\n return (\n <label\n className={cx(styles.label, className, classNames?.wrapper)}\n style={{ gap: Math.floor(size / 2), ...style, ...customStyles?.wrapper }}\n >\n {box}\n <Text\n as={'span'}\n className={classNames?.text}\n style={customStyles?.text}\n {...textProps}\n type={disabled ? 'secondary' : textProps?.type}\n >\n {children}\n </Text>\n </label>\n );\n },\n);\n\nCheckbox.displayName = 'Checkbox';\n\nexport default Checkbox;\n"],"mappings":";;;;;;;;;AAYA,MAAMA,aAAW,MACd,EACC,OAAO,IACP,QAAQ,UACR,iBACA,UACA,WACA,YACA,QAAQ,cACR,OACA,WACA,UACA,UACA,eACA,GAAG,WACC;CACJ,MAAM,WAA0B;EAC9B,cAAc,UAAU,WAAW,YAAY,KAAK,MAAM,OAAO,EAAE,CAAC,OAAO;EAC3E,QAAQ;EACR,OAAO;EACP,GAAI,kBAAkB,EAAE,sBAAsB,iBAAiB,GAAG,EAAE;EACpE,GAAI,WAAW,EAAE,GAAG;EACpB,GAAG,cAAc;EAClB;CAED,MAAM,MACJ,oBAACC,SAAa,MAAd;EACY;EACK;EACf,OAAO;EACP,WAAW,GACT,OAAO,MACP,WAAW,YAAY,WAAW,WAClC,YAAY,SACb;EACD,iBAAiB;EACjB,GAAI;YAEJ,oBAACA,SAAa,WAAd;GAAwB,WAAW,OAAO;aACvC,gBACC,oBAAC,OAAD;IACQ;IACN,aAAa;IACb,OAAO,EAAE,WAAW,SAAS,UAAU,WAAW,MAAO,IAAK,IAAI;IAClE,CAAA,GAEF,oBAAC,WAAD;IACQ;IACN,aAAa;IACb,OAAO,EAAE,WAAW,SAAS,UAAU,WAAW,MAAO,IAAK,IAAI;IAClE,CAAA;GAEmB,CAAA;EACP,CAAA;AAGtB,KAAI,CAAC,SAAU,QAAO;AAEtB,QACE,qBAAC,SAAD;EACE,WAAW,GAAG,OAAO,OAAO,WAAW,YAAY,QAAQ;EAC3D,OAAO;GAAE,KAAK,KAAK,MAAM,OAAO,EAAE;GAAE,GAAG;GAAO,GAAG,cAAc;GAAS;YAF1E,CAIG,KACD,oBAAC,MAAD;GACE,IAAI;GACJ,WAAW,YAAY;GACvB,OAAO,cAAc;GACrB,GAAI;GACJ,MAAM,WAAW,cAAc,WAAW;GAEzC;GACI,CAAA,CACD;;EAGb;AAED,WAAS,cAAc"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CheckboxGroupProps } from "./type.mjs";
|
|
2
|
+
import * as _$react from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/base-ui/Checkbox/CheckboxGroup.d.ts
|
|
5
|
+
declare const CheckboxGroup: _$react.NamedExoticComponent<CheckboxGroupProps>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { CheckboxGroup };
|
|
8
|
+
//# sourceMappingURL=CheckboxGroup.d.mts.map
|