@puzzle-ui/ui 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -70
- package/dist/components/data-display/empty-state/empty-state.css +128 -0
- package/dist/components/data-display/empty-state/empty-state.utils.cjs +6 -0
- package/dist/components/data-display/empty-state/empty-state.utils.cjs.map +1 -0
- package/dist/components/data-display/empty-state/empty-state.utils.js +6 -0
- package/dist/components/data-display/empty-state/empty-state.utils.js.map +1 -0
- package/dist/components/data-display/empty-state/index.cjs +49 -0
- package/dist/components/data-display/empty-state/index.cjs.map +1 -0
- package/dist/components/data-display/empty-state/index.d.cts +19 -0
- package/dist/components/data-display/empty-state/index.d.ts +19 -0
- package/dist/components/data-display/empty-state/index.js +44 -0
- package/dist/components/data-display/empty-state/index.js.map +1 -0
- package/dist/components/editors/text-editor/editor.cjs.map +1 -1
- package/dist/components/editors/text-editor/editor.js.map +1 -1
- package/dist/components/editors/text-editor/text-document.cjs.map +1 -1
- package/dist/components/editors/text-editor/text-document.js.map +1 -1
- package/dist/components/editors/text-editor/text-parser.cjs.map +1 -1
- package/dist/components/editors/text-editor/text-parser.js.map +1 -1
- package/dist/components/editors/text-editor/text-renderer.cjs.map +1 -1
- package/dist/components/editors/text-editor/text-renderer.js.map +1 -1
- package/dist/components/forms/autocomplete/index.cjs.map +1 -1
- package/dist/components/forms/autocomplete/index.js.map +1 -1
- package/dist/components/forms/color-picker/color-picker.css +351 -0
- package/dist/components/forms/color-picker/color-picker.types.d.cts +25 -0
- package/dist/components/forms/color-picker/color-picker.types.d.ts +25 -0
- package/dist/components/forms/color-picker/color-picker.utils.cjs +116 -0
- package/dist/components/forms/color-picker/color-picker.utils.cjs.map +1 -0
- package/dist/components/forms/color-picker/color-picker.utils.js +109 -0
- package/dist/components/forms/color-picker/color-picker.utils.js.map +1 -0
- package/dist/components/forms/color-picker/index.cjs +340 -0
- package/dist/components/forms/color-picker/index.cjs.map +1 -0
- package/dist/components/forms/color-picker/index.d.cts +3 -0
- package/dist/components/forms/color-picker/index.d.ts +3 -0
- package/dist/components/forms/color-picker/index.js +340 -0
- package/dist/components/forms/color-picker/index.js.map +1 -0
- package/dist/components/forms/file-upload/file-upload.utils.cjs.map +1 -1
- package/dist/components/forms/file-upload/file-upload.utils.js.map +1 -1
- package/dist/components/forms/input/number-input.js +5 -5
- package/dist/components/forms/input/number-input.js.map +1 -1
- package/dist/components/forms/input-group/index.d.cts +3 -0
- package/dist/components/forms/input-group/index.d.ts +3 -0
- package/dist/components/forms/input-group/input-group.cjs +18 -0
- package/dist/components/forms/input-group/input-group.cjs.map +1 -0
- package/dist/components/forms/input-group/input-group.css +62 -0
- package/dist/components/forms/input-group/input-group.d.cts +5 -0
- package/dist/components/forms/input-group/input-group.d.ts +5 -0
- package/dist/components/forms/input-group/input-group.js +18 -0
- package/dist/components/forms/input-group/input-group.js.map +1 -0
- package/dist/components/forms/input-group/input-group.types.d.cts +7 -0
- package/dist/components/forms/input-group/input-group.types.d.ts +7 -0
- package/dist/components/forms/input-group/input-group.utils.cjs +5 -0
- package/dist/components/forms/input-group/input-group.utils.cjs.map +1 -0
- package/dist/components/forms/input-group/input-group.utils.js +5 -0
- package/dist/components/forms/input-group/input-group.utils.js.map +1 -0
- package/dist/components/forms/select/index.cjs.map +1 -1
- package/dist/components/forms/select/index.js.map +1 -1
- package/dist/components/forms/slider/index.cjs +1 -1
- package/dist/components/forms/slider/index.cjs.map +1 -1
- package/dist/components/forms/slider/index.js +1 -1
- package/dist/components/forms/slider/index.js.map +1 -1
- package/dist/components/layout/resizable-panels/index.cjs +1 -1
- package/dist/components/layout/resizable-panels/index.cjs.map +1 -1
- package/dist/components/layout/resizable-panels/index.js +1 -1
- package/dist/components/layout/resizable-panels/index.js.map +1 -1
- package/dist/components/layout/resizable-panels/resizable-panels.utils.cjs.map +1 -1
- package/dist/components/layout/resizable-panels/resizable-panels.utils.js.map +1 -1
- package/dist/components/navigation/accordion/index.cjs.map +1 -1
- package/dist/components/navigation/accordion/index.js.map +1 -1
- package/dist/components/navigation/carousel/index.cjs +1 -1
- package/dist/components/navigation/carousel/index.cjs.map +1 -1
- package/dist/components/navigation/carousel/index.js +1 -1
- package/dist/components/navigation/carousel/index.js.map +1 -1
- package/dist/components/navigation/pagination/index.cjs +146 -0
- package/dist/components/navigation/pagination/index.cjs.map +1 -0
- package/dist/components/navigation/pagination/index.d.cts +3 -0
- package/dist/components/navigation/pagination/index.d.ts +3 -0
- package/dist/components/navigation/pagination/index.js +146 -0
- package/dist/components/navigation/pagination/index.js.map +1 -0
- package/dist/components/navigation/pagination/pagination.css +134 -0
- package/dist/components/navigation/pagination/pagination.types.d.cts +38 -0
- package/dist/components/navigation/pagination/pagination.types.d.ts +38 -0
- package/dist/components/navigation/pagination/pagination.utils.cjs +54 -0
- package/dist/components/navigation/pagination/pagination.utils.cjs.map +1 -0
- package/dist/components/navigation/pagination/pagination.utils.js +53 -0
- package/dist/components/navigation/pagination/pagination.utils.js.map +1 -0
- package/dist/components/navigation/tree-view/index.cjs.map +1 -1
- package/dist/components/navigation/tree-view/index.js.map +1 -1
- package/dist/components/overlays/dropdown-menu/dropdown-menu-content.cjs.map +1 -1
- package/dist/components/overlays/dropdown-menu/dropdown-menu-content.js.map +1 -1
- package/dist/components/overlays/dropdown-menu/dropdown-menu.utils.cjs.map +1 -1
- package/dist/components/overlays/dropdown-menu/dropdown-menu.utils.js.map +1 -1
- package/dist/components/utilities/preview/index.cjs +1 -1
- package/dist/components/utilities/preview/index.cjs.map +1 -1
- package/dist/components/utilities/preview/index.js +1 -1
- package/dist/components/utilities/preview/index.js.map +1 -1
- package/dist/index.cjs +110 -97
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +5 -1
- package/package.json +6 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["useEffect","useLayoutEffect","Background","useId","useThemeScope","useState","useRef","useRovingFocus","useCallback","cn","Icon","createPortal","ThemeScopeProvider","highlightCode"],"sources":["../../../../src/components/utilities/preview/index.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type ComponentProps,\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@puzzle-ui/core\";\nimport { useRovingFocus } from \"@puzzle-ui/hooks\";\nimport { Icon } from \"@puzzle-ui/icons\";\nimport { ThemeScopeProvider, useThemeScope } from \"@puzzle-ui/theme/scope-context\";\n\nimport { Background } from \"../../layout/background\";\nimport { highlightCode } from \"./highlight\";\n\nimport \"./preview.css\";\n\ntype PreviewDevice = \"mobile\" | \"tablet\" | \"desktop\";\ntype PreviewTab = \"preview\" | \"code\";\n\ntype DeviceConfig = {\n label: string;\n width: number;\n height: number;\n};\n\ntype PreviewAlign = \"start\" | \"center\" | \"end\" | \"stretch\";\ntype PreviewJustify =\n | \"start\"\n | \"center\"\n | \"end\"\n | \"between\"\n | \"around\"\n | \"evenly\";\n\ntype PreviewProps = {\n children: ReactNode;\n className?: string;\n defaultDevice?: PreviewDevice;\n code?: string;\n /** Frame height in pixels. Defaults to the selected device's height. */\n height?: number;\n /** Vertical alignment of the content within the frame. */\n align?: PreviewAlign;\n /** Horizontal distribution of the content within the frame. */\n justify?: PreviewJustify;\n /** Hides the device selector. The default device is still used. */\n hideDevices?: boolean;\n};\n\nconst PREVIEW_DEVICES: Record<PreviewDevice, DeviceConfig> = {\n mobile: { label: \"Mobile\", width: 390, height: 844 },\n tablet: { label: \"Tablet\", width: 768, height: 1024 },\n desktop: { label: \"Desktop\", width: 1024, height: 768 },\n};\n\nconst PREVIEW_DEVICE_ITEMS = (\n Object.keys(PREVIEW_DEVICES) as PreviewDevice[]\n).map((id) => ({ id }));\n\nconst ALIGN_VALUES: Record<PreviewAlign, string> = {\n start: \"flex-start\",\n center: \"center\",\n end: \"flex-end\",\n stretch: \"stretch\",\n};\n\nconst JUSTIFY_VALUES: Record<PreviewJustify, string> = {\n start: \"flex-start\",\n center: \"center\",\n end: \"flex-end\",\n between: \"space-between\",\n around: \"space-around\",\n evenly: \"space-evenly\",\n};\n\nconst createPreviewDocument = (rootId: string) => `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n </head>\n <body>\n <div id=\"${rootId}\"></div>\n </body>\n</html>`;\n\nconst useIsomorphicLayoutEffect =\n typeof window === \"undefined\" ? useEffect : useLayoutEffect;\n\nconst PreviewBackground = (props: ComponentProps<\"div\">) => (\n <Background\n pattern=\"blueprint\"\n size={20}\n majorSize={100}\n lineWidth={1}\n patternOpacity={0.25}\n {...props}\n />\n);\n\nconst Preview = ({\n children,\n className,\n defaultDevice = \"mobile\",\n code,\n height,\n align,\n justify,\n hideDevices = false,\n}: PreviewProps) => {\n const generatedId = useId();\n const frameRootId = `${generatedId}-root`;\n const previewTabId = `${generatedId}-tab-preview`;\n const codeTabId = `${generatedId}-tab-code`;\n const panelId = `${generatedId}-panel`;\n\n const themeScope = useThemeScope();\n\n const [device, setDevice] = useState<PreviewDevice>(defaultDevice);\n const [activeTab, setActiveTab] = useState<PreviewTab>(\"preview\");\n const [frameRoot, setFrameRoot] = useState<HTMLElement | null>(null);\n const [scale, setScale] = useState(1);\n const [copied, setCopied] = useState(false);\n\n const containerRef = useRef<HTMLDivElement>(null);\n const iframeRef = useRef<HTMLIFrameElement>(null);\n const copyTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const config = PREVIEW_DEVICES[device];\n const frameHeight = height ?? config.height;\n const hasCode = code !== undefined;\n const [direction, setDirection] = useState<\"ltr\" | \"rtl\">(\"ltr\");\n const sectionRef = useRef<HTMLElement>(null);\n const isKeyboardNavigation = useRef(false);\n\n useLayoutEffect(() => {\n const section = sectionRef.current;\n\n if (section) {\n const isRtl =\n getComputedStyle(section).direction === \"rtl\" ||\n section.closest(\"[dir]\")?.getAttribute(\"dir\")?.toLowerCase() === \"rtl\";\n\n setDirection(isRtl ? \"rtl\" : \"ltr\");\n }\n }, []);\n\n const rovingFocus = useRovingFocus<HTMLButtonElement>({\n items: hasCode ? [{ id: \"preview\" }, { id: \"code\" }] : [{ id: \"preview\" }],\n dir: direction,\n initialActiveId: activeTab,\n });\n\n const deviceFocus = useRovingFocus<HTMLButtonElement>({\n items: PREVIEW_DEVICE_ITEMS,\n dir: direction,\n initialActiveId: device,\n });\n\n const handleTabKeyDown = (\n event: KeyboardEvent<HTMLButtonElement>,\n tab: PreviewTab,\n ) => {\n isKeyboardNavigation.current = true;\n\n try {\n rovingFocus.onItemKeyDown(event, tab);\n } finally {\n isKeyboardNavigation.current = false;\n }\n };\n\n const handleTabFocus = (tab: PreviewTab) => {\n rovingFocus.onItemFocus(tab);\n\n if (isKeyboardNavigation.current) {\n setActiveTab(tab);\n }\n };\n\n const syncStyles = useCallback(() => {\n const frameDocument = iframeRef.current?.contentDocument;\n\n if (!frameDocument) return;\n\n const frameHead = frameDocument.head;\n\n frameHead\n .querySelectorAll(\"[data-puzzle-preview-style]\")\n .forEach((element) => element.remove());\n\n document\n .querySelectorAll(\n [\n \"head link[rel='stylesheet']\",\n \"head style\",\n \"style[data-puzzle-theme]\",\n \"style[data-puzzle-theme-scope-style]\",\n ].join(\", \"),\n )\n .forEach((element) => {\n const clone = element.cloneNode(true) as HTMLElement;\n\n clone.setAttribute(\"data-puzzle-preview-style\", \"\");\n frameHead.appendChild(clone);\n });\n\n const sourceRoot = document.documentElement;\n const targetRoot = frameDocument.documentElement;\n\n targetRoot.style.cssText = sourceRoot.style.cssText;\n targetRoot.className = sourceRoot.className;\n\n Array.from(sourceRoot.attributes).forEach((attribute) => {\n if (attribute.name === \"style\" || attribute.name === \"class\") {\n return;\n }\n\n targetRoot.setAttribute(attribute.name, attribute.value);\n });\n\n const body = frameDocument.body;\n\n body.className = document.body.className;\n body.style.cssText = document.body.style.cssText;\n\n targetRoot.style.setProperty(\"box-sizing\", \"border-box\", \"important\");\n targetRoot.style.setProperty(\"width\", \"100%\", \"important\");\n targetRoot.style.setProperty(\"height\", \"100%\", \"important\");\n targetRoot.style.setProperty(\"min-height\", \"100%\", \"important\");\n targetRoot.style.setProperty(\"margin\", \"0\", \"important\");\n targetRoot.style.setProperty(\"overflow-x\", \"hidden\", \"important\");\n targetRoot.style.setProperty(\"overflow-y\", \"auto\", \"important\");\n targetRoot.style.setProperty(\"scrollbar-width\", \"none\", \"important\");\n targetRoot.style.setProperty(\"-ms-overflow-style\", \"none\", \"important\");\n\n body.style.setProperty(\"display\", \"block\", \"important\");\n body.style.setProperty(\"position\", \"static\", \"important\");\n body.style.setProperty(\"box-sizing\", \"border-box\", \"important\");\n body.style.setProperty(\"width\", \"100%\", \"important\");\n body.style.setProperty(\"height\", \"auto\", \"important\");\n body.style.setProperty(\"min-height\", \"100%\", \"important\");\n body.style.setProperty(\"margin\", \"0\", \"important\");\n body.style.setProperty(\"overflow\", \"visible\", \"important\");\n\n const previewRoot = frameDocument.getElementById(frameRootId);\n\n previewRoot?.style.removeProperty(\"min-height\");\n\n const scrollbarStyle = frameDocument.createElement(\"style\");\n\n scrollbarStyle.setAttribute(\"data-puzzle-preview-style\", \"\");\n scrollbarStyle.textContent = `\n html,\n body {\n scrollbar-width: none !important;\n -ms-overflow-style: none !important;\n }\n\n html::-webkit-scrollbar,\n body::-webkit-scrollbar {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n }\n `;\n\n frameHead.appendChild(scrollbarStyle);\n }, [frameRootId]);\n\n const updateScale = useCallback(\n (availableWidth: number) => {\n const nextScale = Math.min(1, Math.max(0, availableWidth) / config.width);\n\n setScale((current) =>\n Math.abs(current - nextScale) < 0.001 ? current : nextScale,\n );\n },\n [config.width],\n );\n\n useIsomorphicLayoutEffect(() => {\n const container = containerRef.current;\n\n if (!container) return;\n\n const measure = () => {\n const styles = window.getComputedStyle(container);\n const horizontalPadding =\n parseFloat(styles.paddingLeft) + parseFloat(styles.paddingRight);\n\n updateScale(container.clientWidth - horizontalPadding);\n };\n\n measure();\n\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0];\n\n if (entry) {\n updateScale(entry.contentRect.width);\n }\n });\n\n observer.observe(container);\n\n return () => observer.disconnect();\n }, [updateScale]);\n\n useEffect(() => {\n const isStyleNode = (node: Node) =>\n node instanceof Element &&\n (node.matches(\"style, link[rel='stylesheet']\") ||\n node.querySelector(\"style, link[rel='stylesheet']\") !== null);\n\n const headObserver = new MutationObserver(syncStyles);\n\n headObserver.observe(document.head, {\n childList: true,\n subtree: true,\n characterData: true,\n attributes: true,\n });\n\n const bodyObserver = new MutationObserver((mutations) => {\n const affectsStyles = mutations.some((mutation) => {\n const target =\n mutation.target instanceof Element\n ? mutation.target\n : mutation.target.parentElement;\n\n return (\n target?.closest(\n \"style[data-puzzle-theme], style[data-puzzle-theme-scope-style]\",\n ) != null ||\n Array.from(mutation.addedNodes).some(isStyleNode) ||\n Array.from(mutation.removedNodes).some(isStyleNode)\n );\n });\n\n if (affectsStyles) {\n syncStyles();\n }\n });\n\n bodyObserver.observe(document.body, {\n childList: true,\n subtree: true,\n characterData: true,\n attributes: true,\n attributeFilter: [\"data-theme\"],\n });\n\n return () => {\n headObserver.disconnect();\n bodyObserver.disconnect();\n };\n }, [syncStyles]);\n\n const initializeFrame = useCallback(() => {\n const frameDocument = iframeRef.current?.contentDocument;\n const root = frameDocument?.getElementById(frameRootId);\n\n if (!root) return;\n\n syncStyles();\n setFrameRoot(root);\n }, [frameRootId, syncStyles]);\n\n useEffect(() => {\n initializeFrame();\n }, [initializeFrame]);\n\n const handleCopyCode = useCallback(async () => {\n if (code === undefined) return;\n\n try {\n await navigator.clipboard.writeText(code);\n setCopied(true);\n\n if (copyTimeoutRef.current) {\n clearTimeout(copyTimeoutRef.current);\n }\n\n copyTimeoutRef.current = setTimeout(() => {\n setCopied(false);\n }, 2000);\n } catch {\n setCopied(false);\n }\n }, [code]);\n\n useEffect(\n () => () => {\n if (copyTimeoutRef.current) {\n clearTimeout(copyTimeoutRef.current);\n }\n },\n [],\n );\n\n useEffect(() => {\n if (!hasCode && activeTab === \"code\") {\n setActiveTab(\"preview\");\n }\n }, [activeTab, hasCode]);\n\n const frameStyle: CSSProperties = {\n width: config.width,\n height: frameHeight,\n transform: `scale(${scale})`,\n transformOrigin: \"top left\",\n };\n\n const contentStyle: CSSProperties = {\n display: \"flex\",\n boxSizing: \"border-box\",\n minHeight: \"100vh\",\n alignItems: align ? ALIGN_VALUES[align] : undefined,\n justifyContent: justify ? JUSTIFY_VALUES[justify] : undefined,\n };\n\n const viewportStyle: CSSProperties = {\n width: config.width * scale,\n aspectRatio: `${config.width} / ${frameHeight}`,\n };\n\n const panelProps = {\n id: panelId,\n role: \"tabpanel\",\n \"aria-labelledby\": activeTab === \"preview\" ? previewTabId : codeTabId,\n };\n\n return (\n <section ref={sectionRef} className={cn(\"puzzle-preview\", className)}>\n <div className=\"puzzle-preview__toolbar\">\n <div\n className=\"puzzle-preview__tabs\"\n role=\"tablist\"\n aria-label=\"Preview view\"\n >\n <button\n type=\"button\"\n role=\"tab\"\n id={previewTabId}\n ref={rovingFocus.getItemRef(\"preview\")}\n tabIndex={activeTab === \"preview\" ? 0 : -1}\n onFocus={() => handleTabFocus(\"preview\")}\n onKeyDown={(event) => handleTabKeyDown(event, \"preview\")}\n aria-selected={activeTab === \"preview\"}\n aria-controls={panelId}\n className={cn(\n \"puzzle-preview__tab\",\n activeTab === \"preview\" && \"puzzle-preview__tab--active\",\n )}\n onClick={() => setActiveTab(\"preview\")}\n >\n Preview\n </button>\n\n {hasCode && (\n <button\n type=\"button\"\n role=\"tab\"\n id={codeTabId}\n ref={rovingFocus.getItemRef(\"code\")}\n tabIndex={activeTab === \"code\" ? 0 : -1}\n onFocus={() => handleTabFocus(\"code\")}\n onKeyDown={(event) => handleTabKeyDown(event, \"code\")}\n aria-selected={activeTab === \"code\"}\n aria-controls={panelId}\n className={cn(\n \"puzzle-preview__tab\",\n activeTab === \"code\" && \"puzzle-preview__tab--active\",\n )}\n onClick={() => setActiveTab(\"code\")}\n >\n Code\n </button>\n )}\n </div>\n\n {activeTab === \"preview\" ? (\n <div className=\"puzzle-preview__toolbar-actions\">\n {!hideDevices && (\n <div\n className=\"puzzle-preview__devices\"\n role=\"group\"\n aria-label=\"Device size\"\n >\n {(Object.keys(PREVIEW_DEVICES) as PreviewDevice[]).map(\n (item) => (\n <button\n key={item}\n ref={deviceFocus.getItemRef(item)}\n type=\"button\"\n className={cn(\n \"puzzle-preview__device\",\n device === item && \"puzzle-preview__device--active\",\n )}\n aria-pressed={device === item}\n tabIndex={deviceFocus.getItemTabIndex(item)}\n onFocus={() => deviceFocus.onItemFocus(item)}\n onKeyDown={(event) =>\n deviceFocus.onItemKeyDown(event, item)\n }\n onClick={() => setDevice(item)}\n >\n {PREVIEW_DEVICES[item].label}\n </button>\n ),\n )}\n </div>\n )}\n\n <span className=\"puzzle-preview__dimensions\">\n {config.width} × {frameHeight}\n </span>\n </div>\n ) : (\n <button\n type=\"button\"\n className=\"puzzle-preview__copy\"\n onClick={handleCopyCode}\n aria-label={copied ? \"Code copied\" : \"Copy code\"}\n >\n <Icon\n name={copied ? \"tabler:check\" : \"tabler:copy\"}\n size={16}\n aria-hidden=\"true\"\n />\n <span>{copied ? \"Copied\" : \"Copy code\"}</span>\n </button>\n )}\n </div>\n\n <PreviewBackground {...panelProps} className=\"puzzle-preview__panel\">\n <div\n ref={containerRef}\n className=\"puzzle-preview__stage\"\n hidden={activeTab !== \"preview\"}\n >\n <div className=\"puzzle-preview__viewport\" style={viewportStyle}>\n <iframe\n ref={iframeRef}\n className=\"puzzle-preview__frame\"\n srcDoc={createPreviewDocument(frameRootId)}\n title={`${config.label} component preview`}\n onLoad={initializeFrame}\n style={frameStyle}\n />\n\n {frameRoot &&\n createPortal(\n <ThemeScopeProvider\n scopeId={themeScope?.scopeId ?? null}\n theme={themeScope?.theme ?? \"system\"}\n >\n <div style={contentStyle}>{children}</div>\n </ThemeScopeProvider>,\n frameRoot,\n )}\n </div>\n </div>\n\n {activeTab === \"code\" && (\n <div className=\"puzzle-preview__code\">\n <pre>\n <code className=\"language-tsx\">\n {code === undefined ? null : highlightCode(code)}\n </code>\n </pre>\n </div>\n )}\n </PreviewBackground>\n\n <span\n className=\"puzzle-preview__copy-status\"\n role=\"status\"\n aria-live=\"polite\"\n >\n {copied ? \"Code copied to clipboard.\" : \"\"}\n </span>\n </section>\n );\n};\n\nexport {\n Preview,\n type PreviewProps,\n type PreviewDevice,\n type PreviewAlign,\n type PreviewJustify,\n};\n"],"mappings":";;;;;;;;;;;;AA2DA,MAAM,kBAAuD;CAC3D,QAAQ;EAAE,OAAO;EAAU,OAAO;EAAK,QAAQ;CAAI;CACnD,QAAQ;EAAE,OAAO;EAAU,OAAO;EAAK,QAAQ;CAAK;CACpD,SAAS;EAAE,OAAO;EAAW,OAAO;EAAM,QAAQ;CAAI;AACxD;AAEA,MAAM,uBACJ,OAAO,KAAK,eAAe,CAAC,CAC5B,KAAK,QAAQ,EAAE,GAAG,EAAE;AAEtB,MAAM,eAA6C;CACjD,OAAO;CACP,QAAQ;CACR,KAAK;CACL,SAAS;AACX;AAEA,MAAM,iBAAiD;CACrD,OAAO;CACP,QAAQ;CACR,KAAK;CACL,SAAS;CACT,QAAQ;CACR,QAAQ;AACV;AAEA,MAAM,yBAAyB,WAAmB;;;;;;;eAOnC,OAAO;;;AAItB,MAAM,4BACJ,OAAO,WAAW,cAAcA,MAAAA,YAAYC,MAAAA;AAE9C,MAAM,qBAAqB,UACzB,iBAAA,GAAA,kBAAA,IAAA,CAACC,cAAAA,YAAD;CACE,SAAQ;CACR,MAAM;CACN,WAAW;CACX,WAAW;CACX,gBAAgB;CAChB,GAAI;AACL,CAAA;AAGH,MAAM,WAAW,EACf,UACA,WACA,gBAAgB,UAChB,MACA,QACA,OACA,SACA,cAAc,YACI;CAClB,MAAM,eAAA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AAA,kBAAA,IAAA,CAACC,+BAAAA,oBAAD;OACE,SAAS,YAAY,WAAW;OAChC,OAAO,YAAY,SAAS;OAE5B,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;QAAK,OAAO;QAAe;OAAc,CAAA;MACvB,CAAA,GACpB,SACF,CACC;;IACF,CAAA,GAEJ,cAAc,UACb,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;KAAK,WAAU;KACb,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;MAAM,WAAU;MACb,UAAA,SAAS,KAAA,IAAY,OAAOC,kBAAAA,cAAc,IAAI;KAC3C,CAAA,EACH,CAAA;IACF,CAAA,CAEU;;GAEnB,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IACE,WAAU;IACV,MAAK;IACL,aAAU;IAET,UAAA,SAAS,8BAA8B;GACpC,CAAA;EACC;;AAEb"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["useEffect","useLayoutEffect","Background","useId","useThemeScope","useState","useRef","useRovingFocus","useCallback","cn","Icon","createPortal","ThemeScopeProvider","highlightCode"],"sources":["../../../../src/components/utilities/preview/index.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type ComponentProps,\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@puzzle-ui/core\";\nimport { useRovingFocus } from \"@puzzle-ui/hooks\";\nimport { Icon } from \"@puzzle-ui/icons\";\nimport { ThemeScopeProvider, useThemeScope } from \"@puzzle-ui/theme/scope-context\";\n\nimport { Background } from \"../../layout/background\";\nimport { highlightCode } from \"./highlight\";\n\nimport \"./preview.css\";\n\ntype PreviewDevice = \"mobile\" | \"tablet\" | \"desktop\";\ntype PreviewTab = \"preview\" | \"code\";\n\ntype DeviceConfig = {\n label: string;\n width: number;\n height: number;\n};\n\ntype PreviewAlign = \"start\" | \"center\" | \"end\" | \"stretch\";\ntype PreviewJustify =\n | \"start\"\n | \"center\"\n | \"end\"\n | \"between\"\n | \"around\"\n | \"evenly\";\n\ntype PreviewProps = {\n children: ReactNode;\n className?: string;\n defaultDevice?: PreviewDevice;\n code?: string;\n /** Frame height in pixels. Defaults to the selected device's height. */\n height?: number;\n /** Vertical alignment of the content within the frame. */\n align?: PreviewAlign;\n /** Horizontal distribution of the content within the frame. */\n justify?: PreviewJustify;\n /** Hides the device selector. The default device is still used. */\n hideDevices?: boolean;\n};\n\nconst PREVIEW_DEVICES: Record<PreviewDevice, DeviceConfig> = {\n mobile: { label: \"Mobile\", width: 390, height: 844 },\n tablet: { label: \"Tablet\", width: 768, height: 1024 },\n desktop: { label: \"Desktop\", width: 1024, height: 768 },\n};\n\nconst PREVIEW_DEVICE_ITEMS = (\n Object.keys(PREVIEW_DEVICES) as PreviewDevice[]\n).map((id) => ({ id }));\n\nconst ALIGN_VALUES: Record<PreviewAlign, string> = {\n start: \"flex-start\",\n center: \"center\",\n end: \"flex-end\",\n stretch: \"stretch\",\n};\n\nconst JUSTIFY_VALUES: Record<PreviewJustify, string> = {\n start: \"flex-start\",\n center: \"center\",\n end: \"flex-end\",\n between: \"space-between\",\n around: \"space-around\",\n evenly: \"space-evenly\",\n};\n\nconst createPreviewDocument = (rootId: string) => `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n </head>\n <body>\n <div id=\"${rootId}\"></div>\n </body>\n</html>`;\n\nconst useIsomorphicLayoutEffect =\n typeof window === \"undefined\" ? useEffect : useLayoutEffect;\n\nconst PreviewBackground = (props: ComponentProps<\"div\">) => (\n <Background\n pattern=\"blueprint\"\n size={20}\n majorSize={100}\n lineWidth={1}\n patternOpacity={0.25}\n {...props}\n />\n);\n\nconst Preview = ({\n children,\n className,\n defaultDevice = \"mobile\",\n code,\n height,\n align,\n justify,\n hideDevices = false,\n}: PreviewProps) => {\n const generatedId = useId();\n const frameRootId = `${generatedId}-root`;\n const previewTabId = `${generatedId}-tab-preview`;\n const codeTabId = `${generatedId}-tab-code`;\n const panelId = `${generatedId}-panel`;\n\n const themeScope = useThemeScope();\n\n const [device, setDevice] = useState<PreviewDevice>(defaultDevice);\n const [activeTab, setActiveTab] = useState<PreviewTab>(\"preview\");\n const [frameRoot, setFrameRoot] = useState<HTMLElement | null>(null);\n const [scale, setScale] = useState(1);\n const [copied, setCopied] = useState(false);\n\n const containerRef = useRef<HTMLDivElement>(null);\n const iframeRef = useRef<HTMLIFrameElement>(null);\n const copyTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const config = PREVIEW_DEVICES[device];\n const frameHeight = height ?? config.height;\n const hasCode = code !== undefined;\n const [direction, setDirection] = useState<\"ltr\" | \"rtl\">(\"ltr\");\n const sectionRef = useRef<HTMLElement>(null);\n const isKeyboardNavigation = useRef(false);\n\n useLayoutEffect(() => {\n const section = sectionRef.current;\n\n if (section) {\n const isRtl =\n getComputedStyle(section).direction === \"rtl\" ||\n section.closest(\"[dir]\")?.getAttribute(\"dir\")?.toLowerCase() === \"rtl\";\n\n setDirection(isRtl ? \"rtl\" : \"ltr\");\n }\n }, []);\n\n const rovingFocus = useRovingFocus<HTMLButtonElement>({\n items: hasCode ? [{ id: \"preview\" }, { id: \"code\" }] : [{ id: \"preview\" }],\n dir: direction,\n initialActiveId: activeTab,\n });\n\n const deviceFocus = useRovingFocus<HTMLButtonElement>({\n items: PREVIEW_DEVICE_ITEMS,\n dir: direction,\n initialActiveId: device,\n });\n\n const handleTabKeyDown = (\n event: KeyboardEvent<HTMLButtonElement>,\n tab: PreviewTab,\n ) => {\n isKeyboardNavigation.current = true;\n\n try {\n rovingFocus.onItemKeyDown(event, tab);\n } finally {\n isKeyboardNavigation.current = false;\n }\n };\n\n const handleTabFocus = (tab: PreviewTab) => {\n rovingFocus.onItemFocus(tab);\n\n if (isKeyboardNavigation.current) {\n setActiveTab(tab);\n }\n };\n\n const syncStyles = useCallback(() => {\n const frameDocument = iframeRef.current?.contentDocument;\n\n if (!frameDocument) return;\n\n const frameHead = frameDocument.head;\n\n frameHead\n .querySelectorAll(\"[data-puzzle-preview-style]\")\n .forEach((element) => element.remove());\n\n document\n .querySelectorAll(\n [\n \"head link[rel='stylesheet']\",\n \"head style\",\n \"style[data-puzzle-theme]\",\n \"style[data-puzzle-theme-scope-style]\",\n ].join(\", \"),\n )\n .forEach((element) => {\n const clone = element.cloneNode(true) as HTMLElement;\n\n clone.setAttribute(\"data-puzzle-preview-style\", \"\");\n frameHead.appendChild(clone);\n });\n\n const sourceRoot = document.documentElement;\n const targetRoot = frameDocument.documentElement;\n\n targetRoot.style.cssText = sourceRoot.style.cssText;\n targetRoot.className = sourceRoot.className;\n\n Array.from(sourceRoot.attributes).forEach((attribute) => {\n if (attribute.name === \"style\" || attribute.name === \"class\") {\n return;\n }\n\n targetRoot.setAttribute(attribute.name, attribute.value);\n });\n\n const body = frameDocument.body;\n\n body.className = document.body.className;\n body.style.cssText = document.body.style.cssText;\n\n targetRoot.style.setProperty(\"box-sizing\", \"border-box\", \"important\");\n targetRoot.style.setProperty(\"width\", \"100%\", \"important\");\n targetRoot.style.setProperty(\"height\", \"100%\", \"important\");\n targetRoot.style.setProperty(\"min-height\", \"100%\", \"important\");\n targetRoot.style.setProperty(\"margin\", \"0\", \"important\");\n targetRoot.style.setProperty(\"overflow-x\", \"hidden\", \"important\");\n targetRoot.style.setProperty(\"overflow-y\", \"auto\", \"important\");\n targetRoot.style.setProperty(\"scrollbar-width\", \"none\", \"important\");\n targetRoot.style.setProperty(\"-ms-overflow-style\", \"none\", \"important\");\n\n body.style.setProperty(\"display\", \"block\", \"important\");\n body.style.setProperty(\"position\", \"static\", \"important\");\n body.style.setProperty(\"box-sizing\", \"border-box\", \"important\");\n body.style.setProperty(\"width\", \"100%\", \"important\");\n body.style.setProperty(\"height\", \"auto\", \"important\");\n body.style.setProperty(\"min-height\", \"100%\", \"important\");\n body.style.setProperty(\"margin\", \"0\", \"important\");\n body.style.setProperty(\"overflow\", \"visible\", \"important\");\n\n const previewRoot = frameDocument.getElementById(frameRootId);\n\n previewRoot?.style.removeProperty(\"min-height\");\n\n const scrollbarStyle = frameDocument.createElement(\"style\");\n\n scrollbarStyle.setAttribute(\"data-puzzle-preview-style\", \"\");\n scrollbarStyle.textContent = `\n html,\n body {\n scrollbar-width: none !important;\n -ms-overflow-style: none !important;\n }\n\n html::-webkit-scrollbar,\n body::-webkit-scrollbar {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n }\n `;\n\n frameHead.appendChild(scrollbarStyle);\n }, [frameRootId]);\n\n const updateScale = useCallback(\n (availableWidth: number) => {\n const nextScale = Math.min(1, Math.max(0, availableWidth) / config.width);\n\n setScale((current) =>\n Math.abs(current - nextScale) < 0.001 ? current : nextScale,\n );\n },\n [config.width],\n );\n\n useIsomorphicLayoutEffect(() => {\n const container = containerRef.current;\n\n if (!container) return;\n\n const measure = () => {\n const styles = window.getComputedStyle(container);\n const horizontalPadding =\n (Number.parseFloat(styles.paddingLeft) || 0) +\n (Number.parseFloat(styles.paddingRight) || 0);\n\n updateScale(container.clientWidth - horizontalPadding);\n };\n\n measure();\n\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0];\n\n if (entry) {\n updateScale(entry.contentRect.width);\n }\n });\n\n observer.observe(container);\n\n return () => observer.disconnect();\n }, [updateScale]);\n\n useEffect(() => {\n const isStyleNode = (node: Node) =>\n node instanceof Element &&\n (node.matches(\"style, link[rel='stylesheet']\") ||\n node.querySelector(\"style, link[rel='stylesheet']\") !== null);\n\n const headObserver = new MutationObserver(syncStyles);\n\n headObserver.observe(document.head, {\n childList: true,\n subtree: true,\n characterData: true,\n attributes: true,\n });\n\n const bodyObserver = new MutationObserver((mutations) => {\n const affectsStyles = mutations.some((mutation) => {\n const target =\n mutation.target instanceof Element\n ? mutation.target\n : mutation.target.parentElement;\n\n return (\n target?.closest(\n \"style[data-puzzle-theme], style[data-puzzle-theme-scope-style]\",\n ) != null ||\n Array.from(mutation.addedNodes).some(isStyleNode) ||\n Array.from(mutation.removedNodes).some(isStyleNode)\n );\n });\n\n if (affectsStyles) {\n syncStyles();\n }\n });\n\n bodyObserver.observe(document.body, {\n childList: true,\n subtree: true,\n characterData: true,\n attributes: true,\n attributeFilter: [\"data-theme\"],\n });\n\n return () => {\n headObserver.disconnect();\n bodyObserver.disconnect();\n };\n }, [syncStyles]);\n\n const initializeFrame = useCallback(() => {\n const frameDocument = iframeRef.current?.contentDocument;\n const root = frameDocument?.getElementById(frameRootId);\n\n if (!root) return;\n\n syncStyles();\n setFrameRoot(root);\n }, [frameRootId, syncStyles]);\n\n useEffect(() => {\n initializeFrame();\n }, [initializeFrame]);\n\n const handleCopyCode = useCallback(async () => {\n if (code === undefined) return;\n\n try {\n await navigator.clipboard.writeText(code);\n setCopied(true);\n\n if (copyTimeoutRef.current) {\n clearTimeout(copyTimeoutRef.current);\n }\n\n copyTimeoutRef.current = setTimeout(() => {\n setCopied(false);\n }, 2000);\n } catch {\n setCopied(false);\n }\n }, [code]);\n\n useEffect(\n () => () => {\n if (copyTimeoutRef.current) {\n clearTimeout(copyTimeoutRef.current);\n }\n },\n [],\n );\n\n useEffect(() => {\n if (!hasCode && activeTab === \"code\") {\n setActiveTab(\"preview\");\n }\n }, [activeTab, hasCode]);\n\n const frameStyle: CSSProperties = {\n width: config.width,\n height: frameHeight,\n transform: `scale(${scale})`,\n transformOrigin: \"top left\",\n };\n\n const contentStyle: CSSProperties = {\n display: \"flex\",\n boxSizing: \"border-box\",\n minHeight: \"100vh\",\n alignItems: align ? ALIGN_VALUES[align] : undefined,\n justifyContent: justify ? JUSTIFY_VALUES[justify] : undefined,\n };\n\n const viewportStyle: CSSProperties = {\n width: config.width * scale,\n aspectRatio: `${config.width} / ${frameHeight}`,\n };\n\n const panelProps = {\n id: panelId,\n role: \"tabpanel\",\n \"aria-labelledby\": activeTab === \"preview\" ? previewTabId : codeTabId,\n };\n\n return (\n <section ref={sectionRef} className={cn(\"puzzle-preview\", className)}>\n <div className=\"puzzle-preview__toolbar\">\n <div\n className=\"puzzle-preview__tabs\"\n role=\"tablist\"\n aria-label=\"Preview view\"\n >\n <button\n type=\"button\"\n role=\"tab\"\n id={previewTabId}\n ref={rovingFocus.getItemRef(\"preview\")}\n tabIndex={activeTab === \"preview\" ? 0 : -1}\n onFocus={() => handleTabFocus(\"preview\")}\n onKeyDown={(event) => handleTabKeyDown(event, \"preview\")}\n aria-selected={activeTab === \"preview\"}\n aria-controls={panelId}\n className={cn(\n \"puzzle-preview__tab\",\n activeTab === \"preview\" && \"puzzle-preview__tab--active\",\n )}\n onClick={() => setActiveTab(\"preview\")}\n >\n Preview\n </button>\n\n {hasCode && (\n <button\n type=\"button\"\n role=\"tab\"\n id={codeTabId}\n ref={rovingFocus.getItemRef(\"code\")}\n tabIndex={activeTab === \"code\" ? 0 : -1}\n onFocus={() => handleTabFocus(\"code\")}\n onKeyDown={(event) => handleTabKeyDown(event, \"code\")}\n aria-selected={activeTab === \"code\"}\n aria-controls={panelId}\n className={cn(\n \"puzzle-preview__tab\",\n activeTab === \"code\" && \"puzzle-preview__tab--active\",\n )}\n onClick={() => setActiveTab(\"code\")}\n >\n Code\n </button>\n )}\n </div>\n\n {activeTab === \"preview\" ? (\n <div className=\"puzzle-preview__toolbar-actions\">\n {!hideDevices && (\n <div\n className=\"puzzle-preview__devices\"\n role=\"group\"\n aria-label=\"Device size\"\n >\n {(Object.keys(PREVIEW_DEVICES) as PreviewDevice[]).map(\n (item) => (\n <button\n key={item}\n ref={deviceFocus.getItemRef(item)}\n type=\"button\"\n className={cn(\n \"puzzle-preview__device\",\n device === item && \"puzzle-preview__device--active\",\n )}\n aria-pressed={device === item}\n tabIndex={deviceFocus.getItemTabIndex(item)}\n onFocus={() => deviceFocus.onItemFocus(item)}\n onKeyDown={(event) =>\n deviceFocus.onItemKeyDown(event, item)\n }\n onClick={() => setDevice(item)}\n >\n {PREVIEW_DEVICES[item].label}\n </button>\n ),\n )}\n </div>\n )}\n\n <span className=\"puzzle-preview__dimensions\">\n {config.width} × {frameHeight}\n </span>\n </div>\n ) : (\n <button\n type=\"button\"\n className=\"puzzle-preview__copy\"\n onClick={handleCopyCode}\n aria-label={copied ? \"Code copied\" : \"Copy code\"}\n >\n <Icon\n name={copied ? \"tabler:check\" : \"tabler:copy\"}\n size={16}\n aria-hidden=\"true\"\n />\n <span>{copied ? \"Copied\" : \"Copy code\"}</span>\n </button>\n )}\n </div>\n\n <PreviewBackground {...panelProps} className=\"puzzle-preview__panel\">\n <div\n ref={containerRef}\n className=\"puzzle-preview__stage\"\n hidden={activeTab !== \"preview\"}\n >\n <div className=\"puzzle-preview__viewport\" style={viewportStyle}>\n <iframe\n ref={iframeRef}\n className=\"puzzle-preview__frame\"\n srcDoc={createPreviewDocument(frameRootId)}\n title={`${config.label} component preview`}\n onLoad={initializeFrame}\n style={frameStyle}\n />\n\n {frameRoot &&\n createPortal(\n <ThemeScopeProvider\n scopeId={themeScope?.scopeId ?? null}\n theme={themeScope?.theme ?? \"system\"}\n >\n <div style={contentStyle}>{children}</div>\n </ThemeScopeProvider>,\n frameRoot,\n )}\n </div>\n </div>\n\n {activeTab === \"code\" && (\n <div className=\"puzzle-preview__code\">\n <pre>\n <code className=\"language-tsx\">\n {code === undefined ? null : highlightCode(code)}\n </code>\n </pre>\n </div>\n )}\n </PreviewBackground>\n\n <span\n className=\"puzzle-preview__copy-status\"\n role=\"status\"\n aria-live=\"polite\"\n >\n {copied ? \"Code copied to clipboard.\" : \"\"}\n </span>\n </section>\n );\n};\n\nexport {\n Preview,\n type PreviewProps,\n type PreviewDevice,\n type PreviewAlign,\n type PreviewJustify,\n};\n"],"mappings":";;;;;;;;;;;;AA2DA,MAAM,kBAAuD;CAC3D,QAAQ;EAAE,OAAO;EAAU,OAAO;EAAK,QAAQ;CA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EU;;GAEnB,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;IACE,WAAU;IACV,MAAK;IACL,aAAU;IAET,UAAA,SAAS,8BAA8B;GACpC,CAAA;EACC;;AAEb"}
|
|
@@ -182,7 +182,7 @@ const Preview = ({ children, className, defaultDevice = "mobile", code, height,
|
|
|
182
182
|
if (!container) return;
|
|
183
183
|
const measure = () => {
|
|
184
184
|
const styles = window.getComputedStyle(container);
|
|
185
|
-
const horizontalPadding = parseFloat(styles.paddingLeft) + parseFloat(styles.paddingRight);
|
|
185
|
+
const horizontalPadding = (Number.parseFloat(styles.paddingLeft) || 0) + (Number.parseFloat(styles.paddingRight) || 0);
|
|
186
186
|
updateScale(container.clientWidth - horizontalPadding);
|
|
187
187
|
};
|
|
188
188
|
measure();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/utilities/preview/index.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type ComponentProps,\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@puzzle-ui/core\";\nimport { useRovingFocus } from \"@puzzle-ui/hooks\";\nimport { Icon } from \"@puzzle-ui/icons\";\nimport { ThemeScopeProvider, useThemeScope } from \"@puzzle-ui/theme/scope-context\";\n\nimport { Background } from \"../../layout/background\";\nimport { highlightCode } from \"./highlight\";\n\nimport \"./preview.css\";\n\ntype PreviewDevice = \"mobile\" | \"tablet\" | \"desktop\";\ntype PreviewTab = \"preview\" | \"code\";\n\ntype DeviceConfig = {\n label: string;\n width: number;\n height: number;\n};\n\ntype PreviewAlign = \"start\" | \"center\" | \"end\" | \"stretch\";\ntype PreviewJustify =\n | \"start\"\n | \"center\"\n | \"end\"\n | \"between\"\n | \"around\"\n | \"evenly\";\n\ntype PreviewProps = {\n children: ReactNode;\n className?: string;\n defaultDevice?: PreviewDevice;\n code?: string;\n /** Frame height in pixels. Defaults to the selected device's height. */\n height?: number;\n /** Vertical alignment of the content within the frame. */\n align?: PreviewAlign;\n /** Horizontal distribution of the content within the frame. */\n justify?: PreviewJustify;\n /** Hides the device selector. The default device is still used. */\n hideDevices?: boolean;\n};\n\nconst PREVIEW_DEVICES: Record<PreviewDevice, DeviceConfig> = {\n mobile: { label: \"Mobile\", width: 390, height: 844 },\n tablet: { label: \"Tablet\", width: 768, height: 1024 },\n desktop: { label: \"Desktop\", width: 1024, height: 768 },\n};\n\nconst PREVIEW_DEVICE_ITEMS = (\n Object.keys(PREVIEW_DEVICES) as PreviewDevice[]\n).map((id) => ({ id }));\n\nconst ALIGN_VALUES: Record<PreviewAlign, string> = {\n start: \"flex-start\",\n center: \"center\",\n end: \"flex-end\",\n stretch: \"stretch\",\n};\n\nconst JUSTIFY_VALUES: Record<PreviewJustify, string> = {\n start: \"flex-start\",\n center: \"center\",\n end: \"flex-end\",\n between: \"space-between\",\n around: \"space-around\",\n evenly: \"space-evenly\",\n};\n\nconst createPreviewDocument = (rootId: string) => `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n </head>\n <body>\n <div id=\"${rootId}\"></div>\n </body>\n</html>`;\n\nconst useIsomorphicLayoutEffect =\n typeof window === \"undefined\" ? useEffect : useLayoutEffect;\n\nconst PreviewBackground = (props: ComponentProps<\"div\">) => (\n <Background\n pattern=\"blueprint\"\n size={20}\n majorSize={100}\n lineWidth={1}\n patternOpacity={0.25}\n {...props}\n />\n);\n\nconst Preview = ({\n children,\n className,\n defaultDevice = \"mobile\",\n code,\n height,\n align,\n justify,\n hideDevices = false,\n}: PreviewProps) => {\n const generatedId = useId();\n const frameRootId = `${generatedId}-root`;\n const previewTabId = `${generatedId}-tab-preview`;\n const codeTabId = `${generatedId}-tab-code`;\n const panelId = `${generatedId}-panel`;\n\n const themeScope = useThemeScope();\n\n const [device, setDevice] = useState<PreviewDevice>(defaultDevice);\n const [activeTab, setActiveTab] = useState<PreviewTab>(\"preview\");\n const [frameRoot, setFrameRoot] = useState<HTMLElement | null>(null);\n const [scale, setScale] = useState(1);\n const [copied, setCopied] = useState(false);\n\n const containerRef = useRef<HTMLDivElement>(null);\n const iframeRef = useRef<HTMLIFrameElement>(null);\n const copyTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const config = PREVIEW_DEVICES[device];\n const frameHeight = height ?? config.height;\n const hasCode = code !== undefined;\n const [direction, setDirection] = useState<\"ltr\" | \"rtl\">(\"ltr\");\n const sectionRef = useRef<HTMLElement>(null);\n const isKeyboardNavigation = useRef(false);\n\n useLayoutEffect(() => {\n const section = sectionRef.current;\n\n if (section) {\n const isRtl =\n getComputedStyle(section).direction === \"rtl\" ||\n section.closest(\"[dir]\")?.getAttribute(\"dir\")?.toLowerCase() === \"rtl\";\n\n setDirection(isRtl ? \"rtl\" : \"ltr\");\n }\n }, []);\n\n const rovingFocus = useRovingFocus<HTMLButtonElement>({\n items: hasCode ? [{ id: \"preview\" }, { id: \"code\" }] : [{ id: \"preview\" }],\n dir: direction,\n initialActiveId: activeTab,\n });\n\n const deviceFocus = useRovingFocus<HTMLButtonElement>({\n items: PREVIEW_DEVICE_ITEMS,\n dir: direction,\n initialActiveId: device,\n });\n\n const handleTabKeyDown = (\n event: KeyboardEvent<HTMLButtonElement>,\n tab: PreviewTab,\n ) => {\n isKeyboardNavigation.current = true;\n\n try {\n rovingFocus.onItemKeyDown(event, tab);\n } finally {\n isKeyboardNavigation.current = false;\n }\n };\n\n const handleTabFocus = (tab: PreviewTab) => {\n rovingFocus.onItemFocus(tab);\n\n if (isKeyboardNavigation.current) {\n setActiveTab(tab);\n }\n };\n\n const syncStyles = useCallback(() => {\n const frameDocument = iframeRef.current?.contentDocument;\n\n if (!frameDocument) return;\n\n const frameHead = frameDocument.head;\n\n frameHead\n .querySelectorAll(\"[data-puzzle-preview-style]\")\n .forEach((element) => element.remove());\n\n document\n .querySelectorAll(\n [\n \"head link[rel='stylesheet']\",\n \"head style\",\n \"style[data-puzzle-theme]\",\n \"style[data-puzzle-theme-scope-style]\",\n ].join(\", \"),\n )\n .forEach((element) => {\n const clone = element.cloneNode(true) as HTMLElement;\n\n clone.setAttribute(\"data-puzzle-preview-style\", \"\");\n frameHead.appendChild(clone);\n });\n\n const sourceRoot = document.documentElement;\n const targetRoot = frameDocument.documentElement;\n\n targetRoot.style.cssText = sourceRoot.style.cssText;\n targetRoot.className = sourceRoot.className;\n\n Array.from(sourceRoot.attributes).forEach((attribute) => {\n if (attribute.name === \"style\" || attribute.name === \"class\") {\n return;\n }\n\n targetRoot.setAttribute(attribute.name, attribute.value);\n });\n\n const body = frameDocument.body;\n\n body.className = document.body.className;\n body.style.cssText = document.body.style.cssText;\n\n targetRoot.style.setProperty(\"box-sizing\", \"border-box\", \"important\");\n targetRoot.style.setProperty(\"width\", \"100%\", \"important\");\n targetRoot.style.setProperty(\"height\", \"100%\", \"important\");\n targetRoot.style.setProperty(\"min-height\", \"100%\", \"important\");\n targetRoot.style.setProperty(\"margin\", \"0\", \"important\");\n targetRoot.style.setProperty(\"overflow-x\", \"hidden\", \"important\");\n targetRoot.style.setProperty(\"overflow-y\", \"auto\", \"important\");\n targetRoot.style.setProperty(\"scrollbar-width\", \"none\", \"important\");\n targetRoot.style.setProperty(\"-ms-overflow-style\", \"none\", \"important\");\n\n body.style.setProperty(\"display\", \"block\", \"important\");\n body.style.setProperty(\"position\", \"static\", \"important\");\n body.style.setProperty(\"box-sizing\", \"border-box\", \"important\");\n body.style.setProperty(\"width\", \"100%\", \"important\");\n body.style.setProperty(\"height\", \"auto\", \"important\");\n body.style.setProperty(\"min-height\", \"100%\", \"important\");\n body.style.setProperty(\"margin\", \"0\", \"important\");\n body.style.setProperty(\"overflow\", \"visible\", \"important\");\n\n const previewRoot = frameDocument.getElementById(frameRootId);\n\n previewRoot?.style.removeProperty(\"min-height\");\n\n const scrollbarStyle = frameDocument.createElement(\"style\");\n\n scrollbarStyle.setAttribute(\"data-puzzle-preview-style\", \"\");\n scrollbarStyle.textContent = `\n html,\n body {\n scrollbar-width: none !important;\n -ms-overflow-style: none !important;\n }\n\n html::-webkit-scrollbar,\n body::-webkit-scrollbar {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n }\n `;\n\n frameHead.appendChild(scrollbarStyle);\n }, [frameRootId]);\n\n const updateScale = useCallback(\n (availableWidth: number) => {\n const nextScale = Math.min(1, Math.max(0, availableWidth) / config.width);\n\n setScale((current) =>\n Math.abs(current - nextScale) < 0.001 ? current : nextScale,\n );\n },\n [config.width],\n );\n\n useIsomorphicLayoutEffect(() => {\n const container = containerRef.current;\n\n if (!container) return;\n\n const measure = () => {\n const styles = window.getComputedStyle(container);\n const horizontalPadding =\n parseFloat(styles.paddingLeft) + parseFloat(styles.paddingRight);\n\n updateScale(container.clientWidth - horizontalPadding);\n };\n\n measure();\n\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0];\n\n if (entry) {\n updateScale(entry.contentRect.width);\n }\n });\n\n observer.observe(container);\n\n return () => observer.disconnect();\n }, [updateScale]);\n\n useEffect(() => {\n const isStyleNode = (node: Node) =>\n node instanceof Element &&\n (node.matches(\"style, link[rel='stylesheet']\") ||\n node.querySelector(\"style, link[rel='stylesheet']\") !== null);\n\n const headObserver = new MutationObserver(syncStyles);\n\n headObserver.observe(document.head, {\n childList: true,\n subtree: true,\n characterData: true,\n attributes: true,\n });\n\n const bodyObserver = new MutationObserver((mutations) => {\n const affectsStyles = mutations.some((mutation) => {\n const target =\n mutation.target instanceof Element\n ? mutation.target\n : mutation.target.parentElement;\n\n return (\n target?.closest(\n \"style[data-puzzle-theme], style[data-puzzle-theme-scope-style]\",\n ) != null ||\n Array.from(mutation.addedNodes).some(isStyleNode) ||\n Array.from(mutation.removedNodes).some(isStyleNode)\n );\n });\n\n if (affectsStyles) {\n syncStyles();\n }\n });\n\n bodyObserver.observe(document.body, {\n childList: true,\n subtree: true,\n characterData: true,\n attributes: true,\n attributeFilter: [\"data-theme\"],\n });\n\n return () => {\n headObserver.disconnect();\n bodyObserver.disconnect();\n };\n }, [syncStyles]);\n\n const initializeFrame = useCallback(() => {\n const frameDocument = iframeRef.current?.contentDocument;\n const root = frameDocument?.getElementById(frameRootId);\n\n if (!root) return;\n\n syncStyles();\n setFrameRoot(root);\n }, [frameRootId, syncStyles]);\n\n useEffect(() => {\n initializeFrame();\n }, [initializeFrame]);\n\n const handleCopyCode = useCallback(async () => {\n if (code === undefined) return;\n\n try {\n await navigator.clipboard.writeText(code);\n setCopied(true);\n\n if (copyTimeoutRef.current) {\n clearTimeout(copyTimeoutRef.current);\n }\n\n copyTimeoutRef.current = setTimeout(() => {\n setCopied(false);\n }, 2000);\n } catch {\n setCopied(false);\n }\n }, [code]);\n\n useEffect(\n () => () => {\n if (copyTimeoutRef.current) {\n clearTimeout(copyTimeoutRef.current);\n }\n },\n [],\n );\n\n useEffect(() => {\n if (!hasCode && activeTab === \"code\") {\n setActiveTab(\"preview\");\n }\n }, [activeTab, hasCode]);\n\n const frameStyle: CSSProperties = {\n width: config.width,\n height: frameHeight,\n transform: `scale(${scale})`,\n transformOrigin: \"top left\",\n };\n\n const contentStyle: CSSProperties = {\n display: \"flex\",\n boxSizing: \"border-box\",\n minHeight: \"100vh\",\n alignItems: align ? ALIGN_VALUES[align] : undefined,\n justifyContent: justify ? JUSTIFY_VALUES[justify] : undefined,\n };\n\n const viewportStyle: CSSProperties = {\n width: config.width * scale,\n aspectRatio: `${config.width} / ${frameHeight}`,\n };\n\n const panelProps = {\n id: panelId,\n role: \"tabpanel\",\n \"aria-labelledby\": activeTab === \"preview\" ? previewTabId : codeTabId,\n };\n\n return (\n <section ref={sectionRef} className={cn(\"puzzle-preview\", className)}>\n <div className=\"puzzle-preview__toolbar\">\n <div\n className=\"puzzle-preview__tabs\"\n role=\"tablist\"\n aria-label=\"Preview view\"\n >\n <button\n type=\"button\"\n role=\"tab\"\n id={previewTabId}\n ref={rovingFocus.getItemRef(\"preview\")}\n tabIndex={activeTab === \"preview\" ? 0 : -1}\n onFocus={() => handleTabFocus(\"preview\")}\n onKeyDown={(event) => handleTabKeyDown(event, \"preview\")}\n aria-selected={activeTab === \"preview\"}\n aria-controls={panelId}\n className={cn(\n \"puzzle-preview__tab\",\n activeTab === \"preview\" && \"puzzle-preview__tab--active\",\n )}\n onClick={() => setActiveTab(\"preview\")}\n >\n Preview\n </button>\n\n {hasCode && (\n <button\n type=\"button\"\n role=\"tab\"\n id={codeTabId}\n ref={rovingFocus.getItemRef(\"code\")}\n tabIndex={activeTab === \"code\" ? 0 : -1}\n onFocus={() => handleTabFocus(\"code\")}\n onKeyDown={(event) => handleTabKeyDown(event, \"code\")}\n aria-selected={activeTab === \"code\"}\n aria-controls={panelId}\n className={cn(\n \"puzzle-preview__tab\",\n activeTab === \"code\" && \"puzzle-preview__tab--active\",\n )}\n onClick={() => setActiveTab(\"code\")}\n >\n Code\n </button>\n )}\n </div>\n\n {activeTab === \"preview\" ? (\n <div className=\"puzzle-preview__toolbar-actions\">\n {!hideDevices && (\n <div\n className=\"puzzle-preview__devices\"\n role=\"group\"\n aria-label=\"Device size\"\n >\n {(Object.keys(PREVIEW_DEVICES) as PreviewDevice[]).map(\n (item) => (\n <button\n key={item}\n ref={deviceFocus.getItemRef(item)}\n type=\"button\"\n className={cn(\n \"puzzle-preview__device\",\n device === item && \"puzzle-preview__device--active\",\n )}\n aria-pressed={device === item}\n tabIndex={deviceFocus.getItemTabIndex(item)}\n onFocus={() => deviceFocus.onItemFocus(item)}\n onKeyDown={(event) =>\n deviceFocus.onItemKeyDown(event, item)\n }\n onClick={() => setDevice(item)}\n >\n {PREVIEW_DEVICES[item].label}\n </button>\n ),\n )}\n </div>\n )}\n\n <span className=\"puzzle-preview__dimensions\">\n {config.width} × {frameHeight}\n </span>\n </div>\n ) : (\n <button\n type=\"button\"\n className=\"puzzle-preview__copy\"\n onClick={handleCopyCode}\n aria-label={copied ? \"Code copied\" : \"Copy code\"}\n >\n <Icon\n name={copied ? \"tabler:check\" : \"tabler:copy\"}\n size={16}\n aria-hidden=\"true\"\n />\n <span>{copied ? \"Copied\" : \"Copy code\"}</span>\n </button>\n )}\n </div>\n\n <PreviewBackground {...panelProps} className=\"puzzle-preview__panel\">\n <div\n ref={containerRef}\n className=\"puzzle-preview__stage\"\n hidden={activeTab !== \"preview\"}\n >\n <div className=\"puzzle-preview__viewport\" style={viewportStyle}>\n <iframe\n ref={iframeRef}\n className=\"puzzle-preview__frame\"\n srcDoc={createPreviewDocument(frameRootId)}\n title={`${config.label} component preview`}\n onLoad={initializeFrame}\n style={frameStyle}\n />\n\n {frameRoot &&\n createPortal(\n <ThemeScopeProvider\n scopeId={themeScope?.scopeId ?? null}\n theme={themeScope?.theme ?? \"system\"}\n >\n <div style={contentStyle}>{children}</div>\n </ThemeScopeProvider>,\n frameRoot,\n )}\n </div>\n </div>\n\n {activeTab === \"code\" && (\n <div className=\"puzzle-preview__code\">\n <pre>\n <code className=\"language-tsx\">\n {code === undefined ? null : highlightCode(code)}\n </code>\n </pre>\n </div>\n )}\n </PreviewBackground>\n\n <span\n className=\"puzzle-preview__copy-status\"\n role=\"status\"\n aria-live=\"polite\"\n >\n {copied ? \"Code copied to clipboard.\" : \"\"}\n </span>\n </section>\n );\n};\n\nexport {\n Preview,\n type PreviewProps,\n type PreviewDevice,\n type PreviewAlign,\n type PreviewJustify,\n};\n"],"mappings":";;;;;;;;;;;;AA2DA,MAAM,kBAAuD;CAC3D,QAAQ;EAAE,OAAO;EAAU,OAAO;EAAK,QAAQ;CAAI;CACnD,QAAQ;EAAE,OAAO;EAAU,OAAO;EAAK,QAAQ;CAAK;CACpD,SAAS;EAAE,OAAO;EAAW,OAAO;EAAM,QAAQ;CAAI;AACxD;AAEA,MAAM,uBACJ,OAAO,KAAK,eAAe,CAAC,CAC5B,KAAK,QAAQ,EAAE,GAAG,EAAE;AAEtB,MAAM,eAA6C;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;OAAM;OAAI;MACd;KACH,CAAA,CAAA;IAEL,CAAA,IAAA,qBAAC,UAAD;KACE,MAAK;KACL,WAAU;KACV,SAAS;KACT,cAAY,SAAS,gBAAgB;KAJvC,UAAA,CAME,oBAAC,MAAD;MACE,MAAM,SAAS,iBAAiB;MAChC,MAAM;MACN,eAAY;KACb,CAAA,GACD,oBAAC,QAAD,EAAA,UAAO,SAAS,WAAW,YAAkB,CAAA,CACvC;IAEP,CAAA,CAAA;;GAEL,qBAAC,mBAAD;IAAmB,GAAI;IAAY,WAAU;IAA7C,UAAA,CACE,oBAAC,OAAD;KACE,KAAK;KACL,WAAU;KACV,QAAQ,cAAc;KAEtB,UAAA,qBAAC,OAAD;MAAK,WAAU;MAA2B,OAAO;MAAjD,UAAA,CACE,oBAAC,UAAD;OACE,KAAK;OACL,WAAU;OACV,QAAQ,sBAAsB,WAAW;OACzC,OAAO,GAAG,OAAO,MAAM;OACvB,QAAQ;OACR,OAAO;MACR,CAAA,GAEA,aACC,aACE,oBAAC,oBAAD;OACE,SAAS,YAAY,WAAW;OAChC,OAAO,YAAY,SAAS;OAE5B,UAAA,oBAAC,OAAD;QAAK,OAAO;QAAe;OAAc,CAAA;MACvB,CAAA,GACpB,SACF,CACC;;IACF,CAAA,GAEJ,cAAc,UACb,oBAAC,OAAD;KAAK,WAAU;KACb,UAAA,oBAAC,OAAD,EAAA,UACE,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA,SAAS,KAAA,IAAY,OAAO,cAAc,IAAI;KAC3C,CAAA,EACH,CAAA;IACF,CAAA,CAEU;;GAEnB,oBAAC,QAAD;IACE,WAAU;IACV,MAAK;IACL,aAAU;IAET,UAAA,SAAS,8BAA8B;GACpC,CAAA;EACC;;AAEb"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/utilities/preview/index.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type ComponentProps,\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@puzzle-ui/core\";\nimport { useRovingFocus } from \"@puzzle-ui/hooks\";\nimport { Icon } from \"@puzzle-ui/icons\";\nimport { ThemeScopeProvider, useThemeScope } from \"@puzzle-ui/theme/scope-context\";\n\nimport { Background } from \"../../layout/background\";\nimport { highlightCode } from \"./highlight\";\n\nimport \"./preview.css\";\n\ntype PreviewDevice = \"mobile\" | \"tablet\" | \"desktop\";\ntype PreviewTab = \"preview\" | \"code\";\n\ntype DeviceConfig = {\n label: string;\n width: number;\n height: number;\n};\n\ntype PreviewAlign = \"start\" | \"center\" | \"end\" | \"stretch\";\ntype PreviewJustify =\n | \"start\"\n | \"center\"\n | \"end\"\n | \"between\"\n | \"around\"\n | \"evenly\";\n\ntype PreviewProps = {\n children: ReactNode;\n className?: string;\n defaultDevice?: PreviewDevice;\n code?: string;\n /** Frame height in pixels. Defaults to the selected device's height. */\n height?: number;\n /** Vertical alignment of the content within the frame. */\n align?: PreviewAlign;\n /** Horizontal distribution of the content within the frame. */\n justify?: PreviewJustify;\n /** Hides the device selector. The default device is still used. */\n hideDevices?: boolean;\n};\n\nconst PREVIEW_DEVICES: Record<PreviewDevice, DeviceConfig> = {\n mobile: { label: \"Mobile\", width: 390, height: 844 },\n tablet: { label: \"Tablet\", width: 768, height: 1024 },\n desktop: { label: \"Desktop\", width: 1024, height: 768 },\n};\n\nconst PREVIEW_DEVICE_ITEMS = (\n Object.keys(PREVIEW_DEVICES) as PreviewDevice[]\n).map((id) => ({ id }));\n\nconst ALIGN_VALUES: Record<PreviewAlign, string> = {\n start: \"flex-start\",\n center: \"center\",\n end: \"flex-end\",\n stretch: \"stretch\",\n};\n\nconst JUSTIFY_VALUES: Record<PreviewJustify, string> = {\n start: \"flex-start\",\n center: \"center\",\n end: \"flex-end\",\n between: \"space-between\",\n around: \"space-around\",\n evenly: \"space-evenly\",\n};\n\nconst createPreviewDocument = (rootId: string) => `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n </head>\n <body>\n <div id=\"${rootId}\"></div>\n </body>\n</html>`;\n\nconst useIsomorphicLayoutEffect =\n typeof window === \"undefined\" ? useEffect : useLayoutEffect;\n\nconst PreviewBackground = (props: ComponentProps<\"div\">) => (\n <Background\n pattern=\"blueprint\"\n size={20}\n majorSize={100}\n lineWidth={1}\n patternOpacity={0.25}\n {...props}\n />\n);\n\nconst Preview = ({\n children,\n className,\n defaultDevice = \"mobile\",\n code,\n height,\n align,\n justify,\n hideDevices = false,\n}: PreviewProps) => {\n const generatedId = useId();\n const frameRootId = `${generatedId}-root`;\n const previewTabId = `${generatedId}-tab-preview`;\n const codeTabId = `${generatedId}-tab-code`;\n const panelId = `${generatedId}-panel`;\n\n const themeScope = useThemeScope();\n\n const [device, setDevice] = useState<PreviewDevice>(defaultDevice);\n const [activeTab, setActiveTab] = useState<PreviewTab>(\"preview\");\n const [frameRoot, setFrameRoot] = useState<HTMLElement | null>(null);\n const [scale, setScale] = useState(1);\n const [copied, setCopied] = useState(false);\n\n const containerRef = useRef<HTMLDivElement>(null);\n const iframeRef = useRef<HTMLIFrameElement>(null);\n const copyTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const config = PREVIEW_DEVICES[device];\n const frameHeight = height ?? config.height;\n const hasCode = code !== undefined;\n const [direction, setDirection] = useState<\"ltr\" | \"rtl\">(\"ltr\");\n const sectionRef = useRef<HTMLElement>(null);\n const isKeyboardNavigation = useRef(false);\n\n useLayoutEffect(() => {\n const section = sectionRef.current;\n\n if (section) {\n const isRtl =\n getComputedStyle(section).direction === \"rtl\" ||\n section.closest(\"[dir]\")?.getAttribute(\"dir\")?.toLowerCase() === \"rtl\";\n\n setDirection(isRtl ? \"rtl\" : \"ltr\");\n }\n }, []);\n\n const rovingFocus = useRovingFocus<HTMLButtonElement>({\n items: hasCode ? [{ id: \"preview\" }, { id: \"code\" }] : [{ id: \"preview\" }],\n dir: direction,\n initialActiveId: activeTab,\n });\n\n const deviceFocus = useRovingFocus<HTMLButtonElement>({\n items: PREVIEW_DEVICE_ITEMS,\n dir: direction,\n initialActiveId: device,\n });\n\n const handleTabKeyDown = (\n event: KeyboardEvent<HTMLButtonElement>,\n tab: PreviewTab,\n ) => {\n isKeyboardNavigation.current = true;\n\n try {\n rovingFocus.onItemKeyDown(event, tab);\n } finally {\n isKeyboardNavigation.current = false;\n }\n };\n\n const handleTabFocus = (tab: PreviewTab) => {\n rovingFocus.onItemFocus(tab);\n\n if (isKeyboardNavigation.current) {\n setActiveTab(tab);\n }\n };\n\n const syncStyles = useCallback(() => {\n const frameDocument = iframeRef.current?.contentDocument;\n\n if (!frameDocument) return;\n\n const frameHead = frameDocument.head;\n\n frameHead\n .querySelectorAll(\"[data-puzzle-preview-style]\")\n .forEach((element) => element.remove());\n\n document\n .querySelectorAll(\n [\n \"head link[rel='stylesheet']\",\n \"head style\",\n \"style[data-puzzle-theme]\",\n \"style[data-puzzle-theme-scope-style]\",\n ].join(\", \"),\n )\n .forEach((element) => {\n const clone = element.cloneNode(true) as HTMLElement;\n\n clone.setAttribute(\"data-puzzle-preview-style\", \"\");\n frameHead.appendChild(clone);\n });\n\n const sourceRoot = document.documentElement;\n const targetRoot = frameDocument.documentElement;\n\n targetRoot.style.cssText = sourceRoot.style.cssText;\n targetRoot.className = sourceRoot.className;\n\n Array.from(sourceRoot.attributes).forEach((attribute) => {\n if (attribute.name === \"style\" || attribute.name === \"class\") {\n return;\n }\n\n targetRoot.setAttribute(attribute.name, attribute.value);\n });\n\n const body = frameDocument.body;\n\n body.className = document.body.className;\n body.style.cssText = document.body.style.cssText;\n\n targetRoot.style.setProperty(\"box-sizing\", \"border-box\", \"important\");\n targetRoot.style.setProperty(\"width\", \"100%\", \"important\");\n targetRoot.style.setProperty(\"height\", \"100%\", \"important\");\n targetRoot.style.setProperty(\"min-height\", \"100%\", \"important\");\n targetRoot.style.setProperty(\"margin\", \"0\", \"important\");\n targetRoot.style.setProperty(\"overflow-x\", \"hidden\", \"important\");\n targetRoot.style.setProperty(\"overflow-y\", \"auto\", \"important\");\n targetRoot.style.setProperty(\"scrollbar-width\", \"none\", \"important\");\n targetRoot.style.setProperty(\"-ms-overflow-style\", \"none\", \"important\");\n\n body.style.setProperty(\"display\", \"block\", \"important\");\n body.style.setProperty(\"position\", \"static\", \"important\");\n body.style.setProperty(\"box-sizing\", \"border-box\", \"important\");\n body.style.setProperty(\"width\", \"100%\", \"important\");\n body.style.setProperty(\"height\", \"auto\", \"important\");\n body.style.setProperty(\"min-height\", \"100%\", \"important\");\n body.style.setProperty(\"margin\", \"0\", \"important\");\n body.style.setProperty(\"overflow\", \"visible\", \"important\");\n\n const previewRoot = frameDocument.getElementById(frameRootId);\n\n previewRoot?.style.removeProperty(\"min-height\");\n\n const scrollbarStyle = frameDocument.createElement(\"style\");\n\n scrollbarStyle.setAttribute(\"data-puzzle-preview-style\", \"\");\n scrollbarStyle.textContent = `\n html,\n body {\n scrollbar-width: none !important;\n -ms-overflow-style: none !important;\n }\n\n html::-webkit-scrollbar,\n body::-webkit-scrollbar {\n display: none !important;\n width: 0 !important;\n height: 0 !important;\n }\n `;\n\n frameHead.appendChild(scrollbarStyle);\n }, [frameRootId]);\n\n const updateScale = useCallback(\n (availableWidth: number) => {\n const nextScale = Math.min(1, Math.max(0, availableWidth) / config.width);\n\n setScale((current) =>\n Math.abs(current - nextScale) < 0.001 ? current : nextScale,\n );\n },\n [config.width],\n );\n\n useIsomorphicLayoutEffect(() => {\n const container = containerRef.current;\n\n if (!container) return;\n\n const measure = () => {\n const styles = window.getComputedStyle(container);\n const horizontalPadding =\n (Number.parseFloat(styles.paddingLeft) || 0) +\n (Number.parseFloat(styles.paddingRight) || 0);\n\n updateScale(container.clientWidth - horizontalPadding);\n };\n\n measure();\n\n const observer = new ResizeObserver((entries) => {\n const entry = entries[0];\n\n if (entry) {\n updateScale(entry.contentRect.width);\n }\n });\n\n observer.observe(container);\n\n return () => observer.disconnect();\n }, [updateScale]);\n\n useEffect(() => {\n const isStyleNode = (node: Node) =>\n node instanceof Element &&\n (node.matches(\"style, link[rel='stylesheet']\") ||\n node.querySelector(\"style, link[rel='stylesheet']\") !== null);\n\n const headObserver = new MutationObserver(syncStyles);\n\n headObserver.observe(document.head, {\n childList: true,\n subtree: true,\n characterData: true,\n attributes: true,\n });\n\n const bodyObserver = new MutationObserver((mutations) => {\n const affectsStyles = mutations.some((mutation) => {\n const target =\n mutation.target instanceof Element\n ? mutation.target\n : mutation.target.parentElement;\n\n return (\n target?.closest(\n \"style[data-puzzle-theme], style[data-puzzle-theme-scope-style]\",\n ) != null ||\n Array.from(mutation.addedNodes).some(isStyleNode) ||\n Array.from(mutation.removedNodes).some(isStyleNode)\n );\n });\n\n if (affectsStyles) {\n syncStyles();\n }\n });\n\n bodyObserver.observe(document.body, {\n childList: true,\n subtree: true,\n characterData: true,\n attributes: true,\n attributeFilter: [\"data-theme\"],\n });\n\n return () => {\n headObserver.disconnect();\n bodyObserver.disconnect();\n };\n }, [syncStyles]);\n\n const initializeFrame = useCallback(() => {\n const frameDocument = iframeRef.current?.contentDocument;\n const root = frameDocument?.getElementById(frameRootId);\n\n if (!root) return;\n\n syncStyles();\n setFrameRoot(root);\n }, [frameRootId, syncStyles]);\n\n useEffect(() => {\n initializeFrame();\n }, [initializeFrame]);\n\n const handleCopyCode = useCallback(async () => {\n if (code === undefined) return;\n\n try {\n await navigator.clipboard.writeText(code);\n setCopied(true);\n\n if (copyTimeoutRef.current) {\n clearTimeout(copyTimeoutRef.current);\n }\n\n copyTimeoutRef.current = setTimeout(() => {\n setCopied(false);\n }, 2000);\n } catch {\n setCopied(false);\n }\n }, [code]);\n\n useEffect(\n () => () => {\n if (copyTimeoutRef.current) {\n clearTimeout(copyTimeoutRef.current);\n }\n },\n [],\n );\n\n useEffect(() => {\n if (!hasCode && activeTab === \"code\") {\n setActiveTab(\"preview\");\n }\n }, [activeTab, hasCode]);\n\n const frameStyle: CSSProperties = {\n width: config.width,\n height: frameHeight,\n transform: `scale(${scale})`,\n transformOrigin: \"top left\",\n };\n\n const contentStyle: CSSProperties = {\n display: \"flex\",\n boxSizing: \"border-box\",\n minHeight: \"100vh\",\n alignItems: align ? ALIGN_VALUES[align] : undefined,\n justifyContent: justify ? JUSTIFY_VALUES[justify] : undefined,\n };\n\n const viewportStyle: CSSProperties = {\n width: config.width * scale,\n aspectRatio: `${config.width} / ${frameHeight}`,\n };\n\n const panelProps = {\n id: panelId,\n role: \"tabpanel\",\n \"aria-labelledby\": activeTab === \"preview\" ? previewTabId : codeTabId,\n };\n\n return (\n <section ref={sectionRef} className={cn(\"puzzle-preview\", className)}>\n <div className=\"puzzle-preview__toolbar\">\n <div\n className=\"puzzle-preview__tabs\"\n role=\"tablist\"\n aria-label=\"Preview view\"\n >\n <button\n type=\"button\"\n role=\"tab\"\n id={previewTabId}\n ref={rovingFocus.getItemRef(\"preview\")}\n tabIndex={activeTab === \"preview\" ? 0 : -1}\n onFocus={() => handleTabFocus(\"preview\")}\n onKeyDown={(event) => handleTabKeyDown(event, \"preview\")}\n aria-selected={activeTab === \"preview\"}\n aria-controls={panelId}\n className={cn(\n \"puzzle-preview__tab\",\n activeTab === \"preview\" && \"puzzle-preview__tab--active\",\n )}\n onClick={() => setActiveTab(\"preview\")}\n >\n Preview\n </button>\n\n {hasCode && (\n <button\n type=\"button\"\n role=\"tab\"\n id={codeTabId}\n ref={rovingFocus.getItemRef(\"code\")}\n tabIndex={activeTab === \"code\" ? 0 : -1}\n onFocus={() => handleTabFocus(\"code\")}\n onKeyDown={(event) => handleTabKeyDown(event, \"code\")}\n aria-selected={activeTab === \"code\"}\n aria-controls={panelId}\n className={cn(\n \"puzzle-preview__tab\",\n activeTab === \"code\" && \"puzzle-preview__tab--active\",\n )}\n onClick={() => setActiveTab(\"code\")}\n >\n Code\n </button>\n )}\n </div>\n\n {activeTab === \"preview\" ? (\n <div className=\"puzzle-preview__toolbar-actions\">\n {!hideDevices && (\n <div\n className=\"puzzle-preview__devices\"\n role=\"group\"\n aria-label=\"Device size\"\n >\n {(Object.keys(PREVIEW_DEVICES) as PreviewDevice[]).map(\n (item) => (\n <button\n key={item}\n ref={deviceFocus.getItemRef(item)}\n type=\"button\"\n className={cn(\n \"puzzle-preview__device\",\n device === item && \"puzzle-preview__device--active\",\n )}\n aria-pressed={device === item}\n tabIndex={deviceFocus.getItemTabIndex(item)}\n onFocus={() => deviceFocus.onItemFocus(item)}\n onKeyDown={(event) =>\n deviceFocus.onItemKeyDown(event, item)\n }\n onClick={() => setDevice(item)}\n >\n {PREVIEW_DEVICES[item].label}\n </button>\n ),\n )}\n </div>\n )}\n\n <span className=\"puzzle-preview__dimensions\">\n {config.width} × {frameHeight}\n </span>\n </div>\n ) : (\n <button\n type=\"button\"\n className=\"puzzle-preview__copy\"\n onClick={handleCopyCode}\n aria-label={copied ? \"Code copied\" : \"Copy code\"}\n >\n <Icon\n name={copied ? \"tabler:check\" : \"tabler:copy\"}\n size={16}\n aria-hidden=\"true\"\n />\n <span>{copied ? \"Copied\" : \"Copy code\"}</span>\n </button>\n )}\n </div>\n\n <PreviewBackground {...panelProps} className=\"puzzle-preview__panel\">\n <div\n ref={containerRef}\n className=\"puzzle-preview__stage\"\n hidden={activeTab !== \"preview\"}\n >\n <div className=\"puzzle-preview__viewport\" style={viewportStyle}>\n <iframe\n ref={iframeRef}\n className=\"puzzle-preview__frame\"\n srcDoc={createPreviewDocument(frameRootId)}\n title={`${config.label} component preview`}\n onLoad={initializeFrame}\n style={frameStyle}\n />\n\n {frameRoot &&\n createPortal(\n <ThemeScopeProvider\n scopeId={themeScope?.scopeId ?? null}\n theme={themeScope?.theme ?? \"system\"}\n >\n <div style={contentStyle}>{children}</div>\n </ThemeScopeProvider>,\n frameRoot,\n )}\n </div>\n </div>\n\n {activeTab === \"code\" && (\n <div className=\"puzzle-preview__code\">\n <pre>\n <code className=\"language-tsx\">\n {code === undefined ? null : highlightCode(code)}\n </code>\n </pre>\n </div>\n )}\n </PreviewBackground>\n\n <span\n className=\"puzzle-preview__copy-status\"\n role=\"status\"\n aria-live=\"polite\"\n >\n {copied ? \"Code copied to clipboard.\" : \"\"}\n </span>\n </section>\n );\n};\n\nexport {\n Preview,\n type PreviewProps,\n type PreviewDevice,\n type PreviewAlign,\n type PreviewJustify,\n};\n"],"mappings":";;;;;;;;;;;;AA2DA,MAAM,kBAAuD;CAC3D,QAAQ;EAAE,OAAO;EAAU,OAAO;EAAK,QAAQ;CAAI;CACnD,QAAQ;EAAE,OAAO;EAAU,OAAO;EAAK,QAAQ;CAAK;CACpD,SAAS;EAAE,OAAO;EAAW,OAAO;EAAM,QAAQ;CAAI;AACxD;AAEA,MAAM,uBACJ,OAAO,KAAK,eAAe,CAAC,CAC5B,KAAK,QAAQ,EAAE,GAAG,EAAE;AAEtB,MAAM,eAA6C;CACjD,OAAO;CACP,QAAQ;CACR,KAAK;CACL,SAAS;AACX;AAEA,MAAM,iBAAiD;CACrD,OAAO;CACP,QAAQ;CACR,KAAK;CACL,SAAS;CACT,QAAQ;CACR,QAAQ;AACV;AAEA,MAAM,yBAAyB,WAAmB;;;;;;;eAOnC,OAAO;;;AAItB,MAAM,4BACJ,OAAO,WAAW,cAAc,YAAY;AAE9C,MAAM,qBAAqB,UACzB,oBAAC,YAAD;CACE,SAAQ;CACR,MAAM;CACN,WAAW;CACX,WAAW;CACX,gBAAgB;CAChB,GAAI;AACL,CAAA;AAGH,MAAM,WAAW,EACf,UACA,WACA,gBAAgB,UAChB,MACA,QACA,OACA,SACA,cAAc,YACI;CAClB,MAAM,cAAc,MAAM;CAC1B,MAAM,cAAc,GAAG,YAAY;CACnC,MAAM,eAAe,GAAG,YAAY;CACpC,MAAM,YAAY,GAAG,YAAY;CACjC,MAAM,UAAU,GAAG,YAAY;CAE/B,MAAM,aAAa,cAAc;CAEjC,MAAM,CAAC,QAAQ,aAAa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,aACE,oBAAC,oBAAD;OACE,SAAS,YAAY,WAAW;OAChC,OAAO,YAAY,SAAS;OAE5B,UAAA,oBAAC,OAAD;QAAK,OAAO;QAAe;OAAc,CAAA;MACvB,CAAA,GACpB,SACF,CACC;;IACF,CAAA,GAEJ,cAAc,UACb,oBAAC,OAAD;KAAK,WAAU;KACb,UAAA,oBAAC,OAAD,EAAA,UACE,oBAAC,QAAD;MAAM,WAAU;MACb,UAAA,SAAS,KAAA,IAAY,OAAO,cAAc,IAAI;KAC3C,CAAA,EACH,CAAA;IACF,CAAA,CAEU;;GAEnB,oBAAC,QAAD;IACE,WAAU;IACV,MAAK;IACL,aAAU;IAET,UAAA,SAAS,8BAA8B;GACpC,CAAA;EACC;;AAEb"}
|
package/dist/index.cjs
CHANGED
|
@@ -6,55 +6,59 @@ const require_index$3 = require("./components/data-display/alert/index.cjs");
|
|
|
6
6
|
const require_index$4 = require("./components/data-display/avatar/index.cjs");
|
|
7
7
|
const require_index$5 = require("./components/data-display/badge/index.cjs");
|
|
8
8
|
const require_index$6 = require("./components/data-display/card/index.cjs");
|
|
9
|
-
const require_index$7 = require("./components/data-display/
|
|
10
|
-
const require_index$8 = require("./components/data-display/
|
|
9
|
+
const require_index$7 = require("./components/data-display/empty-state/index.cjs");
|
|
10
|
+
const require_index$8 = require("./components/data-display/image/index.cjs");
|
|
11
|
+
const require_index$9 = require("./components/data-display/paper/index.cjs");
|
|
11
12
|
const require_circular_progress = require("./components/data-display/progress/circular-progress.cjs");
|
|
12
13
|
const require_linear_progress = require("./components/data-display/progress/linear-progress.cjs");
|
|
13
|
-
const require_index$
|
|
14
|
-
const require_index$
|
|
14
|
+
const require_index$10 = require("./components/data-display/skeleton/index.cjs");
|
|
15
|
+
const require_index$11 = require("./components/editors/text-editor/index.cjs");
|
|
15
16
|
const require_text_editor_toolbar = require("./components/editors/text-editor/text-editor-toolbar.cjs");
|
|
16
17
|
const require_text_renderer = require("./components/editors/text-editor/text-renderer.cjs");
|
|
17
|
-
const require_index$
|
|
18
|
-
const require_index$
|
|
19
|
-
const require_index$
|
|
20
|
-
const require_index$
|
|
21
|
-
const require_index$
|
|
18
|
+
const require_index$12 = require("./components/forms/autocomplete/index.cjs");
|
|
19
|
+
const require_index$13 = require("./components/forms/checkbox/index.cjs");
|
|
20
|
+
const require_index$14 = require("./components/forms/color-picker/index.cjs");
|
|
21
|
+
const require_index$15 = require("./components/forms/date-picker/index.cjs");
|
|
22
|
+
const require_index$16 = require("./components/forms/file-upload/index.cjs");
|
|
23
|
+
const require_index$17 = require("./components/forms/form-field/index.cjs");
|
|
24
|
+
const require_input_group = require("./components/forms/input-group/input-group.cjs");
|
|
22
25
|
const require_number_input = require("./components/forms/input/number-input.cjs");
|
|
23
26
|
const require_text_area_input = require("./components/forms/input/text-area-input.cjs");
|
|
24
27
|
const require_text_input = require("./components/forms/input/text-input.cjs");
|
|
25
|
-
const require_index$
|
|
26
|
-
const require_index$
|
|
27
|
-
const require_index$
|
|
28
|
-
const require_index$
|
|
29
|
-
const require_index$
|
|
30
|
-
const require_index$
|
|
31
|
-
const require_index$
|
|
32
|
-
const require_index$
|
|
33
|
-
const require_index$
|
|
34
|
-
const require_index$
|
|
35
|
-
const require_index$
|
|
36
|
-
const require_index$
|
|
37
|
-
const require_index$
|
|
38
|
-
const require_index$
|
|
39
|
-
const require_index$
|
|
40
|
-
const require_index$
|
|
41
|
-
const require_index$
|
|
42
|
-
const require_index$
|
|
43
|
-
const require_index$
|
|
44
|
-
const require_index$
|
|
28
|
+
const require_index$18 = require("./components/forms/label/index.cjs");
|
|
29
|
+
const require_index$19 = require("./components/forms/radio-group/index.cjs");
|
|
30
|
+
const require_index$20 = require("./components/forms/select/index.cjs");
|
|
31
|
+
const require_index$21 = require("./components/forms/slider/index.cjs");
|
|
32
|
+
const require_index$22 = require("./components/forms/stepper/index.cjs");
|
|
33
|
+
const require_index$23 = require("./components/forms/switch/index.cjs");
|
|
34
|
+
const require_index$24 = require("./components/layout/app-bar/index.cjs");
|
|
35
|
+
const require_index$25 = require("./components/layout/background/index.cjs");
|
|
36
|
+
const require_index$26 = require("./components/layout/bottom-navigation/index.cjs");
|
|
37
|
+
const require_index$27 = require("./components/layout/breadcrumbs/index.cjs");
|
|
38
|
+
const require_index$28 = require("./components/layout/collapsable-sidebar/index.cjs");
|
|
39
|
+
const require_index$29 = require("./components/layout/container/index.cjs");
|
|
40
|
+
const require_index$30 = require("./components/layout/page-layout/index.cjs");
|
|
41
|
+
const require_index$31 = require("./components/layout/resizable-panels/index.cjs");
|
|
42
|
+
const require_index$32 = require("./components/layout/section/index.cjs");
|
|
43
|
+
const require_index$33 = require("./components/layout/section-stack/index.cjs");
|
|
44
|
+
const require_index$34 = require("./components/layout/sidebar/index.cjs");
|
|
45
|
+
const require_index$35 = require("./components/layout/stack/index.cjs");
|
|
46
|
+
const require_index$36 = require("./components/navigation/accordion/index.cjs");
|
|
47
|
+
const require_index$37 = require("./components/navigation/carousel/index.cjs");
|
|
45
48
|
const require_controller = require("./components/navigation/carousel/controller.cjs");
|
|
46
|
-
const require_index$
|
|
47
|
-
const require_index$
|
|
48
|
-
const require_index$
|
|
49
|
-
const require_index$
|
|
50
|
-
const require_index$
|
|
51
|
-
const require_index$
|
|
52
|
-
const require_index$
|
|
53
|
-
const require_index$
|
|
54
|
-
const require_index$
|
|
55
|
-
const require_index$
|
|
56
|
-
const require_index$
|
|
57
|
-
const require_index$
|
|
49
|
+
const require_index$38 = require("./components/navigation/link/index.cjs");
|
|
50
|
+
const require_index$39 = require("./components/navigation/pagination/index.cjs");
|
|
51
|
+
const require_index$40 = require("./components/navigation/tabs/index.cjs");
|
|
52
|
+
const require_index$41 = require("./components/navigation/tree-view/index.cjs");
|
|
53
|
+
const require_index$42 = require("./components/overlays/backdrop/index.cjs");
|
|
54
|
+
const require_index$43 = require("./components/overlays/command/index.cjs");
|
|
55
|
+
const require_index$44 = require("./components/overlays/dialog/index.cjs");
|
|
56
|
+
const require_index$45 = require("./components/overlays/drawer/index.cjs");
|
|
57
|
+
const require_index$46 = require("./components/overlays/dropdown-menu/index.cjs");
|
|
58
|
+
const require_index$47 = require("./components/overlays/notification/index.cjs");
|
|
59
|
+
const require_index$48 = require("./components/overlays/popout/index.cjs");
|
|
60
|
+
const require_index$49 = require("./components/overlays/portal/index.cjs");
|
|
61
|
+
const require_index$50 = require("./components/overlays/popover/index.cjs");
|
|
58
62
|
const require_dropdown_menu_content = require("./components/overlays/dropdown-menu/dropdown-menu-content.cjs");
|
|
59
63
|
const require_dropdown_menu_trigger = require("./components/overlays/dropdown-menu/dropdown-menu-trigger.cjs");
|
|
60
64
|
const require_dropdown_menu_items = require("./components/overlays/dropdown-menu/dropdown-menu-items.cjs");
|
|
@@ -62,23 +66,23 @@ const require_dropdown_menu_radio = require("./components/overlays/dropdown-menu
|
|
|
62
66
|
const require_target = require("./components/overlays/portal/target.cjs");
|
|
63
67
|
const require_notification_provider = require("./components/overlays/notification/notification-provider.cjs");
|
|
64
68
|
const require_use_notification = require("./components/overlays/notification/use-notification.cjs");
|
|
65
|
-
const require_index$
|
|
69
|
+
const require_index$51 = require("./components/overlays/tooltip/index.cjs");
|
|
66
70
|
const require_text = require("./components/typography/text.cjs");
|
|
67
71
|
const require_heading = require("./components/typography/heading.cjs");
|
|
68
|
-
const require_index$
|
|
69
|
-
const require_index$
|
|
70
|
-
const require_index$
|
|
71
|
-
exports.Accordion = require_index$
|
|
72
|
+
const require_index$52 = require("./components/utilities/preview/index.cjs");
|
|
73
|
+
const require_index$53 = require("./components/utilities/scroll-lock/index.cjs");
|
|
74
|
+
const require_index$54 = require("./components/utilities/transition/index.cjs");
|
|
75
|
+
exports.Accordion = require_index$36.Accordion;
|
|
72
76
|
exports.Alert = require_index$3.Alert;
|
|
73
|
-
exports.AppBar = require_index$
|
|
74
|
-
exports.Autocomplete = require_index$
|
|
77
|
+
exports.AppBar = require_index$24.AppBar;
|
|
78
|
+
exports.Autocomplete = require_index$12.Autocomplete;
|
|
75
79
|
exports.Avatar = require_index$4.Avatar;
|
|
76
|
-
exports.Backdrop = require_index$
|
|
77
|
-
exports.Background = require_index$
|
|
80
|
+
exports.Backdrop = require_index$42.Backdrop;
|
|
81
|
+
exports.Background = require_index$25.Background;
|
|
78
82
|
exports.Badge = require_index$5.Badge;
|
|
79
|
-
exports.BottomNavigation = require_index$
|
|
80
|
-
exports.BottomNavigationItem = require_index$
|
|
81
|
-
exports.Breadcrumbs = require_index$
|
|
83
|
+
exports.BottomNavigation = require_index$26.BottomNavigation;
|
|
84
|
+
exports.BottomNavigationItem = require_index$26.BottomNavigationItem;
|
|
85
|
+
exports.Breadcrumbs = require_index$27.Breadcrumbs;
|
|
82
86
|
exports.Button = require_index.Button;
|
|
83
87
|
exports.ButtonGroup = require_index$1.ButtonGroup;
|
|
84
88
|
exports.Card = require_index$6.Card;
|
|
@@ -89,18 +93,19 @@ exports.CardFooter = require_index$6.CardFooter;
|
|
|
89
93
|
exports.CardHeader = require_index$6.CardHeader;
|
|
90
94
|
exports.CardMedia = require_index$6.CardMedia;
|
|
91
95
|
exports.CardTitle = require_index$6.CardTitle;
|
|
92
|
-
exports.Carousel = require_index$
|
|
96
|
+
exports.Carousel = require_index$37.Carousel;
|
|
93
97
|
exports.CarouselController = require_controller.CarouselController;
|
|
94
|
-
exports.Checkbox = require_index$
|
|
98
|
+
exports.Checkbox = require_index$13.Checkbox;
|
|
95
99
|
exports.CircularProgress = require_circular_progress.CircularProgress;
|
|
96
|
-
exports.CollapsableSidebar = require_index$
|
|
97
|
-
exports.
|
|
98
|
-
exports.
|
|
99
|
-
exports.
|
|
100
|
-
exports.
|
|
101
|
-
exports.
|
|
102
|
-
exports.
|
|
103
|
-
exports.
|
|
100
|
+
exports.CollapsableSidebar = require_index$28.CollapsableSidebar;
|
|
101
|
+
exports.ColorPicker = require_index$14.ColorPicker;
|
|
102
|
+
exports.Command = require_index$43.Command;
|
|
103
|
+
exports.CommandDialog = require_index$43.CommandDialog;
|
|
104
|
+
exports.Container = require_index$29.Container;
|
|
105
|
+
exports.DatePicker = require_index$15.DatePicker;
|
|
106
|
+
exports.Dialog = require_index$44.Dialog;
|
|
107
|
+
exports.Drawer = require_index$45.Drawer;
|
|
108
|
+
exports.DropdownMenu = require_index$46.DropdownMenu;
|
|
104
109
|
exports.DropdownMenuCheckboxItem = require_dropdown_menu_items.DropdownMenuCheckboxItem;
|
|
105
110
|
exports.DropdownMenuContent = require_dropdown_menu_content.DropdownMenuContent;
|
|
106
111
|
exports.DropdownMenuGroup = require_dropdown_menu_items.DropdownMenuGroup;
|
|
@@ -110,50 +115,58 @@ exports.DropdownMenuRadioGroup = require_dropdown_menu_radio.DropdownMenuRadioGr
|
|
|
110
115
|
exports.DropdownMenuRadioItem = require_dropdown_menu_radio.DropdownMenuRadioItem;
|
|
111
116
|
exports.DropdownMenuSeparator = require_dropdown_menu_items.DropdownMenuSeparator;
|
|
112
117
|
exports.DropdownMenuTrigger = require_dropdown_menu_trigger.DropdownMenuTrigger;
|
|
113
|
-
exports.
|
|
114
|
-
exports.
|
|
118
|
+
exports.EmptyState = require_index$7.EmptyState;
|
|
119
|
+
exports.EmptyStateContent = require_index$7.EmptyStateContent;
|
|
120
|
+
exports.EmptyStateDescription = require_index$7.EmptyStateDescription;
|
|
121
|
+
exports.EmptyStateHeader = require_index$7.EmptyStateHeader;
|
|
122
|
+
exports.EmptyStateMedia = require_index$7.EmptyStateMedia;
|
|
123
|
+
exports.EmptyStateTitle = require_index$7.EmptyStateTitle;
|
|
124
|
+
exports.FileUpload = require_index$16.FileUpload;
|
|
125
|
+
exports.FormField = require_index$17.FormField;
|
|
115
126
|
exports.Heading = require_heading.Heading;
|
|
116
|
-
exports.Image = require_index$
|
|
117
|
-
exports.
|
|
127
|
+
exports.Image = require_index$8.Image;
|
|
128
|
+
exports.InputGroup = require_input_group.InputGroup;
|
|
129
|
+
exports.Label = require_index$18.Label;
|
|
118
130
|
exports.LinearProgress = require_linear_progress.LinearProgress;
|
|
119
|
-
exports.Link = require_index$
|
|
120
|
-
exports.Notification = require_index$
|
|
131
|
+
exports.Link = require_index$38.Link;
|
|
132
|
+
exports.Notification = require_index$47.Notification;
|
|
121
133
|
exports.NotificationProvider = require_notification_provider.NotificationProvider;
|
|
122
|
-
exports.NotificationViewport = require_index$
|
|
134
|
+
exports.NotificationViewport = require_index$47.NotificationViewport;
|
|
123
135
|
exports.NumberInput = require_number_input.NumberInput;
|
|
124
|
-
exports.PageLayout = require_index$
|
|
125
|
-
exports.
|
|
126
|
-
exports.
|
|
127
|
-
exports.
|
|
128
|
-
exports.
|
|
136
|
+
exports.PageLayout = require_index$30.PageLayout;
|
|
137
|
+
exports.Pagination = require_index$39.Pagination;
|
|
138
|
+
exports.Paper = require_index$9.Paper;
|
|
139
|
+
exports.Popout = require_index$48.Popout;
|
|
140
|
+
exports.Popover = require_index$50.Popover;
|
|
141
|
+
exports.Portal = require_index$49.Portal;
|
|
129
142
|
exports.PortalTarget = require_target.PortalTarget;
|
|
130
|
-
exports.Preview = require_index$
|
|
131
|
-
exports.Radio = require_index$
|
|
132
|
-
exports.RadioGroup = require_index$
|
|
133
|
-
exports.ResizableHandle = require_index$
|
|
134
|
-
exports.ResizablePanel = require_index$
|
|
135
|
-
exports.ResizablePanels = require_index$
|
|
136
|
-
exports.ScrollLock = require_index$
|
|
137
|
-
exports.Section = require_index$
|
|
138
|
-
exports.SectionStack = require_index$
|
|
139
|
-
exports.Select = require_index$
|
|
140
|
-
exports.Sidebar = require_index$
|
|
141
|
-
exports.Skeleton = require_index$
|
|
142
|
-
exports.Slider = require_index$
|
|
143
|
-
exports.Stack = require_index$
|
|
144
|
-
exports.Stepper = require_index$
|
|
145
|
-
exports.Switch = require_index$
|
|
146
|
-
exports.Tabs = require_index$
|
|
147
|
-
exports.TabsTab = require_index$
|
|
143
|
+
exports.Preview = require_index$52.Preview;
|
|
144
|
+
exports.Radio = require_index$19.Radio;
|
|
145
|
+
exports.RadioGroup = require_index$19.RadioGroup;
|
|
146
|
+
exports.ResizableHandle = require_index$31.ResizableHandle;
|
|
147
|
+
exports.ResizablePanel = require_index$31.ResizablePanel;
|
|
148
|
+
exports.ResizablePanels = require_index$31.ResizablePanels;
|
|
149
|
+
exports.ScrollLock = require_index$53.ScrollLock;
|
|
150
|
+
exports.Section = require_index$32.Section;
|
|
151
|
+
exports.SectionStack = require_index$33.SectionStack;
|
|
152
|
+
exports.Select = require_index$20.Select;
|
|
153
|
+
exports.Sidebar = require_index$34.Sidebar;
|
|
154
|
+
exports.Skeleton = require_index$10.Skeleton;
|
|
155
|
+
exports.Slider = require_index$21.Slider;
|
|
156
|
+
exports.Stack = require_index$35.Stack;
|
|
157
|
+
exports.Stepper = require_index$22.Stepper;
|
|
158
|
+
exports.Switch = require_index$23.Switch;
|
|
159
|
+
exports.Tabs = require_index$40.Tabs;
|
|
160
|
+
exports.TabsTab = require_index$40.TabsTab;
|
|
148
161
|
exports.Text = require_text.Text;
|
|
149
162
|
exports.TextAreaInput = require_text_area_input.TextAreaInput;
|
|
150
|
-
exports.TextEditor = require_index$
|
|
163
|
+
exports.TextEditor = require_index$11.TextEditor;
|
|
151
164
|
exports.TextEditorToolbar = require_text_editor_toolbar.TextEditorToolbar;
|
|
152
165
|
exports.TextInput = require_text_input.TextInput;
|
|
153
166
|
exports.TextRenderer = require_text_renderer.TextRenderer;
|
|
154
167
|
exports.ToggleGroup = require_index$2.ToggleGroup;
|
|
155
|
-
exports.Tooltip = require_index$
|
|
156
|
-
exports.Transition = require_index$
|
|
157
|
-
exports.TreeView = require_index$
|
|
168
|
+
exports.Tooltip = require_index$51.Tooltip;
|
|
169
|
+
exports.Transition = require_index$54.Transition;
|
|
170
|
+
exports.TreeView = require_index$41.TreeView;
|
|
158
171
|
exports.useCarouselContext = require_controller.useCarouselContext;
|
|
159
172
|
exports.useNotification = require_use_notification.useNotification;
|