@reforma/components 0.3.3 → 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/dist/Composer/parts.d.ts +1 -1
- package/dist/Composer/parts.d.ts.map +1 -1
- package/dist/Composer/parts.js +102 -98
- package/dist/Composer/parts.js.map +1 -1
- package/dist/Composer/reforma/Composer.module.css +1 -1
- package/dist/Composer/reforma/Composer.module.css.js +24 -22
- package/dist/Composer/reforma/Composer.module.css.js.map +1 -1
- package/dist/Composer/types.d.ts +1 -1
- package/dist/Composer/types.d.ts.map +1 -1
- package/dist/Modal/Modal.d.ts +2 -2
- package/dist/Modal/Modal.d.ts.map +1 -1
- package/dist/Modal/Modal.js +6 -3
- package/dist/Modal/Modal.js.map +1 -1
- package/dist/SettingsLayout/SettingsLayout.d.ts +1 -0
- package/dist/SettingsLayout/SettingsLayout.d.ts.map +1 -1
- package/dist/SettingsLayout/SettingsLayout.js +332 -292
- package/dist/SettingsLayout/SettingsLayout.js.map +1 -1
- package/dist/SettingsLayout/SettingsLayout.module.css +1 -1
- package/dist/SettingsLayout/SettingsLayout.module.css.js +20 -18
- package/dist/SettingsLayout/SettingsLayout.module.css.js.map +1 -1
- package/dist/chat/Attachment/Attachment.d.ts.map +1 -1
- package/dist/chat/Attachment/Attachment.js +14 -16
- package/dist/chat/Attachment/Attachment.js.map +1 -1
- package/dist/chat/Attachment/Attachment.module.css +1 -1
- package/dist/chat/Tool/Tool.d.ts.map +1 -1
- package/dist/chat/Tool/Tool.js +77 -75
- package/dist/chat/Tool/Tool.js.map +1 -1
- package/dist/chat/Tool/agent/AgentTool.d.ts.map +1 -1
- package/dist/chat/Tool/agent/AgentTool.js +18 -17
- package/dist/chat/Tool/agent/AgentTool.js.map +1 -1
- package/dist/chat/Tool/check-page/CheckPageTool.d.ts +4 -0
- package/dist/chat/Tool/check-page/CheckPageTool.d.ts.map +1 -0
- package/dist/chat/Tool/check-page/CheckPageTool.js +75 -0
- package/dist/chat/Tool/check-page/CheckPageTool.js.map +1 -0
- package/dist/chat/Tool/check-page/index.d.ts +2 -0
- package/dist/chat/Tool/check-page/index.d.ts.map +1 -0
- package/dist/chat/Tool/check-page/index.js +5 -0
- package/dist/chat/Tool/check-page/index.js.map +1 -0
- package/dist/index.js +156 -155
- package/dist/modals/ConfirmModal.d.ts +2 -0
- package/dist/modals/ConfirmModal.d.ts.map +1 -1
- package/dist/modals/ConfirmModal.js +88 -60
- package/dist/modals/ConfirmModal.js.map +1 -1
- package/dist/modals/index.d.ts +1 -1
- package/dist/modals/index.d.ts.map +1 -1
- package/dist/modals/index.js +2 -1
- package/dist/openui/functions/index.d.ts +59 -59
- package/dist/openui/functions/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/node_modules/clsx/dist/clsx.js +0 -18
- package/dist/node_modules/clsx/dist/clsx.js.map +0 -1
- package/dist/node_modules/react-aria/dist/private/interactions/useFocusable.js +0 -17
- package/dist/node_modules/react-aria/dist/private/interactions/useFocusable.js.map +0 -1
- package/dist/node_modules/react-aria/dist/private/utils/useObjectRef.js +0 -34
- package/dist/node_modules/react-aria/dist/private/utils/useObjectRef.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/errors.js +0 -38
- package/dist/node_modules/zod/v4/classic/errors.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/parse.js +0 -21
- package/dist/node_modules/zod/v4/classic/parse.js.map +0 -1
- package/dist/node_modules/zod/v4/classic/schemas.js +0 -822
- package/dist/node_modules/zod/v4/classic/schemas.js.map +0 -1
- package/dist/node_modules/zod/v4/core/api.js +0 -561
- package/dist/node_modules/zod/v4/core/api.js.map +0 -1
- package/dist/node_modules/zod/v4/core/checks.js +0 -262
- package/dist/node_modules/zod/v4/core/checks.js.map +0 -1
- package/dist/node_modules/zod/v4/core/core.js +0 -97
- package/dist/node_modules/zod/v4/core/core.js.map +0 -1
- package/dist/node_modules/zod/v4/core/doc.js +0 -35
- package/dist/node_modules/zod/v4/core/doc.js.map +0 -1
- package/dist/node_modules/zod/v4/core/errors.js +0 -79
- package/dist/node_modules/zod/v4/core/errors.js.map +0 -1
- package/dist/node_modules/zod/v4/core/json-schema-processors.js +0 -308
- package/dist/node_modules/zod/v4/core/json-schema-processors.js.map +0 -1
- package/dist/node_modules/zod/v4/core/memoizer.js +0 -203
- package/dist/node_modules/zod/v4/core/memoizer.js.map +0 -1
- package/dist/node_modules/zod/v4/core/parse.js +0 -113
- package/dist/node_modules/zod/v4/core/parse.js.map +0 -1
- package/dist/node_modules/zod/v4/core/regexes.js +0 -59
- package/dist/node_modules/zod/v4/core/regexes.js.map +0 -1
- package/dist/node_modules/zod/v4/core/registries.js +0 -41
- package/dist/node_modules/zod/v4/core/registries.js.map +0 -1
- package/dist/node_modules/zod/v4/core/schemas.js +0 -1104
- package/dist/node_modules/zod/v4/core/schemas.js.map +0 -1
- package/dist/node_modules/zod/v4/core/to-json-schema.js +0 -380
- package/dist/node_modules/zod/v4/core/to-json-schema.js.map +0 -1
- package/dist/node_modules/zod/v4/core/util.js +0 -465
- package/dist/node_modules/zod/v4/core/util.js.map +0 -1
- package/dist/node_modules/zod/v4/core/versions.js +0 -9
- package/dist/node_modules/zod/v4/core/versions.js.map +0 -1
- package/dist/node_modules/zod/v4/locales/en.js +0 -97
- package/dist/node_modules/zod/v4/locales/en.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsLayout.js","sources":["../../src/SettingsLayout/SettingsLayout.tsx"],"sourcesContent":["import { MOTION_EASE_UI } from '@reforma/constants';\nimport { cn } from '@reforma/lib';\nimport { AnimatePresence, motion, useReducedMotion } from 'motion/react';\nimport { createContext, use, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { Box } from '../Box';\nimport { Breadcrumb } from '../Breadcrumb';\nimport { Button } from '../Button';\nimport { For } from '../For';\nimport { tooltipWithHotkey } from '../Hotkey';\nimport { ListBox, ListBoxItem } from '../List';\nimport { Scrollable } from '../Scrollable';\nimport { Show } from '../Show';\nimport { Text } from '../Text';\nimport { toast } from '../Toast';\nimport styles from './SettingsLayout.module.css';\n\nimport type { ReactNode, RefObject } from 'react';\n\nconst MotionScrollable = motion.create(Scrollable);\n\nconst PANE_DURATION_S = 0.35;\nconst SLIDE_IN = 32;\nconst SLIDE_OUT = -12;\nconst SAVE_HOTKEY = ['mod', 's'] as const;\n\nfunction isSaveHotkey(event: KeyboardEvent): boolean {\n if (!(event.metaKey || event.ctrlKey) || event.altKey || event.shiftKey) {\n return false;\n }\n\n return event.key === 's' || event.key === 'S';\n}\n\nfunction paneTransition(reducedMotion: boolean | null) {\n return { duration: reducedMotion ? 0 : PANE_DURATION_S, ease: MOTION_EASE_UI };\n}\n\nfunction tabEnterTransition(reducedMotion: boolean | null) {\n return { duration: reducedMotion ? 0 : PANE_DURATION_S, ease: 'easeOut' as const };\n}\n\nfunction layerRest(covered: boolean, reducedMotion: boolean | null) {\n return {\n opacity: covered ? 0 : 1,\n x: (covered && !reducedMotion) ? SLIDE_OUT : 0,\n y: 0,\n };\n}\n\nexport interface SettingsNavItem {\n id: string;\n label: string;\n icon?: ReactNode;\n}\n\nexport interface SettingsStackItem {\n id: string;\n label: string;\n}\n\ninterface SettingsLayoutContextValue {\n items: readonly SettingsNavItem[];\n selectedId: string;\n select: (id: string) => void;\n stack: readonly SettingsStackItem[];\n push: (item: SettingsStackItem) => void;\n rename: (id: string, label: string) => void;\n pop: () => void;\n reset: () => void;\n}\n\nconst SettingsLayoutContext = createContext<SettingsLayoutContextValue | null>(null);\nconst SettingsOverlayContext = createContext<HTMLElement | null>(null);\n\nexport function useSettingsLayout(): SettingsLayoutContextValue {\n const ctx = use(SettingsLayoutContext);\n\n if (!ctx) {\n throw new Error('useSettingsLayout must be used inside SettingsLayout');\n }\n\n return ctx;\n}\n\ntype SettingsSaveCopy = {\n dirty: string;\n saving: string;\n saved: string;\n tooltip?: string;\n};\n\ntype SettingsSaveVerb = 'save' | 'add' | SettingsSaveCopy;\n\ninterface SettingsSaveContextValue {\n saveRef: RefObject<(() => Promise<boolean>) | null>;\n onDirtyChange: (dirty: boolean) => void;\n setSaveVerb: (verb: SettingsSaveVerb) => void;\n}\n\nconst SettingsSaveContext = createContext<SettingsSaveContextValue | null>(null);\n\nexport function useSettingsSave(): SettingsSaveContextValue {\n const ctx = use(SettingsSaveContext);\n\n if (!ctx) {\n throw new Error('useSettingsSave must be used inside SettingsLayout.Content with saveable prop');\n }\n\n return ctx;\n}\n\nexport interface SettingsLayoutProps {\n items: readonly SettingsNavItem[];\n defaultSelected?: string;\n defaultStack?: readonly SettingsStackItem[];\n className?: string;\n children: ReactNode;\n}\n\nfunction SettingsLayoutRoot({\n items,\n defaultSelected,\n defaultStack,\n className,\n children,\n}: SettingsLayoutProps) {\n const [selectedId, setSelectedId] = useState(defaultSelected ?? items[0]?.id ?? '');\n const [stack, setStack] = useState<SettingsStackItem[]>(() => (\n defaultStack ? [...defaultStack] : []\n ));\n\n const select = (id: string) => {\n if (id !== selectedId) {\n setSelectedId(id);\n }\n\n setStack([]);\n };\n\n return (\n <SettingsLayoutContext\n value={ {\n items,\n selectedId,\n select,\n stack,\n push: item => setStack(current => [...current, item]),\n rename: (id, label) => setStack(current => current.map(item => (\n item.id === id && item.label !== label\n ? { ...item, label }\n : item\n ))),\n pop: () => setStack(current => current.slice(0, -1)),\n reset: () => setStack([]),\n } }\n >\n <div className={ cn(styles.root, className) }>\n { children }\n </div>\n </SettingsLayoutContext>\n );\n}\n\nexport interface SettingsLayoutSidebarProps {\n title?: string;\n className?: string;\n 'aria-label'?: string;\n footer?: ReactNode;\n}\n\nfunction Sidebar({\n title,\n className,\n 'aria-label': ariaLabel = 'Settings sections',\n footer,\n}: SettingsLayoutSidebarProps) {\n const { items, selectedId, select } = useSettingsLayout();\n\n return (\n <div className={ cn(styles.sidebar, className) }>\n <Show when={ title }>\n <Text variant=\"sm\" color=\"secondary\" className={ styles.sidebarTitle }>\n { title }\n </Text>\n </Show>\n <ListBox\n aria-label={ ariaLabel }\n size=\"md\"\n selectionMode=\"single\"\n selectedKeys={ [selectedId] }\n disallowEmptySelection\n >\n <For each={ items }>\n { item => (\n <ListBoxItem\n key={ item.id }\n id={ item.id }\n icon={ item.icon }\n textValue={ item.label }\n onPress={ () => select(item.id) }\n >\n { item.label }\n </ListBoxItem>\n ) }\n </For>\n </ListBox>\n <Show when={ footer }>\n <div className={ styles.sidebarFooter }>{ footer }</div>\n </Show>\n </div>\n );\n}\n\nfunction Title() {\n const { items, selectedId, stack, reset } = useSettingsLayout();\n const rootLabel = items.find(item => item.id === selectedId)?.label ?? '';\n\n return (\n <Breadcrumb variant=\"heading-2\" className={ styles.title }>\n { stack.length === 0\n ? (\n <Breadcrumb.Page key=\"root\">\n { rootLabel }\n </Breadcrumb.Page>\n )\n : (\n <Breadcrumb.Link key=\"root\" onPress={ reset }>\n { rootLabel }\n </Breadcrumb.Link>\n ) }\n <For each={ stack }>\n { item => (\n <Breadcrumb.Page key={ item.id }>\n { item.label }\n </Breadcrumb.Page>\n ) }\n </For>\n </Breadcrumb>\n );\n}\n\nexport interface SettingsLayoutPaneProps {\n paneKey?: string;\n className?: string;\n children: ReactNode;\n}\n\n/** Nested view over the content viewport. Previous layer stays mounted (scroll kept). */\nfunction Pane({ paneKey, className, children }: SettingsLayoutPaneProps) {\n const { stack } = useSettingsLayout();\n const overlay = use(SettingsOverlayContext);\n const reducedMotion = useReducedMotion();\n const index = paneKey ? stack.findIndex(item => item.id === paneKey) : -1;\n const covered = index >= 0 && index < stack.length - 1;\n\n if (!overlay) {\n return null;\n }\n\n return createPortal(\n <AnimatePresence initial={ false }>\n { paneKey\n ? (\n <MotionScrollable\n key={ paneKey }\n className={ cn(styles.overlay, className) }\n contentClass={ cn(styles.scrollContent, styles.paneContent) }\n initial={ reducedMotion ? false : { opacity: 0, x: SLIDE_IN } }\n animate={ layerRest(covered, reducedMotion) }\n exit={ reducedMotion ? undefined : { opacity: 0, x: SLIDE_IN, pointerEvents: 'none' } }\n transition={ paneTransition(reducedMotion) }\n inert={ covered }\n >\n { children }\n </MotionScrollable>\n )\n : null }\n </AnimatePresence>,\n overlay\n );\n}\n\nfunction Shell({\n className,\n action,\n footer,\n children,\n}: {\n className?: string;\n action?: ReactNode;\n footer?: ReactNode;\n children: ReactNode;\n}) {\n const { selectedId, stack } = useSettingsLayout();\n const [overlay, setOverlay] = useState<HTMLDivElement | null>(null);\n const reducedMotion = useReducedMotion();\n const covered = stack.length > 0;\n const animate = useMemo(\n () => layerRest(covered, reducedMotion),\n [covered, reducedMotion]\n );\n\n return (\n <SettingsOverlayContext value={ overlay }>\n <div className={ cn(styles.content, className) }>\n <div className={ styles.header }>\n <Title />\n { action }\n </div>\n <div ref={ setOverlay } className={ styles.viewport }>\n <MotionScrollable\n key={ selectedId }\n className={ styles.scroll }\n contentClass={ styles.scrollContent }\n initial={ reducedMotion ? false : { opacity: 0.6, y: 8 } }\n animate={ animate }\n transition={ covered\n ? paneTransition(reducedMotion)\n : tabEnterTransition(reducedMotion) }\n inert={ covered }\n >\n { children }\n </MotionScrollable>\n </div>\n { footer }\n </div>\n </SettingsOverlayContext>\n );\n}\n\nfunction Empty({ children }: { children: ReactNode }) {\n return (\n <Box align=\"center\" justify=\"center\" gap=\"lg\" grow fullWidth fullHeight>\n { children }\n </Box>\n );\n}\n\nexport interface SettingsLayoutContentProps {\n headerRight?: ReactNode;\n /** Pinned under the scrolling pane. */\n footer?: ReactNode;\n saveable?: boolean;\n className?: string;\n children: ReactNode;\n}\n\nfunction Content({ headerRight, footer, saveable, className, children }: SettingsLayoutContentProps) {\n if (saveable) {\n return (\n <SaveableContent headerRight={ headerRight } footer={ footer } className={ className }>\n { children }\n </SaveableContent>\n );\n }\n\n return (\n <Shell className={ className } action={ headerRight } footer={ footer }>\n { children }\n </Shell>\n );\n}\n\ntype SaveState = 'idle' | 'dirty' | 'saving' | 'saved';\n\nconst SAVED_DISPLAY_DURATION = 1000;\n\nconst ACTION_COPY = {\n save: {\n dirty: 'Save changes',\n saving: 'Saving…',\n saved: 'Saved',\n tooltip: 'Save changes',\n },\n add: {\n dirty: 'Add',\n saving: 'Adding…',\n saved: 'Added',\n tooltip: 'Add',\n },\n} as const satisfies Record<string, SettingsSaveCopy & { tooltip: string }>;\n\nfunction saveActionCopy(verb: SettingsSaveVerb): SettingsSaveCopy & { tooltip: string } {\n if (typeof verb === 'object') {\n return {\n dirty: verb.dirty,\n saving: verb.saving,\n saved: verb.saved,\n tooltip: verb.tooltip ?? verb.dirty,\n };\n }\n\n return ACTION_COPY[verb];\n}\n\nfunction SaveableContent({\n headerRight,\n footer,\n className,\n children,\n}: Omit<SettingsLayoutContentProps, 'saveable'>) {\n const { selectedId } = useSettingsLayout();\n const reducedMotion = useReducedMotion();\n const [saveState, setSaveState] = useState<SaveState>('idle');\n const [saveVerb, setSaveVerb] = useState<SettingsSaveVerb>('save');\n const saveRef = useRef<(() => Promise<boolean>) | null>(null);\n const savedTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const [saveTab, setSaveTab] = useState(selectedId);\n\n if (saveTab !== selectedId) {\n setSaveTab(selectedId);\n setSaveState('idle');\n setSaveVerb('save');\n }\n\n const onDirtyChange = useCallback((dirty: boolean) => {\n setSaveState((prev) => {\n if (dirty) {\n return 'dirty';\n }\n\n if (prev === 'dirty') {\n return 'idle';\n }\n\n return prev;\n });\n }, []);\n\n const handleSave = useCallback(async() => {\n if (!saveRef.current) {\n return;\n }\n\n setSaveState('saving');\n\n try {\n const success = await saveRef.current();\n\n if (success) {\n setSaveState('saved');\n }\n else {\n setSaveState('dirty');\n }\n }\n catch {\n toast.error({ message: 'Something went wrong while saving.' });\n setSaveState('dirty');\n }\n }, []);\n\n useEffect(() => {\n if (saveState !== 'dirty') {\n return;\n }\n\n // Window capture so Pane overlays (portaled) still hit ⌘S / Ctrl+S.\n const onKeyDown = (event: KeyboardEvent) => {\n if (!isSaveHotkey(event)) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n void handleSave();\n };\n\n window.addEventListener('keydown', onKeyDown, true);\n\n return () => {\n window.removeEventListener('keydown', onKeyDown, true);\n };\n }, [handleSave, saveState]);\n\n useEffect(() => {\n if (saveState === 'saved') {\n savedTimerRef.current = setTimeout(() => {\n setSaveState('idle');\n }, SAVED_DISPLAY_DURATION);\n }\n\n return () => {\n clearTimeout(savedTimerRef.current);\n };\n }, [saveState]);\n\n const ctx = useMemo<SettingsSaveContextValue>(\n () => ({ saveRef, onDirtyChange, setSaveVerb }),\n [onDirtyChange]\n );\n\n const saveTransition = {\n duration: reducedMotion ? 0 : 0.2,\n ease: MOTION_EASE_UI,\n };\n\n const copy = saveActionCopy(saveVerb);\n let saveControl: ReactNode = null;\n\n if (saveState === 'dirty') {\n saveControl = (\n <Button\n color=\"contrast\"\n size=\"sm\"\n onPress={ () => void handleSave() }\n tooltip={ tooltipWithHotkey(copy.tooltip, SAVE_HOTKEY) }\n >\n { copy.dirty }\n </Button>\n );\n }\n else if (saveState === 'saving') {\n saveControl = (\n <Button color=\"contrast\" size=\"sm\" isDisabled>\n { copy.saving }\n </Button>\n );\n }\n else if (saveState === 'saved') {\n saveControl = (\n <Button color=\"success\" size=\"sm\">\n { copy.saved }\n </Button>\n );\n }\n\n return (\n <SettingsSaveContext value={ ctx }>\n <Shell\n className={ className }\n footer={ footer }\n action={ (\n <div className={ styles.headerAction }>\n <AnimatePresence mode=\"popLayout\" initial={ false }>\n { saveControl\n ? (\n <motion.div\n key=\"save\"\n className={ styles.saveAction }\n initial={ { opacity: 0, scale: 0.92 } }\n animate={ { opacity: 1, scale: 1 } }\n exit={ { opacity: 0, scale: 0.92 } }\n transition={ saveTransition }\n >\n { saveControl }\n </motion.div>\n )\n : headerRight\n ? (\n <motion.div\n key=\"header-right\"\n className={ styles.saveAction }\n initial={ { opacity: 0 } }\n animate={ { opacity: 1 } }\n exit={ { opacity: 0 } }\n transition={ saveTransition }\n >\n { headerRight }\n </motion.div>\n )\n : null }\n </AnimatePresence>\n </div>\n ) }\n >\n { children }\n </Shell>\n </SettingsSaveContext>\n );\n}\n\nexport const SettingsLayout = Object.assign(SettingsLayoutRoot, {\n Sidebar,\n Content,\n Pane,\n Empty,\n});\n\nSettingsLayoutRoot.displayName = 'SettingsLayout';\nSidebar.displayName = 'SettingsLayout.Sidebar';\nContent.displayName = 'SettingsLayout.Content';\nPane.displayName = 'SettingsLayout.Pane';\nEmpty.displayName = 'SettingsLayout.Empty';\n"],"names":["MotionScrollable","motion","Scrollable","PANE_DURATION_S","SLIDE_IN","SLIDE_OUT","SAVE_HOTKEY","isSaveHotkey","event","paneTransition","reducedMotion","MOTION_EASE_UI","tabEnterTransition","layerRest","covered","SettingsLayoutContext","SettingsOverlayContext","useSettingsLayout","ctx","use","SettingsSaveContext","useSettingsSave","SettingsLayoutRoot","items","defaultSelected","defaultStack","className","children","selectedId","setSelectedId","useState","stack","setStack","id","current","item","label","cn","styles","Sidebar","title","ariaLabel","footer","select","_jsx","Show","Text","ListBox","For","ListBoxItem","Title","reset","rootLabel","Breadcrumb","Pane","paneKey","overlay","useReducedMotion","index","createPortal","AnimatePresence","Shell","action","setOverlay","animate","useMemo","_jsxs","Empty","Box","Content","headerRight","saveable","SaveableContent","SAVED_DISPLAY_DURATION","ACTION_COPY","saveActionCopy","verb","saveState","setSaveState","saveVerb","setSaveVerb","saveRef","useRef","savedTimerRef","saveTab","setSaveTab","onDirtyChange","useCallback","dirty","prev","handleSave","success","toast","useEffect","onKeyDown","saveTransition","copy","saveControl","Button","tooltipWithHotkey","SettingsLayout"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAMA,IAAmBC,EAAO,OAAOC,EAAU,GAC3CC,IAAkB,MAClBC,IAAW,IACXC,KAAY,KACZC,KAAc,CAAC,OAAO,GAAG;AAC/B,SAASC,GAAaC,GAAO;AAC3B,SAAI,EAAEA,EAAM,WAAWA,EAAM,YAAYA,EAAM,UAAUA,EAAM,WACtD,KAEFA,EAAM,QAAQ,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;"}
|
|
1
|
+
{"version":3,"file":"SettingsLayout.js","sources":["../../src/SettingsLayout/SettingsLayout.tsx"],"sourcesContent":["import { MOTION_EASE_UI } from '@reforma/constants';\nimport { AttentionCircle } from '@reforma/icons/14';\nimport { cn } from '@reforma/lib';\nimport { AnimatePresence, motion, useReducedMotion } from 'motion/react';\nimport { createContext, use, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { Alert, AlertAction, AlertIcon, AlertTitle } from '../Alert';\nimport { Box } from '../Box';\nimport { Breadcrumb } from '../Breadcrumb';\nimport { Button } from '../Button';\nimport { For } from '../For';\nimport { tooltipWithHotkey } from '../Hotkey';\nimport { ListBox, ListBoxItem } from '../List';\nimport { ModalContext } from '../Modal/hooks/useModalProvider';\nimport { confirmDiscardChanges } from '../modals/ConfirmModal';\nimport { Scrollable } from '../Scrollable';\nimport { Show } from '../Show';\nimport { Text } from '../Text';\nimport { toast } from '../Toast';\nimport styles from './SettingsLayout.module.css';\n\nimport type { ReactNode, RefObject } from 'react';\n\nconst MotionScrollable = motion.create(Scrollable);\n\nconst PANE_DURATION_S = 0.35;\nconst SLIDE_IN = 32;\nconst SLIDE_OUT = -12;\nconst SAVE_HOTKEY = ['mod', 's'] as const;\n\nfunction isSaveHotkey(event: KeyboardEvent): boolean {\n if (!(event.metaKey || event.ctrlKey) || event.altKey || event.shiftKey) {\n return false;\n }\n\n return event.key === 's' || event.key === 'S';\n}\n\nfunction paneTransition(reducedMotion: boolean | null) {\n return { duration: reducedMotion ? 0 : PANE_DURATION_S, ease: MOTION_EASE_UI };\n}\n\nfunction tabEnterTransition(reducedMotion: boolean | null) {\n return { duration: reducedMotion ? 0 : PANE_DURATION_S, ease: 'easeOut' as const };\n}\n\nfunction layerRest(covered: boolean, reducedMotion: boolean | null) {\n return {\n opacity: covered ? 0 : 1,\n x: (covered && !reducedMotion) ? SLIDE_OUT : 0,\n y: 0,\n };\n}\n\nexport interface SettingsNavItem {\n id: string;\n label: string;\n icon?: ReactNode;\n}\n\nexport interface SettingsStackItem {\n id: string;\n label: string;\n}\n\ninterface SettingsLayoutContextValue {\n items: readonly SettingsNavItem[];\n selectedId: string;\n select: (id: string) => void;\n stack: readonly SettingsStackItem[];\n push: (item: SettingsStackItem) => void;\n rename: (id: string, label: string) => void;\n pop: () => void;\n reset: () => void;\n}\n\nconst SettingsLayoutContext = createContext<SettingsLayoutContextValue | null>(null);\nconst SettingsOverlayContext = createContext<HTMLElement | null>(null);\nconst SettingsLeaveGuardContext = createContext<RefObject<(() => boolean | Promise<boolean>) | null> | null>(null);\n\nfunction settleLeave(decision: boolean | Promise<boolean>, apply: () => void) {\n if (decision === true) {\n apply();\n\n return;\n }\n\n if (decision === false) {\n return;\n }\n\n void decision.then((allowed) => {\n if (allowed) {\n apply();\n }\n });\n}\n\nexport function useSettingsLayout(): SettingsLayoutContextValue {\n const ctx = use(SettingsLayoutContext);\n\n if (!ctx) {\n throw new Error('useSettingsLayout must be used inside SettingsLayout');\n }\n\n return ctx;\n}\n\ntype SettingsSaveCopy = {\n dirty: string;\n saving: string;\n saved: string;\n tooltip?: string;\n};\n\ntype SettingsSaveVerb = 'save' | 'add' | SettingsSaveCopy;\n\ninterface SettingsSaveContextValue {\n saveRef: RefObject<(() => Promise<boolean>) | null>;\n discardRef: RefObject<(() => void) | null>;\n onDirtyChange: (dirty: boolean) => void;\n setSaveVerb: (verb: SettingsSaveVerb) => void;\n}\n\nconst SettingsSaveContext = createContext<SettingsSaveContextValue | null>(null);\n\nexport function useSettingsSave(): SettingsSaveContextValue {\n const ctx = use(SettingsSaveContext);\n\n if (!ctx) {\n throw new Error('useSettingsSave must be used inside SettingsLayout.Content with saveable prop');\n }\n\n return ctx;\n}\n\nexport interface SettingsLayoutProps {\n items: readonly SettingsNavItem[];\n defaultSelected?: string;\n defaultStack?: readonly SettingsStackItem[];\n className?: string;\n children: ReactNode;\n}\n\nfunction SettingsLayoutRoot({\n items,\n defaultSelected,\n defaultStack,\n className,\n children,\n}: SettingsLayoutProps) {\n const [selectedId, setSelectedId] = useState(defaultSelected ?? items[0]?.id ?? '');\n const [stack, setStack] = useState<SettingsStackItem[]>(() => (\n defaultStack ? [...defaultStack] : []\n ));\n const leaveGuardRef = useRef<(() => boolean | Promise<boolean>) | null>(null);\n\n const select = (id: string) => {\n const changeTab = id !== selectedId;\n const clearStack = stack.length > 0;\n\n if (!changeTab && !clearStack) {\n return;\n }\n\n settleLeave(leaveGuardRef.current?.() ?? true, () => {\n if (changeTab) {\n setSelectedId(id);\n }\n\n setStack([]);\n });\n };\n\n const pop = () => {\n if (stack.length === 0) {\n return;\n }\n\n settleLeave(leaveGuardRef.current?.() ?? true, () => {\n setStack(current => current.slice(0, -1));\n });\n };\n\n const reset = () => {\n if (stack.length === 0) {\n return;\n }\n\n settleLeave(leaveGuardRef.current?.() ?? true, () => {\n setStack([]);\n });\n };\n\n return (\n <SettingsLeaveGuardContext value={ leaveGuardRef }>\n <SettingsLayoutContext\n value={ {\n items,\n selectedId,\n select,\n stack,\n push: item => setStack(current => [...current, item]),\n rename: (id, label) => setStack(current => current.map(item => (\n item.id === id && item.label !== label\n ? { ...item, label }\n : item\n ))),\n pop,\n reset,\n } }\n >\n <div className={ cn(styles.root, className) }>\n { children }\n </div>\n </SettingsLayoutContext>\n </SettingsLeaveGuardContext>\n );\n}\n\nexport interface SettingsLayoutSidebarProps {\n title?: string;\n className?: string;\n 'aria-label'?: string;\n footer?: ReactNode;\n}\n\nfunction Sidebar({\n title,\n className,\n 'aria-label': ariaLabel = 'Settings sections',\n footer,\n}: SettingsLayoutSidebarProps) {\n const { items, selectedId, select } = useSettingsLayout();\n\n return (\n <div className={ cn(styles.sidebar, className) }>\n <Show when={ title }>\n <Text variant=\"sm\" color=\"secondary\" className={ styles.sidebarTitle }>\n { title }\n </Text>\n </Show>\n <ListBox\n aria-label={ ariaLabel }\n size=\"md\"\n selectionMode=\"single\"\n selectedKeys={ [selectedId] }\n disallowEmptySelection\n >\n <For each={ items }>\n { item => (\n <ListBoxItem\n key={ item.id }\n id={ item.id }\n icon={ item.icon }\n textValue={ item.label }\n onPress={ () => select(item.id) }\n >\n { item.label }\n </ListBoxItem>\n ) }\n </For>\n </ListBox>\n <Show when={ footer }>\n <div className={ styles.sidebarFooter }>{ footer }</div>\n </Show>\n </div>\n );\n}\n\nfunction Title() {\n const { items, selectedId, stack, reset } = useSettingsLayout();\n const rootLabel = items.find(item => item.id === selectedId)?.label ?? '';\n\n return (\n <Breadcrumb variant=\"heading-2\" className={ styles.title }>\n { stack.length === 0\n ? (\n <Breadcrumb.Page key=\"root\">\n { rootLabel }\n </Breadcrumb.Page>\n )\n : (\n <Breadcrumb.Link key=\"root\" onPress={ reset }>\n { rootLabel }\n </Breadcrumb.Link>\n ) }\n <For each={ stack }>\n { item => (\n <Breadcrumb.Page key={ item.id }>\n { item.label }\n </Breadcrumb.Page>\n ) }\n </For>\n </Breadcrumb>\n );\n}\n\nexport interface SettingsLayoutPaneProps {\n paneKey?: string;\n className?: string;\n children: ReactNode;\n}\n\n/** Nested view over the content viewport. Previous layer stays mounted (scroll kept). */\nfunction Pane({ paneKey, className, children }: SettingsLayoutPaneProps) {\n const { stack } = useSettingsLayout();\n const overlay = use(SettingsOverlayContext);\n const reducedMotion = useReducedMotion();\n const index = paneKey ? stack.findIndex(item => item.id === paneKey) : -1;\n const covered = index >= 0 && index < stack.length - 1;\n\n if (!overlay) {\n return null;\n }\n\n return createPortal(\n <AnimatePresence initial={ false }>\n { paneKey\n ? (\n <MotionScrollable\n key={ paneKey }\n className={ cn(styles.overlay, className) }\n contentClass={ cn(styles.scrollContent, styles.paneContent) }\n initial={ reducedMotion ? false : { opacity: 0, x: SLIDE_IN } }\n animate={ layerRest(covered, reducedMotion) }\n exit={ reducedMotion ? undefined : { opacity: 0, x: SLIDE_IN, pointerEvents: 'none' } }\n transition={ paneTransition(reducedMotion) }\n inert={ covered }\n >\n { children }\n </MotionScrollable>\n )\n : null }\n </AnimatePresence>,\n overlay\n );\n}\n\nfunction Shell({\n className,\n action,\n footer,\n children,\n}: {\n className?: string;\n action?: ReactNode;\n footer?: ReactNode;\n children: ReactNode;\n}) {\n const { selectedId, stack } = useSettingsLayout();\n const [overlay, setOverlay] = useState<HTMLDivElement | null>(null);\n const reducedMotion = useReducedMotion();\n const covered = stack.length > 0;\n const animate = useMemo(\n () => layerRest(covered, reducedMotion),\n [covered, reducedMotion]\n );\n\n return (\n <SettingsOverlayContext value={ overlay }>\n <div className={ cn(styles.content, className) }>\n <div className={ styles.header }>\n <Title />\n { action }\n </div>\n <div ref={ setOverlay } className={ styles.viewport }>\n <MotionScrollable\n key={ selectedId }\n className={ styles.scroll }\n contentClass={ styles.scrollContent }\n initial={ reducedMotion ? false : { opacity: 0.6, y: 8 } }\n animate={ animate }\n transition={ covered\n ? paneTransition(reducedMotion)\n : tabEnterTransition(reducedMotion) }\n inert={ covered }\n >\n { children }\n </MotionScrollable>\n </div>\n { footer }\n </div>\n </SettingsOverlayContext>\n );\n}\n\nfunction Empty({ children }: { children: ReactNode }) {\n return (\n <Box align=\"center\" justify=\"center\" gap=\"lg\" grow fullWidth fullHeight>\n { children }\n </Box>\n );\n}\n\nexport interface SettingsLayoutContentProps {\n headerRight?: ReactNode;\n /** Pinned under the scrolling pane. */\n footer?: ReactNode;\n saveable?: boolean;\n className?: string;\n children: ReactNode;\n}\n\nfunction Content({ headerRight, footer, saveable, className, children }: SettingsLayoutContentProps) {\n if (saveable) {\n return (\n <SaveableContent headerRight={ headerRight } footer={ footer } className={ className }>\n { children }\n </SaveableContent>\n );\n }\n\n return (\n <Shell className={ className } action={ headerRight } footer={ footer }>\n { children }\n </Shell>\n );\n}\n\ntype SaveState = 'idle' | 'dirty' | 'saving' | 'saved';\n\nconst SAVED_DISPLAY_DURATION = 1000;\n\nconst ACTION_COPY = {\n save: {\n dirty: 'Save changes',\n saving: 'Saving…',\n saved: 'Saved',\n tooltip: 'Save changes',\n },\n add: {\n dirty: 'Add',\n saving: 'Adding…',\n saved: 'Added',\n tooltip: 'Add',\n },\n} as const satisfies Record<string, SettingsSaveCopy & { tooltip: string }>;\n\nfunction saveActionCopy(verb: SettingsSaveVerb): SettingsSaveCopy & { tooltip: string } {\n if (typeof verb === 'object') {\n return {\n dirty: verb.dirty,\n saving: verb.saving,\n saved: verb.saved,\n tooltip: verb.tooltip ?? verb.dirty,\n };\n }\n\n return ACTION_COPY[verb];\n}\n\nfunction saveNoticeLabel(state: SaveState, copy: SettingsSaveCopy): string {\n if (state === 'saving') {\n return copy.saving;\n }\n\n if (state === 'saved') {\n return copy.saved;\n }\n\n return 'You have unsaved changes';\n}\n\nfunction SaveNotice({\n state,\n copy,\n onSave,\n onDiscard,\n}: {\n state: Exclude<SaveState, 'idle'>;\n copy: SettingsSaveCopy & { tooltip: string };\n onSave: () => void;\n onDiscard: () => void;\n}) {\n const label = saveNoticeLabel(state, copy);\n\n return (\n <div className={ styles.saveEnter }>\n <div className={ styles.saveClip }>\n <Alert>\n <AlertIcon>\n <AttentionCircle />\n </AlertIcon>\n <AlertTitle>{ label }</AlertTitle>\n { state === 'saved'\n ? null\n : (\n <AlertAction>\n <Box direction=\"row\" align=\"center\" gap=\"sm\" wrap={ false }>\n <Button\n variant=\"filling\"\n color=\"secondary\"\n size=\"sm\"\n isDisabled={ state === 'saving' }\n onPress={ onDiscard }\n >\n Discard\n </Button>\n <Button\n color=\"primary\"\n size=\"sm\"\n isDisabled={ state === 'saving' }\n tooltip={ state === 'dirty'\n ? tooltipWithHotkey(copy.tooltip, SAVE_HOTKEY)\n : undefined }\n onPress={ onSave }\n >\n { state === 'saving' ? copy.saving : copy.dirty }\n </Button>\n </Box>\n </AlertAction>\n ) }\n </Alert>\n </div>\n </div>\n );\n}\n\nfunction SaveableContent({\n headerRight,\n footer,\n className,\n children,\n}: Omit<SettingsLayoutContentProps, 'saveable'>) {\n const { selectedId } = useSettingsLayout();\n const leaveGuardRef = use(SettingsLeaveGuardContext);\n const modal = use(ModalContext)?.modal;\n const [saveState, setSaveState] = useState<SaveState>('idle');\n const [saveVerb, setSaveVerb] = useState<SettingsSaveVerb>('save');\n const saveRef = useRef<(() => Promise<boolean>) | null>(null);\n const discardRef = useRef<(() => void) | null>(null);\n const savedTimerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const [saveTab, setSaveTab] = useState(selectedId);\n\n if (saveTab !== selectedId) {\n setSaveTab(selectedId);\n setSaveState('idle');\n setSaveVerb('save');\n }\n\n const onDirtyChange = useCallback((dirty: boolean) => {\n setSaveState((prev) => {\n if (dirty) {\n return 'dirty';\n }\n\n if (prev === 'dirty') {\n return 'idle';\n }\n\n return prev;\n });\n }, []);\n\n const handleSave = useCallback(async() => {\n if (!saveRef.current) {\n return;\n }\n\n setSaveState('saving');\n\n try {\n const success = await saveRef.current();\n\n if (success) {\n setSaveState('saved');\n }\n else {\n setSaveState('dirty');\n }\n }\n catch {\n toast.error({ message: 'Something went wrong while saving.' });\n setSaveState('dirty');\n }\n }, []);\n\n useEffect(() => {\n if (saveState !== 'dirty') {\n return;\n }\n\n // Window capture so Pane overlays (portaled) still hit ⌘S / Ctrl+S.\n const onKeyDown = (event: KeyboardEvent) => {\n if (!isSaveHotkey(event)) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n void handleSave();\n };\n\n window.addEventListener('keydown', onKeyDown, true);\n\n return () => {\n window.removeEventListener('keydown', onKeyDown, true);\n };\n }, [handleSave, saveState]);\n\n useEffect(() => {\n if (saveState === 'saved') {\n savedTimerRef.current = setTimeout(() => {\n setSaveState('idle');\n }, SAVED_DISPLAY_DURATION);\n }\n\n return () => {\n clearTimeout(savedTimerRef.current);\n };\n }, [saveState]);\n\n useEffect(() => {\n if (!modal) {\n return;\n }\n\n if (saveState === 'dirty' || saveState === 'saving') {\n modal.unsaved();\n\n return;\n }\n\n modal.saved();\n }, [modal, saveState]);\n\n useEffect(() => {\n if (!leaveGuardRef) {\n return;\n }\n\n leaveGuardRef.current = () => {\n if (saveState !== 'dirty' && saveState !== 'saving') {\n return true;\n }\n\n return confirmDiscardChanges();\n };\n\n return () => {\n leaveGuardRef.current = null;\n };\n }, [leaveGuardRef, saveState]);\n\n const ctx = useMemo<SettingsSaveContextValue>(\n () => ({ saveRef, discardRef, onDirtyChange, setSaveVerb }),\n [onDirtyChange]\n );\n\n const copy = saveActionCopy(saveVerb);\n\n return (\n <SettingsSaveContext value={ ctx }>\n <Shell\n className={ className }\n footer={ saveState === 'idle'\n ? footer\n : (\n <SaveNotice\n state={ saveState }\n copy={ copy }\n onSave={ () => void handleSave() }\n onDiscard={ () => discardRef.current?.() }\n />\n ) }\n action={ headerRight\n ? <div className={ styles.headerAction }>{ headerRight }</div>\n : undefined }\n >\n { children }\n </Shell>\n </SettingsSaveContext>\n );\n}\n\nexport const SettingsLayout = Object.assign(SettingsLayoutRoot, {\n Sidebar,\n Content,\n Pane,\n Empty,\n});\n\nSettingsLayoutRoot.displayName = 'SettingsLayout';\nSidebar.displayName = 'SettingsLayout.Sidebar';\nContent.displayName = 'SettingsLayout.Content';\nPane.displayName = 'SettingsLayout.Pane';\nEmpty.displayName = 'SettingsLayout.Empty';\n"],"names":["MotionScrollable","motion","Scrollable","PANE_DURATION_S","SLIDE_IN","SLIDE_OUT","SAVE_HOTKEY","isSaveHotkey","event","paneTransition","reducedMotion","MOTION_EASE_UI","tabEnterTransition","layerRest","covered","SettingsLayoutContext","SettingsOverlayContext","SettingsLeaveGuardContext","settleLeave","decision","apply","allowed","useSettingsLayout","ctx","use","SettingsSaveContext","useSettingsSave","SettingsLayoutRoot","items","defaultSelected","defaultStack","className","children","selectedId","setSelectedId","useState","stack","setStack","leaveGuardRef","useRef","id","changeTab","clearStack","current","item","label","cn","styles","Sidebar","title","ariaLabel","footer","select","_jsx","Show","Text","ListBox","For","ListBoxItem","Title","reset","rootLabel","Breadcrumb","Pane","paneKey","overlay","useReducedMotion","index","createPortal","AnimatePresence","Shell","action","setOverlay","animate","useMemo","_jsxs","Empty","Box","Content","headerRight","saveable","SaveableContent","SAVED_DISPLAY_DURATION","ACTION_COPY","saveActionCopy","verb","saveNoticeLabel","state","copy","SaveNotice","onSave","onDiscard","Alert","AlertIcon","AttentionCircle","AlertTitle","AlertAction","Button","tooltipWithHotkey","modal","ModalContext","saveState","setSaveState","saveVerb","setSaveVerb","saveRef","discardRef","savedTimerRef","saveTab","setSaveTab","onDirtyChange","useCallback","dirty","prev","handleSave","success","toast","useEffect","onKeyDown","confirmDiscardChanges","SettingsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,MAAMA,IAAmBC,GAAO,OAAOC,EAAU,GAC3CC,IAAkB,MAClBC,IAAW,IACXC,KAAY,KACZC,KAAc,CAAC,OAAO,GAAG;AAC/B,SAASC,GAAaC,GAAO;AAC3B,SAAI,EAAEA,EAAM,WAAWA,EAAM,YAAYA,EAAM,UAAUA,EAAM,WACtD,KAEFA,EAAM,QAAQ,OAAOA,EAAM,QAAQ;AAC5C;AACA,SAASC,EAAeC,GAAe;AACrC,SAAO;AAAA,IACL,UAAUA,IAAgB,IAAIP;AAAA,IAC9B,MAAMQ;AAAA,EAAA;AAEV;AACA,SAASC,GAAmBF,GAAe;AACzC,SAAO;AAAA,IACL,UAAUA,IAAgB,IAAIP;AAAA,IAC9B,MAAM;AAAA,EAAA;AAEV;AACA,SAASU,EAAUC,GAASJ,GAAe;AACzC,SAAO;AAAA,IACL,SAASI,IAAU,IAAI;AAAA,IACvB,GAAGA,KAAW,CAACJ,IAAgBL,KAAY;AAAA,IAC3C,GAAG;AAAA,EAAA;AAEP;AACA,MAAMU,sBAAmD,IAAI,GACvDC,sBAAoD,IAAI,GACxDC,sBAAuD,IAAI;AACjE,SAASC,EAAYC,GAAUC,GAAO;AACpC,MAAID,MAAa,IAAM;AACrB,IAAAC,EAAA;AACA;AAAA,EACF;AACA,EAAID,MAAa,MAGZA,EAAS,KAAK,CAAAE,MAAW;AAC5B,IAAIA,KACFD,EAAA;AAAA,EAEJ,CAAC;AACH;AAC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,GAAemB,CAAQ;AACpC,2BAAyB9E,GAAqB;AAAA,IAC5C,OAAOF;AAAA,IACP,4BAA4B+C,GAAO;AAAA,MACjC,WAAAvC;AAAA,MACA,QAAQsE,MAAc,SAASlD,sBAA2BsC,IAAY;AAAA,QACpE,OAAOY;AAAA,QACP,MAAAb;AAAA,QACA,QAAQ,MAAA;AAAM,UAAK0B,EAAA;AAAA;AAAA,QACnB,WAAW,MAAMR,EAAW,UAAA;AAAA,MAAU,CACvC;AAAA,MACD,QAAQ3B,IAA2B1B,gBAAAA,EAAK,OAAO;AAAA,QAC7C,WAAWN,EAAO;AAAA,QAClB,UAAUgC;AAAA,MAAA,CACX,IAAI;AAAA,MACL,UAAA/C;AAAA,IAAA,CACD;AAAA,EAAA,CACF;AACH;AACO,MAAMwF,KAAiB,OAAO,OAAO7F,GAAoB;AAAA,EAC9D,SAAAqB;AAAA,EACA,SAAA8B;AAAA,EACA,MAAAf;AAAA,EACA,OAAAa;AACF,CAAC;AACDjD,EAAmB,cAAc;AACjCqB,EAAQ,cAAc;AACtB8B,EAAQ,cAAc;AACtBf,EAAK,cAAc;AACnBa,EAAM,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.SettingsLayout_root_lBxQ4b{display:flex;padding:var(--spacing-xs);width:100%;height:100%;overflow:hidden}.SettingsLayout_sidebar_EMtPUy{display:flex;flex-direction:column;gap:var(--spacing-lg);border:1px solid var(--color-secondary-muted-border);border-radius:calc(var(--radius-lg) * var(--squircle-radius-factor));background:var(--color-surface);padding:var(--spacing-lg);width:210px;min-width:210px;corner-shape:superellipse(var(--squircle-value));overflow-y:auto}.SettingsLayout_sidebarTitle_AKclrV{padding:0 var(--spacing-lg)}.SettingsLayout_sidebarFooter_jBD19p{margin-top:auto}.SettingsLayout_content_uv3Glf{display:flex;flex:1;flex-direction:column;min-width:0;min-height:0}.SettingsLayout_header_zOdrOE{display:flex;flex-shrink:0;justify-content:space-between;align-items:center;background:var(--modal-background, var(--color-surface));padding:var(--spacing-40) var(--spacing-40) var(--spacing-20)}.SettingsLayout_viewport_xQNQD0{position:relative;flex:1;min-height:0;overflow:hidden}.SettingsLayout_scroll_qBlv4h,.SettingsLayout_overlay_GMz7It{position:absolute;inset:0}.SettingsLayout_scrollContent_nHRRrq{display:flex;flex:1;flex-direction:column;padding:var(--spacing-20) var(--spacing-40) var(--spacing-40);width:100%}.SettingsLayout_paneContent_Gozrp5{gap:var(--spacing-24)}.SettingsLayout_overlay_GMz7It{z-index:1;background:var(--modal-background, var(--color-surface))}.SettingsLayout_headerAction_jC1Js8{margin-block:-9999px}.
|
|
1
|
+
@layer components{.SettingsLayout_root_lBxQ4b{display:flex;padding:var(--spacing-xs);width:100%;height:100%;overflow:hidden}.SettingsLayout_sidebar_EMtPUy{display:flex;flex-direction:column;gap:var(--spacing-lg);border:1px solid var(--color-secondary-muted-border);border-radius:calc(var(--radius-lg) * var(--squircle-radius-factor));background:var(--color-surface);padding:var(--spacing-lg);width:210px;min-width:210px;corner-shape:superellipse(var(--squircle-value));overflow-y:auto}.SettingsLayout_sidebarTitle_AKclrV{padding:0 var(--spacing-lg)}.SettingsLayout_sidebarFooter_jBD19p{margin-top:auto}.SettingsLayout_content_uv3Glf{display:flex;flex:1;flex-direction:column;min-width:0;min-height:0}.SettingsLayout_header_zOdrOE{display:flex;flex-shrink:0;justify-content:space-between;align-items:center;background:var(--modal-background, var(--color-surface));padding:var(--spacing-40) var(--spacing-40) var(--spacing-20)}.SettingsLayout_viewport_xQNQD0{position:relative;flex:1;min-height:0;overflow:hidden}.SettingsLayout_scroll_qBlv4h,.SettingsLayout_overlay_GMz7It{position:absolute;inset:0}.SettingsLayout_scrollContent_nHRRrq{display:flex;flex:1;flex-direction:column;padding:var(--spacing-20) var(--spacing-40) var(--spacing-40);width:100%}.SettingsLayout_paneContent_Gozrp5{gap:var(--spacing-24)}.SettingsLayout_overlay_GMz7It{z-index:1;background:var(--modal-background, var(--color-surface))}.SettingsLayout_headerAction_jC1Js8{margin-block:-9999px}.SettingsLayout_saveEnter_gyqPiI{display:grid;flex-shrink:0;animation:SettingsLayout_settings-save-in_fN5oOU var(--transition-duration) var(--ease-in-out) both}.SettingsLayout_saveClip_Leqogu{padding:0 0 0 var(--spacing-xs);min-height:0;overflow:hidden}.SettingsLayout_title_toPbWC{flex:1;min-width:0}}@keyframes SettingsLayout_settings-save-in_fN5oOU{0%{grid-template-rows:0fr;opacity:0}to{grid-template-rows:1fr;opacity:1}}@media(prefers-reduced-motion:reduce){.SettingsLayout_saveEnter_gyqPiI{animation:none}}
|
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
const t = "SettingsLayout_root_lBxQ4b",
|
|
1
|
+
const t = "SettingsLayout_root_lBxQ4b", e = "SettingsLayout_sidebar_EMtPUy", o = "SettingsLayout_sidebarTitle_AKclrV", n = "SettingsLayout_sidebarFooter_jBD19p", s = "SettingsLayout_content_uv3Glf", a = "SettingsLayout_header_zOdrOE", r = "SettingsLayout_viewport_xQNQD0", i = "SettingsLayout_scroll_qBlv4h", l = "SettingsLayout_overlay_GMz7It", _ = "SettingsLayout_scrollContent_nHRRrq", c = "SettingsLayout_paneContent_Gozrp5", y = "SettingsLayout_headerAction_jC1Js8", u = "SettingsLayout_saveEnter_gyqPiI", d = "SettingsLayout_saveClip_Leqogu", g = "SettingsLayout_title_toPbWC", L = {
|
|
2
2
|
root: t,
|
|
3
|
-
sidebar:
|
|
4
|
-
sidebarTitle:
|
|
3
|
+
sidebar: e,
|
|
4
|
+
sidebarTitle: o,
|
|
5
5
|
sidebarFooter: n,
|
|
6
6
|
content: s,
|
|
7
7
|
header: a,
|
|
8
|
-
viewport:
|
|
9
|
-
scroll:
|
|
10
|
-
overlay:
|
|
8
|
+
viewport: r,
|
|
9
|
+
scroll: i,
|
|
10
|
+
overlay: l,
|
|
11
11
|
scrollContent: _,
|
|
12
|
-
paneContent:
|
|
12
|
+
paneContent: c,
|
|
13
13
|
headerAction: y,
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
saveEnter: u,
|
|
15
|
+
saveClip: d,
|
|
16
|
+
title: g
|
|
16
17
|
};
|
|
17
18
|
export {
|
|
18
19
|
s as content,
|
|
19
|
-
|
|
20
|
+
L as default,
|
|
20
21
|
a as header,
|
|
21
22
|
y as headerAction,
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
l as overlay,
|
|
24
|
+
c as paneContent,
|
|
24
25
|
t as root,
|
|
25
|
-
d as
|
|
26
|
-
|
|
26
|
+
d as saveClip,
|
|
27
|
+
u as saveEnter,
|
|
28
|
+
i as scroll,
|
|
27
29
|
_ as scrollContent,
|
|
28
|
-
|
|
30
|
+
e as sidebar,
|
|
29
31
|
n as sidebarFooter,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
o as sidebarTitle,
|
|
33
|
+
g as title,
|
|
34
|
+
r as viewport
|
|
33
35
|
};
|
|
34
36
|
//# sourceMappingURL=SettingsLayout.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsLayout.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SettingsLayout.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Attachment.d.ts","sourceRoot":"","sources":["../../../src/chat/Attachment/Attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAKpD,OAAO,EAIH,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EAEzB,MAAM,OAAO,CAAC;AAUf,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1C,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC5D,s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AAG,MAAM,CAU/D;AAED,mHAAmH;AACnH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,eAAe,+BAc3D"}
|
|
@@ -3,9 +3,9 @@ import { Text as g } from "@reforma/components/Text";
|
|
|
3
3
|
import { Close as E } from "@reforma/icons/12";
|
|
4
4
|
import { Refresh as B } from "@reforma/icons/14";
|
|
5
5
|
import { cn as l } from "@reforma/lib";
|
|
6
|
-
import { useState as F, useMemo as I, Children as
|
|
7
|
-
import { Image as
|
|
8
|
-
import { Lightbox as
|
|
6
|
+
import { useState as F, useMemo as I, Children as R } from "react";
|
|
7
|
+
import { Image as j } from "../../Image/Image.js";
|
|
8
|
+
import { Lightbox as M } from "../../Lightbox/Lightbox.js";
|
|
9
9
|
import { Show as A } from "../../Show/Show.js";
|
|
10
10
|
import { Spinner as O } from "../../Spinner/Spinner.js";
|
|
11
11
|
import { Tooltip as _ } from "../../Tooltip/Tooltip.js";
|
|
@@ -27,7 +27,7 @@ function ie({
|
|
|
27
27
|
}) {
|
|
28
28
|
const [u, w] = F(!1), c = D(o), s = I(() => {
|
|
29
29
|
const y = [];
|
|
30
|
-
return
|
|
30
|
+
return R.forEach(t, (N) => {
|
|
31
31
|
y.push(N);
|
|
32
32
|
}), y;
|
|
33
33
|
}, [t]), m = s.length, {
|
|
@@ -91,7 +91,7 @@ function S({
|
|
|
91
91
|
})
|
|
92
92
|
}) : a ? /* @__PURE__ */ p("div", {
|
|
93
93
|
className: l(i.preview, i.previewError),
|
|
94
|
-
children: [/* @__PURE__ */ n(
|
|
94
|
+
children: [/* @__PURE__ */ n(P, {
|
|
95
95
|
data: t
|
|
96
96
|
}), /* @__PURE__ */ n(f, {
|
|
97
97
|
type: "button",
|
|
@@ -105,20 +105,19 @@ function S({
|
|
|
105
105
|
onPress: c,
|
|
106
106
|
children: /* @__PURE__ */ n(B, {})
|
|
107
107
|
})]
|
|
108
|
-
}) : /* @__PURE__ */ n(
|
|
108
|
+
}) : /* @__PURE__ */ n(P, {
|
|
109
109
|
data: t
|
|
110
110
|
}), z = /* @__PURE__ */ p(k, {
|
|
111
111
|
children: [N, /* @__PURE__ */ n(A, {
|
|
112
112
|
when: u,
|
|
113
|
-
children: /* @__PURE__ */ n(
|
|
113
|
+
children: /* @__PURE__ */ n(T, {
|
|
114
114
|
data: t,
|
|
115
|
-
showMediaType: !0,
|
|
116
115
|
className: i.inlineInfo
|
|
117
116
|
})
|
|
118
117
|
})]
|
|
119
118
|
});
|
|
120
119
|
return /* @__PURE__ */ n(_, {
|
|
121
|
-
content: u ? /* @__PURE__ */ n(
|
|
120
|
+
content: u ? /* @__PURE__ */ n(T, {
|
|
122
121
|
data: t,
|
|
123
122
|
showMediaType: w
|
|
124
123
|
}) : null,
|
|
@@ -160,7 +159,6 @@ function G({
|
|
|
160
159
|
className: l(i.removeButton, r),
|
|
161
160
|
type: "button",
|
|
162
161
|
variant: "filled",
|
|
163
|
-
rounded: !0,
|
|
164
162
|
size: "unset",
|
|
165
163
|
iconOnly: !0,
|
|
166
164
|
"aria-label": e,
|
|
@@ -172,7 +170,7 @@ function G({
|
|
|
172
170
|
})
|
|
173
171
|
});
|
|
174
172
|
}
|
|
175
|
-
function
|
|
173
|
+
function P({
|
|
176
174
|
data: e,
|
|
177
175
|
className: r,
|
|
178
176
|
...t
|
|
@@ -181,7 +179,7 @@ function T({
|
|
|
181
179
|
type: a,
|
|
182
180
|
ext: d
|
|
183
181
|
} = x(e.mediaType, o ?? e.filename);
|
|
184
|
-
return a === "image" && o ? /* @__PURE__ */ n(
|
|
182
|
+
return a === "image" && o ? /* @__PURE__ */ n(j, {
|
|
185
183
|
className: l(i.preview, i.previewImg, r),
|
|
186
184
|
src: o,
|
|
187
185
|
alt: "Attachment",
|
|
@@ -195,7 +193,7 @@ function T({
|
|
|
195
193
|
})
|
|
196
194
|
});
|
|
197
195
|
}
|
|
198
|
-
function
|
|
196
|
+
function T({
|
|
199
197
|
data: e,
|
|
200
198
|
showMediaType: r = !1,
|
|
201
199
|
className: t,
|
|
@@ -233,7 +231,7 @@ function re(e) {
|
|
|
233
231
|
} = x(r.mediaType, t ?? r.filename);
|
|
234
232
|
return o !== "image" || !t ? /* @__PURE__ */ n(S, {
|
|
235
233
|
...e
|
|
236
|
-
}) : /* @__PURE__ */ n(
|
|
234
|
+
}) : /* @__PURE__ */ n(M, {
|
|
237
235
|
src: t,
|
|
238
236
|
alt: C(r),
|
|
239
237
|
children: (a) => /* @__PURE__ */ n(S, {
|
|
@@ -244,8 +242,8 @@ function re(e) {
|
|
|
244
242
|
}
|
|
245
243
|
export {
|
|
246
244
|
S as Attachment,
|
|
247
|
-
|
|
248
|
-
|
|
245
|
+
T as AttachmentInfo,
|
|
246
|
+
P as AttachmentPreview,
|
|
249
247
|
G as AttachmentRemove,
|
|
250
248
|
ie as Attachments,
|
|
251
249
|
re as PreviewableAttachment,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Attachment.js","sources":["../../../src/chat/Attachment/Attachment.tsx"],"sourcesContent":["import { Button } from '@reforma/components/Button';\nimport { Text } from '@reforma/components/Text';\nimport { Close } from '@reforma/icons/12';\nimport { Refresh } from '@reforma/icons/14';\nimport { cn } from '@reforma/lib';\nimport {\n Children,\n useMemo,\n useState,\n type ComponentProps,\n type HTMLAttributes,\n type PropsWithChildren,\n type ReactNode,\n} from 'react';\n\nimport { Image } from '../../Image';\nimport { Lightbox } from '../../Lightbox';\nimport { Show } from '../../Show';\nimport { Spinner } from '../../Spinner';\nimport { Tooltip } from '../../Tooltip';\nimport { ChipIcon, getFileKind } from '../Chip';\nimport styles from './Attachment.module.css';\n\nimport type { AttachmentData } from '@reforma/types';\n\nexport type AttachmentsSize = 'sm' | 'md';\n\nexport type AttachmentsProps = HTMLAttributes<HTMLDivElement> & {\n /** Tile edge length. @default 'md' */\n size?: AttachmentsSize;\n /**\n * Max attachments shown before a “show more” control; unset or non-positive = show all.\n * Pass each `<Attachment />` as a **direct child** (e.g. `items.map(...)`) so items can be split; a single wrapper child counts as one item.\n */\n defaultLimitCount?: number;\n /** Accessible label for the expand control. @default 'Show more' */\n showMoreLabel?: string;\n};\n\nfunction normalizeAttachmentLimit(defaultLimitCount: number | undefined): number | undefined {\n if (defaultLimitCount === undefined) {\n return undefined;\n }\n\n if (!Number.isFinite(defaultLimitCount) || defaultLimitCount <= 0) {\n return undefined;\n }\n\n return Math.floor(defaultLimitCount);\n}\n\n/** Attachment list */\nexport function Attachments({\n size = 'md',\n className,\n children,\n defaultLimitCount,\n showMoreLabel = 'Show more',\n ...props\n}: AttachmentsProps) {\n const [expanded, setExpanded] = useState(false);\n const limit = normalizeAttachmentLimit(defaultLimitCount);\n const childList = useMemo((): ReactNode[] => {\n const out: ReactNode[] = [];\n\n Children.forEach(children, (child) => {\n out.push(child);\n });\n\n return out;\n }, [children]);\n const total = childList.length;\n\n const { visibleChildren, overflowCount } = useMemo(() => {\n if (limit === undefined || expanded || total <= limit) {\n return { visibleChildren: childList, overflowCount: 0 };\n }\n\n return {\n visibleChildren: childList.slice(0, limit),\n overflowCount: total - limit,\n };\n }, [childList, expanded, limit, total]);\n\n const showExpand = overflowCount > 0;\n\n return (\n <div\n className={ cn(styles.attachments, styles.attachmentsGrid, className) }\n data-slot=\"attachments\"\n data-size={ size }\n data-single={ total === 1 || undefined }\n data-collapsed={ showExpand ? '' : undefined }\n { ...props }\n >\n {visibleChildren}\n\n <Show when={ showExpand }>\n <Button\n className={ styles.showMore }\n type=\"button\"\n variant=\"ghost\"\n size=\"unset\"\n data-slot=\"attachments-show-more\"\n tooltip={ showMoreLabel }\n tooltipPlacement=\"top\"\n aria-label={ `${ showMoreLabel } (+${ overflowCount })` }\n onPress={ () => {\n setExpanded(true);\n } }\n >\n <Text variant=\"label\" as=\"span\">\n +\n {overflowCount}\n </Text>\n </Button>\n </Show>\n </div>\n );\n}\n\ntype AttachmentPrimaryPress = NonNullable<ComponentProps<typeof Button>['onPress']>;\n\n/** Attachment item */\nexport type AttachmentProps = HTMLAttributes<HTMLDivElement> & PropsWithChildren<{\n data: AttachmentData;\n /** Spinner in place of preview; hides remove; sets `aria-busy` on the root. */\n loading?: boolean;\n /** Red border + retry control; hides remove while loading only. */\n error?: boolean;\n onRetry?: () => void;\n onRemove?: () => void;\n /**\n * When set, the main hit target is a design-system {@link Button} (transparent).\n * {@link AttachmentRemove} stays a sibling so there are no nested `<button>` elements.\n */\n onPress?: AttachmentPrimaryPress;\n showIcon?: boolean;\n showInfo?: boolean;\n /** Extra line in the hover tooltip when `showInfo` is true. */\n showMediaType?: boolean;\n}>;\n\nexport function Attachment({\n className,\n children: _children,\n data,\n loading = false,\n error = false,\n showIcon: _showIcon = true,\n showInfo = true,\n showMediaType,\n onRetry,\n onRemove,\n onPress,\n ...props\n}: AttachmentProps) {\n const isInteractive = Boolean(onPress) && !loading && !error;\n const label = getAttachmentLabel(data);\n const loadingSpinnerSize = 'xs';\n\n const previewContent = loading\n ? (\n <div className={ cn(styles.preview, styles.previewLoading) }>\n <Spinner size={ loadingSpinnerSize } />\n </div>\n )\n : error\n ? (\n <div className={ cn(styles.preview, styles.previewError) }>\n <AttachmentPreview data={ data } />\n <Button\n type=\"button\"\n variant=\"filled\"\n rounded\n size=\"unset\"\n iconOnly\n className={ styles.retryButton }\n tooltip=\"Retry upload\"\n tooltipPlacement=\"top\"\n onPress={ onRetry }\n >\n <Refresh />\n </Button>\n </div>\n )\n : (\n <AttachmentPreview data={ data } />\n );\n\n const content = (\n <>\n {previewContent}\n <Show when={ showInfo }>\n <AttachmentInfo data={ data } showMediaType className={ styles.inlineInfo } />\n </Show>\n </>\n );\n\n return (\n <Tooltip content={\n showInfo ? <AttachmentInfo data={ data } showMediaType={ showMediaType } /> : null\n }\n >\n <div\n className={ cn(\n styles.attachment,\n isInteractive && styles.pressable,\n error && styles.attachmentError,\n className\n ) }\n data-slot=\"attachment\"\n data-attachment-id={ data.id ?? data.filename }\n data-interactive={ isInteractive || undefined }\n aria-busy={ loading || undefined }\n data-loading={ loading || undefined }\n data-error={ error || undefined }\n { ...props }\n >\n {isInteractive\n ? (\n <Button\n type=\"button\"\n variant=\"transparent\"\n color=\"inherit\"\n size=\"unset\"\n fullWidth\n className={ styles.attachmentHit }\n aria-label={ label }\n onPress={ onPress }\n >\n {content}\n </Button>\n )\n : (\n content\n )}\n\n <Show when={ onRemove && !loading }>\n <AttachmentRemove className={ styles.remove } onPress={ onRemove } />\n </Show>\n </div>\n </Tooltip>\n );\n}\n\n\n/** Attachment remove button */\nexport type AttachmentRemoveProps = ComponentProps<typeof Button> & {\n label?: string;\n};\n\nexport function AttachmentRemove({ label = 'Remove', className, ...props }: AttachmentRemoveProps) {\n return (\n <Button\n className={ cn(styles.removeButton, className) }\n type=\"button\"\n variant=\"filled\"\n rounded\n size=\"unset\"\n iconOnly\n aria-label={ label }\n tooltip={ label }\n tooltipPlacement=\"top\"\n { ...props }\n >\n <Close size=\"auto\" />\n </Button>\n );\n}\n\n/** Attachment preview media (image) */\nexport type AttachmentPreviewMediaProps = HTMLAttributes<HTMLImageElement> & {\n data: AttachmentData;\n};\n\nexport function AttachmentPreview({ data, className, ...props }: AttachmentPreviewMediaProps) {\n const previewSrc = data.preview ?? data.url;\n const { type, ext } = getFileKind(data.mediaType, previewSrc ?? data.filename);\n\n if (type === 'image' && previewSrc) {\n return (\n <Image\n className={ cn(styles.preview, styles.previewImg, className) }\n src={ previewSrc }\n alt=\"Attachment\"\n { ...props }\n />\n );\n }\n\n return (\n <div className={ cn(styles.preview, styles.previewIcon, className) } { ...props }>\n {/* Show generic icon or more specific extension icon as fallback */}\n <ChipIcon type={ type } fallback={ ext } />\n </div>\n );\n}\n\n/** Attachment metadata (name, type) */\nexport type AttachmentInfoProps = HTMLAttributes<HTMLDivElement> & {\n data: AttachmentData;\n showMediaType?: boolean;\n};\n\nexport function AttachmentInfo({ data, showMediaType = false, className, ...props }: AttachmentInfoProps) {\n const label = data.filename ?? data.url ?? 'Attachment';\n\n return (\n <div className={ cn(styles.attachmentInfo, className) } data-slot=\"attachment-info\" { ...props }>\n <Text variant=\"label\" truncate className={ styles.attachmentName }>\n {label}\n </Text>\n\n {(showMediaType && data.mediaType)\n ? (\n <Text variant=\"label\" className={ styles.attachmentType }>\n {data.mediaType}\n </Text>\n )\n : null}\n </div>\n );\n}\n\nexport function getAttachmentLabel(data: AttachmentData): string {\n const { type } = getFileKind(data.mediaType, data.preview ?? data.url ?? data.filename);\n\n let label = data.title || data.filename;\n\n if (!label) {\n label = type === 'image' ? 'Image' : type === 'document' ? 'Document' : 'Attachment';\n }\n\n return label;\n}\n\n/** Image attachment with URL: wraps {@link Attachment} in {@link Lightbox}; otherwise plain {@link Attachment}. */\nexport function PreviewableAttachment(props: AttachmentProps) {\n const { data } = props;\n const previewSrc = data.preview ?? data.url;\n const { type } = getFileKind(data.mediaType, previewSrc ?? data.filename);\n\n if (type !== 'image' || !previewSrc) {\n return <Attachment { ...props } />;\n }\n\n return (\n <Lightbox src={ previewSrc } alt={ getAttachmentLabel(data) }>\n {open => <Attachment { ...props } onPress={ open } />}\n </Lightbox>\n );\n}\n"],"names":["normalizeAttachmentLimit","defaultLimitCount","Attachments","size","className","children","showMoreLabel","props","expanded","setExpanded","useState","limit","childList","useMemo","out","Children","child","total","visibleChildren","overflowCount","showExpand","cn","styles","_jsx","Show","Button","Text","Attachment","_children","data","loading","error","_showIcon","showInfo","showMediaType","onRetry","onRemove","onPress","isInteractive","label","getAttachmentLabel","previewContent","Spinner","_jsxs","AttachmentPreview","Refresh","content","_Fragment","AttachmentInfo","Tooltip","AttachmentRemove","Close","previewSrc","type","ext","getFileKind","Image","ChipIcon","PreviewableAttachment","Lightbox","open"],"mappings":";;;;;;;;;;;;;;;AAcA,SAASA,EAAyBC,GAAmB;AACnD,MAAIA,MAAsB,UAGtB,GAAC,OAAO,SAASA,CAAiB,KAAKA,KAAqB;AAGhE,WAAO,KAAK,MAAMA,CAAiB;AACrC;AAGO,SAASC,GAAY;AAAA,EAC1B,MAAAC,IAAO;AAAA,EACP,WAAAC;AAAA,E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b,GAAGG;AAAA,IACH,UAAU,CAAcgB,gBAAAA,EAAKG,GAAM;AAAA,MACjC,SAAS;AAAA,MACT,UAAU;AAAA,MACV,WAAWJ,EAAO;AAAA,MAClB,UAAUiB;AAAA,IAAA,CACX,GAAGL,KAAiBL,EAAK,8BAA8BH,GAAM;AAAA,MAC5D,SAAS;AAAA,MACT,WAAWJ,EAAO;AAAA,MAClB,UAAUO,EAAK;AAAA,IAAA,CAChB,IAAI,IAAI;AAAA,EAAA,CACV;AACH;AACO,SAASW,EAAmBX,GAAM;AACvC,QAAM;AAAA,IACJ,MAAAwB;AAAA,EAAA,IACEE,EAAY1B,EAAK,WAAWA,EAAK,WAAWA,EAAK,OAAOA,EAAK,QAAQ;AACzE,MAAIU,IAAQV,EAAK,SAASA,EAAK;AAC/B,SAAKU,MACHA,IAAQc,MAAS,UAAU,UAAUA,MAAS,aAAa,aAAa,eAEnEd;AACT;AAGO,SAASmB,GAAsBnD,GAAO;AAC3C,QAAM;AAAA,IACJ,MAAAsB;AAAA,EAAA,IACEtB,GACE6C,IAAavB,EAAK,WAAWA,EAAK,KAClC;AAAA,IACJ,MAAAwB;AAAA,EAAA,IACEE,EAAY1B,EAAK,WAAWuB,KAAcvB,EAAK,QAAQ;AAC3D,SAAIwB,MAAS,WAAW,CAACD,sBACEzB,GAAY;AAAA,IACnC,GAAGpB;AAAA,EAAA,CACJ,sBAEsBoD,GAAU;AAAA,IACjC,KAAKP;AAAA,IACL,KAAKZ,EAAmBX,CAAI;AAAA,IAC5B,UAAU,CAAA+B,MAAqBrC,gBAAAA,EAAKI,GAAY;AAAA,MAC9C,GAAGpB;AAAA,MACH,SAASqD;AAAA,IAAA,CACV;AAAA,EAAA,CACF;AACH;"}
|
|
1
|
+
{"version":3,"file":"Attachment.js","sources":["../../../src/chat/Attachment/Attachment.tsx"],"sourcesContent":["import { Button } from '@reforma/components/Button';\nimport { Text } from '@reforma/components/Text';\nimport { Close } from '@reforma/icons/12';\nimport { Refresh } from '@reforma/icons/14';\nimport { cn } from '@reforma/lib';\nimport {\n Children,\n useMemo,\n useState,\n type ComponentProps,\n type HTMLAttributes,\n type PropsWithChildren,\n type ReactNode,\n} from 'react';\n\nimport { Image } from '../../Image';\nimport { Lightbox } from '../../Lightbox';\nimport { Show } from '../../Show';\nimport { Spinner } from '../../Spinner';\nimport { Tooltip } from '../../Tooltip';\nimport { ChipIcon, getFileKind } from '../Chip';\nimport styles from './Attachment.module.css';\n\nimport type { AttachmentData } from '@reforma/types';\n\nexport type AttachmentsSize = 'sm' | 'md';\n\nexport type AttachmentsProps = HTMLAttributes<HTMLDivElement> & {\n /** Tile edge length. @default 'md' */\n size?: AttachmentsSize;\n /**\n * Max attachments shown before a “show more” control; unset or non-positive = show all.\n * Pass each `<Attachment />` as a **direct child** (e.g. `items.map(...)`) so items can be split; a single wrapper child counts as one item.\n */\n defaultLimitCount?: number;\n /** Accessible label for the expand control. @default 'Show more' */\n showMoreLabel?: string;\n};\n\nfunction normalizeAttachmentLimit(defaultLimitCount: number | undefined): number | undefined {\n if (defaultLimitCount === undefined) {\n return undefined;\n }\n\n if (!Number.isFinite(defaultLimitCount) || defaultLimitCount <= 0) {\n return undefined;\n }\n\n return Math.floor(defaultLimitCount);\n}\n\n/** Attachment list */\nexport function Attachments({\n size = 'md',\n className,\n children,\n defaultLimitCount,\n showMoreLabel = 'Show more',\n ...props\n}: AttachmentsProps) {\n const [expanded, setExpanded] = useState(false);\n const limit = normalizeAttachmentLimit(defaultLimitCount);\n const childList = useMemo((): ReactNode[] => {\n const out: ReactNode[] = [];\n\n Children.forEach(children, (child) => {\n out.push(child);\n });\n\n return out;\n }, [children]);\n const total = childList.length;\n\n const { visibleChildren, overflowCount } = useMemo(() => {\n if (limit === undefined || expanded || total <= limit) {\n return { visibleChildren: childList, overflowCount: 0 };\n }\n\n return {\n visibleChildren: childList.slice(0, limit),\n overflowCount: total - limit,\n };\n }, [childList, expanded, limit, total]);\n\n const showExpand = overflowCount > 0;\n\n return (\n <div\n className={ cn(styles.attachments, styles.attachmentsGrid, className) }\n data-slot=\"attachments\"\n data-size={ size }\n data-single={ total === 1 || undefined }\n data-collapsed={ showExpand ? '' : undefined }\n { ...props }\n >\n {visibleChildren}\n\n <Show when={ showExpand }>\n <Button\n className={ styles.showMore }\n type=\"button\"\n variant=\"ghost\"\n size=\"unset\"\n data-slot=\"attachments-show-more\"\n tooltip={ showMoreLabel }\n tooltipPlacement=\"top\"\n aria-label={ `${ showMoreLabel } (+${ overflowCount })` }\n onPress={ () => {\n setExpanded(true);\n } }\n >\n <Text variant=\"label\" as=\"span\">\n +\n {overflowCount}\n </Text>\n </Button>\n </Show>\n </div>\n );\n}\n\ntype AttachmentPrimaryPress = NonNullable<ComponentProps<typeof Button>['onPress']>;\n\n/** Attachment item */\nexport type AttachmentProps = HTMLAttributes<HTMLDivElement> & PropsWithChildren<{\n data: AttachmentData;\n /** Spinner in place of preview; hides remove; sets `aria-busy` on the root. */\n loading?: boolean;\n /** Red border + retry control; hides remove while loading only. */\n error?: boolean;\n onRetry?: () => void;\n onRemove?: () => void;\n /**\n * When set, the main hit target is a design-system {@link Button} (transparent).\n * {@link AttachmentRemove} stays a sibling so there are no nested `<button>` elements.\n */\n onPress?: AttachmentPrimaryPress;\n showIcon?: boolean;\n showInfo?: boolean;\n /** Extra line in the hover tooltip when `showInfo` is true. */\n showMediaType?: boolean;\n}>;\n\nexport function Attachment({\n className,\n children: _children,\n data,\n loading = false,\n error = false,\n showIcon: _showIcon = true,\n showInfo = true,\n showMediaType,\n onRetry,\n onRemove,\n onPress,\n ...props\n}: AttachmentProps) {\n const isInteractive = Boolean(onPress) && !loading && !error;\n const label = getAttachmentLabel(data);\n const loadingSpinnerSize = 'xs';\n\n const previewContent = loading\n ? (\n <div className={ cn(styles.preview, styles.previewLoading) }>\n <Spinner size={ loadingSpinnerSize } />\n </div>\n )\n : error\n ? (\n <div className={ cn(styles.preview, styles.previewError) }>\n <AttachmentPreview data={ data } />\n <Button\n type=\"button\"\n variant=\"filled\"\n rounded\n size=\"unset\"\n iconOnly\n className={ styles.retryButton }\n tooltip=\"Retry upload\"\n tooltipPlacement=\"top\"\n onPress={ onRetry }\n >\n <Refresh />\n </Button>\n </div>\n )\n : (\n <AttachmentPreview data={ data } />\n );\n\n const content = (\n <>\n {previewContent}\n <Show when={ showInfo }>\n <AttachmentInfo data={ data } className={ styles.inlineInfo } />\n </Show>\n </>\n );\n\n return (\n <Tooltip content={\n showInfo ? <AttachmentInfo data={ data } showMediaType={ showMediaType } /> : null\n }\n >\n <div\n className={ cn(\n styles.attachment,\n isInteractive && styles.pressable,\n error && styles.attachmentError,\n className\n ) }\n data-slot=\"attachment\"\n data-attachment-id={ data.id ?? data.filename }\n data-interactive={ isInteractive || undefined }\n aria-busy={ loading || undefined }\n data-loading={ loading || undefined }\n data-error={ error || undefined }\n { ...props }\n >\n {isInteractive\n ? (\n <Button\n type=\"button\"\n variant=\"transparent\"\n color=\"inherit\"\n size=\"unset\"\n fullWidth\n className={ styles.attachmentHit }\n aria-label={ label }\n onPress={ onPress }\n >\n {content}\n </Button>\n )\n : (\n content\n )}\n\n <Show when={ onRemove && !loading }>\n <AttachmentRemove className={ styles.remove } onPress={ onRemove } />\n </Show>\n </div>\n </Tooltip>\n );\n}\n\n\n/** Attachment remove button */\nexport type AttachmentRemoveProps = ComponentProps<typeof Button> & {\n label?: string;\n};\n\nexport function AttachmentRemove({ label = 'Remove', className, ...props }: AttachmentRemoveProps) {\n return (\n <Button\n className={ cn(styles.removeButton, className) }\n type=\"button\"\n variant=\"filled\"\n size=\"unset\"\n iconOnly\n aria-label={ label }\n tooltip={ label }\n tooltipPlacement=\"top\"\n { ...props }\n >\n <Close size=\"auto\" />\n </Button>\n );\n}\n\n/** Attachment preview media (image) */\nexport type AttachmentPreviewMediaProps = HTMLAttributes<HTMLImageElement> & {\n data: AttachmentData;\n};\n\nexport function AttachmentPreview({ data, className, ...props }: AttachmentPreviewMediaProps) {\n const previewSrc = data.preview ?? data.url;\n const { type, ext } = getFileKind(data.mediaType, previewSrc ?? data.filename);\n\n if (type === 'image' && previewSrc) {\n return (\n <Image\n className={ cn(styles.preview, styles.previewImg, className) }\n src={ previewSrc }\n alt=\"Attachment\"\n { ...props }\n />\n );\n }\n\n return (\n <div className={ cn(styles.preview, styles.previewIcon, className) } { ...props }>\n {/* Show generic icon or more specific extension icon as fallback */}\n <ChipIcon type={ type } fallback={ ext } />\n </div>\n );\n}\n\n/** Attachment metadata (name, type) */\nexport type AttachmentInfoProps = HTMLAttributes<HTMLDivElement> & {\n data: AttachmentData;\n showMediaType?: boolean;\n};\n\nexport function AttachmentInfo({ data, showMediaType = false, className, ...props }: AttachmentInfoProps) {\n const label = data.filename ?? data.url ?? 'Attachment';\n\n return (\n <div className={ cn(styles.attachmentInfo, className) } data-slot=\"attachment-info\" { ...props }>\n <Text variant=\"label\" truncate className={ styles.attachmentName }>\n {label}\n </Text>\n\n {(showMediaType && data.mediaType)\n ? (\n <Text variant=\"label\" className={ styles.attachmentType }>\n {data.mediaType}\n </Text>\n )\n : null}\n </div>\n );\n}\n\nexport function getAttachmentLabel(data: AttachmentData): string {\n const { type } = getFileKind(data.mediaType, data.preview ?? data.url ?? data.filename);\n\n let label = data.title || data.filename;\n\n if (!label) {\n label = type === 'image' ? 'Image' : type === 'document' ? 'Document' : 'Attachment';\n }\n\n return label;\n}\n\n/** Image attachment with URL: wraps {@link Attachment} in {@link Lightbox}; otherwise plain {@link Attachment}. */\nexport function PreviewableAttachment(props: AttachmentProps) {\n const { data } = props;\n const previewSrc = data.preview ?? data.url;\n const { type } = getFileKind(data.mediaType, previewSrc ?? data.filename);\n\n if (type !== 'image' || !previewSrc) {\n return <Attachment { ...props } />;\n }\n\n return (\n <Lightbox src={ previewSrc } alt={ getAttachmentLabel(data) }>\n {open => <Attachment { ...props } onPress={ open } />}\n </Lightbox>\n );\n}\n"],"names":["normalizeAttachmentLimit","defaultLimitCount","Attachments","size","className","children","showMoreLabel","props","expanded","setExpanded","useState","limit","childList","useMemo","out","Children","child","total","visibleChildren","overflowCount","showExpand","cn","styles","_jsx","Show","Button","Text","Attachment","_children","data","loading","error","_showIcon","showInfo","showMediaType","onRetry","onRemove","onPress","isInteractive","label","getAttachmentLabel","previewContent","Spinner","_jsxs","AttachmentPreview","Refresh","content","_Fragment","AttachmentInfo","Tooltip","AttachmentRemove","Close","previewSrc","type","ext","getFileKind","Image","ChipIcon","PreviewableAttachment","Lightbox","open"],"mappings":";;;;;;;;;;;;;;;AAcA,SAASA,EAAyBC,GAAmB;AACnD,MAAIA,MAAsB,UAGtB,GAAC,OAAO,SAASA,CAAiB,KAAKA,KAAqB;AAGhE,WAAO,KAAK,MAAMA,CAAiB;AACrC;AAGO,SAASC,GAAY;AAAA,EAC1B,MAAAC,IAAO;AAAA,EACP,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,mBAAAJ;AAAA,EACA,eAAAK,IAAgB;AAAA,EAChB,GAAGC;AACL,GAAG;AACD,QAAM,CAACC,GAAUC,CAAW,IAAIC,EAAS,EAAK,GACxCC,IAAQX,EAAyBC,CAAiB,GAClDW,IAAYC,EAAQ,MAAM;AAC9B,UAAMC,IAAM,CAAA;AACZ,WAAAC,EAAS,QAAQV,GAAU,CAAAW,MAAS;AAClC,MAAAF,EAAI,KAAKE,CAAK;AAAA,IAChB,CAAC,GACMF;AAAA,EACT,GAAG,CAACT,CAAQ,CAAC,GACPY,IAAQL,EAAU,QAClB;AAAA,IACJ,iBAAAM;AAAA,IACA,eAAAC;AAAA,EAAA,IACEN,EAAQ,MACNF,MAAU,UAAaH,KAAYS,KAASN,IACvC;AAAA,IACL,iBAAiBC;AAAA,IACjB,eAAe;AAAA,EAAA,IAGZ;AAAA,IACL,iBAAiBA,EAAU,MAAM,GAAGD,CAAK;AAAA,IACzC,eAAeM,IAAQN;AAAA,EAAA,GAExB,CAACC,GAAWJ,GAAUG,GAAOM,CAAK,CAAC,GAChCG,IAAaD,IAAgB;AACnC,2BAA0B,OAAO;AAAA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B,EAAK,QAAQ;AAC3D,SAAIwB,MAAS,WAAW,CAACD,sBACEzB,GAAY;AAAA,IACnC,GAAGpB;AAAA,EAAA,CACJ,sBAEsBoD,GAAU;AAAA,IACjC,KAAKP;AAAA,IACL,KAAKZ,EAAmBX,CAAI;AAAA,IAC5B,UAAU,CAAA+B,MAAqBrC,gBAAAA,EAAKI,GAAY;AAAA,MAC9C,GAAGpB;AAAA,MACH,SAASqD;AAAA,IAAA,CACV;AAAA,EAAA,CACF;AACH;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.Attachment_attachments_Vn5j2A{--attachment-radius: var(--radius-sm);--attachment-background: var(--color-background);--attachment-text: var(--color-text);--attachment-border: var(--color-secondary-muted-border);--attachment-background-hover: color-mix(in srgb, var(--color-text) 6%, var(--attachment-background));--attachment-text-hover: var(--attachment-text);--attachment-border-hover: var(--color-secondary-muted-border-hover);display:flex;gap:var(--spacing-xs)}.Attachment_attachment_Uvuz9g{position:relative;outline:1px solid var(--attachment-border);outline-offset:-1px;border-radius:calc(var(--attachment-radius) * var(--squircle-radius-factor));background-color:var(--attachment-background);color:var(--attachment-text);corner-shape:superellipse(var(--squircle-value));overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none;font-weight:400;font-size:var(--text-sm);line-height:var(--leading-sm);font-family:Onest,sans-serif;letter-spacing:0}@media(hover:hover){.Attachment_attachment_Uvuz9g.Attachment_pressable_hG0jBA{transition:background-color .15s ease,color .15s ease,outline-color .15s ease}.Attachment_attachment_Uvuz9g.Attachment_pressable_hG0jBA:hover{outline-color:var(--attachment-border-hover);background-color:var(--attachment-background-hover);color:var(--attachment-text-hover)}}.Attachment_attachmentHit_iDUl6i{box-sizing:border-box;margin:0;border-radius:inherit;corner-shape:inherit;align-self:stretch}.Attachment_preview_VgvjVv{display:flex;justify-content:center;align-items:center;aspect-ratio:1/1;min-width:0;min-height:0;overflow:hidden}.Attachment_previewImg_OabBWX{border-radius:calc(var(--attachment-radius) * var(--squircle-radius-factor));corner-shape:superellipse(var(--squircle-value));width:100%;height:100%;-o-object-fit:cover;object-fit:cover;-o-object-position:center;background:linear-gradient(45deg,rgba(42,37,33,.1) 25%,transparent 25%),linear-gradient(-45deg,rgba(42,37,33,.1) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,rgba(42,37,33,.1) 75%),linear-gradient(-45deg,transparent 75%,rgba(42,37,33,.1) 75%);background-position:0 0,0 8px,8px -8px,-8px 0;background-size:16px 16px;background-color:var(--color-secondary);object-position:center}.Attachment_previewIcon_k7tYnR{opacity:.5}.Attachment_previewLoading_93gSQR{flex-shrink:0}.Attachment_attachmentError_2F527r{outline-color:var(--color-danger)}.Attachment_previewError_gTp9Hy{position:relative;width:100%;height:100%}.Attachment_previewError_gTp9Hy .Attachment_previewImg_OabBWX,.Attachment_previewError_gTp9Hy .Attachment_previewIcon_k7tYnR{opacity:.45}.Attachment_retryButton_fovjBN{position:absolute;z-index:1;margin:auto;inset:0;width:22px;height:22px}.Attachment_attachmentInfo_DoK0EU{display:flex;flex-direction:column}.Attachment_attachmentType_I9oxeD{opacity:.5}.Attachment_inlineInfo_BJFA3Z{display:none;flex:1;min-width:0}.
|
|
1
|
+
@layer components{.Attachment_attachments_Vn5j2A{--attachment-radius: var(--radius-sm);--attachment-background: var(--color-background);--attachment-text: var(--color-text);--attachment-border: var(--color-secondary-muted-border);--attachment-background-hover: color-mix(in srgb, var(--color-text) 6%, var(--attachment-background));--attachment-text-hover: var(--attachment-text);--attachment-border-hover: var(--color-secondary-muted-border-hover);display:flex;gap:var(--spacing-xs)}.Attachment_attachment_Uvuz9g{position:relative;outline:1px solid var(--attachment-border);outline-offset:-1px;border-radius:calc(var(--attachment-radius) * var(--squircle-radius-factor));background-color:var(--attachment-background);color:var(--attachment-text);corner-shape:superellipse(var(--squircle-value));overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-user-drag:none;font-weight:400;font-size:var(--text-sm);line-height:var(--leading-sm);font-family:Onest,sans-serif;letter-spacing:0}@media(hover:hover){.Attachment_attachment_Uvuz9g.Attachment_pressable_hG0jBA{transition:background-color .15s ease,color .15s ease,outline-color .15s ease}.Attachment_attachment_Uvuz9g.Attachment_pressable_hG0jBA:hover{outline-color:var(--attachment-border-hover);background-color:var(--attachment-background-hover);color:var(--attachment-text-hover)}}.Attachment_attachmentHit_iDUl6i{box-sizing:border-box;margin:0;border-radius:inherit;corner-shape:inherit;align-self:stretch}.Attachment_preview_VgvjVv{display:flex;justify-content:center;align-items:center;aspect-ratio:1/1;min-width:0;min-height:0;overflow:hidden}.Attachment_previewImg_OabBWX{border-radius:calc(var(--attachment-radius) * var(--squircle-radius-factor));corner-shape:superellipse(var(--squircle-value));width:100%;height:100%;-o-object-fit:cover;object-fit:cover;-o-object-position:center;background:linear-gradient(45deg,rgba(42,37,33,.1) 25%,transparent 25%),linear-gradient(-45deg,rgba(42,37,33,.1) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,rgba(42,37,33,.1) 75%),linear-gradient(-45deg,transparent 75%,rgba(42,37,33,.1) 75%);background-position:0 0,0 8px,8px -8px,-8px 0;background-size:16px 16px;background-color:var(--color-secondary);object-position:center}.Attachment_previewIcon_k7tYnR{opacity:.5}.Attachment_previewLoading_93gSQR{flex-shrink:0}.Attachment_attachmentError_2F527r{outline-color:var(--color-danger)}.Attachment_previewError_gTp9Hy{position:relative;width:100%;height:100%}.Attachment_previewError_gTp9Hy .Attachment_previewImg_OabBWX,.Attachment_previewError_gTp9Hy .Attachment_previewIcon_k7tYnR{opacity:.45}.Attachment_retryButton_fovjBN{position:absolute;z-index:1;margin:auto;inset:0;width:22px;height:22px}.Attachment_attachmentInfo_DoK0EU{display:flex;flex-direction:column}.Attachment_attachmentType_I9oxeD{opacity:.5}.Attachment_inlineInfo_BJFA3Z{display:none;flex:1;min-width:0}.Attachment_showMore_CSqv6s{flex-shrink:0;border-radius:calc(var(--attachment-radius) * var(--squircle-radius-factor));padding:var(--spacing-4) var(--spacing-6);corner-shape:superellipse(var(--squircle-value));align-self:stretch;min-width:34px}.Attachment_attachmentsGrid_BybUno{flex-wrap:wrap;--attachment-size: 60px;--attachment-width: var(--spacing-224);--attachment-remove-offset: 4px;--attachment-remove-size: 18px;--attachment-remove-icon-size: 8px;--attachment-radius: var(--radius-lg)}.Attachment_attachmentsGrid_BybUno[data-size=sm]{--attachment-size: 36px;--attachment-width: var(--spacing-192);--attachment-remove-offset: 2px;--attachment-remove-size: 14px;--attachment-remove-icon-size: 8px;--attachment-radius: var(--radius-sm)}.Attachment_attachmentsGrid_BybUno .Attachment_attachment_Uvuz9g{width:var(--attachment-size);height:var(--attachment-size)}.Attachment_attachmentsGrid_BybUno .Attachment_attachmentHit_iDUl6i{display:flex;justify-content:center;align-items:center;padding:0;width:100%;min-width:0;height:100%;min-height:0}.Attachment_attachmentsGrid_BybUno .Attachment_removeButton_9bgTC7{position:absolute;top:var(--attachment-remove-offset);right:var(--attachment-remove-offset);width:var(--attachment-remove-size);height:var(--attachment-remove-size);--reforma-button-radius: var(--radius-xs);visibility:hidden;opacity:0;transition:opacity .2s ease,visibility .2s ease}:is(.Attachment_attachmentsGrid_BybUno .Attachment_removeButton_9bgTC7) svg{width:var(--attachment-remove-icon-size);height:var(--attachment-remove-icon-size)}.Attachment_attachmentsGrid_BybUno .Attachment_attachment_Uvuz9g:hover .Attachment_removeButton_9bgTC7{visibility:visible;opacity:1}.Attachment_attachmentsGrid_BybUno .Attachment_showMore_CSqv6s{min-width:34px;height:var(--attachment-size)}.Attachment_attachmentsGrid_BybUno[data-single] .Attachment_attachment_Uvuz9g:has(.Attachment_inlineInfo_BJFA3Z){display:flex;align-items:center;gap:var(--spacing-md);box-sizing:border-box;width:var(--attachment-width);min-width:0;max-width:100%}:is(.Attachment_attachmentsGrid_BybUno[data-single] .Attachment_attachment_Uvuz9g:has(.Attachment_inlineInfo_BJFA3Z)):not(.Attachment_pressable_hG0jBA),:is(.Attachment_attachmentsGrid_BybUno[data-single] .Attachment_attachment_Uvuz9g:has(.Attachment_inlineInfo_BJFA3Z)) .Attachment_attachmentHit_iDUl6i{padding:var(--spacing-sm)}:is(.Attachment_attachmentsGrid_BybUno[data-single] .Attachment_attachment_Uvuz9g:has(.Attachment_inlineInfo_BJFA3Z)) .Attachment_attachmentHit_iDUl6i{justify-content:flex-start;gap:var(--spacing-md);text-align:left}:is(.Attachment_attachmentsGrid_BybUno[data-single] .Attachment_attachment_Uvuz9g:has(.Attachment_inlineInfo_BJFA3Z)) .Attachment_preview_VgvjVv{flex-shrink:0;width:calc(var(--attachment-size) - var(--spacing-sm) * 2);height:calc(var(--attachment-size) - var(--spacing-sm) * 2)}:is(.Attachment_attachmentsGrid_BybUno[data-single] .Attachment_attachment_Uvuz9g:has(.Attachment_inlineInfo_BJFA3Z)) .Attachment_inlineInfo_BJFA3Z{display:flex}:is(.Attachment_attachmentsGrid_BybUno[data-single] .Attachment_attachment_Uvuz9g:has(.Attachment_inlineInfo_BJFA3Z)) .Attachment_removeButton_9bgTC7{position:static;flex-shrink:0;visibility:visible;opacity:1;margin-inline-end:var(--spacing-sm);width:var(--spacing-24);height:var(--spacing-24);--reforma-button-radius: var(--radius-sm);--reforma-button-bg: transparent;--reforma-button-color: var(--color-text);--reforma-button-bg--hover: var(--color-secondary-muted-light);--reforma-button-color--hover: var(--color-text)}:is(:is(.Attachment_attachmentsGrid_BybUno[data-single] .Attachment_attachment_Uvuz9g:has(.Attachment_inlineInfo_BJFA3Z)) .Attachment_removeButton_9bgTC7) svg{width:var(--spacing-12);height:var(--spacing-12)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tool.d.ts","sourceRoot":"","sources":["../../../src/chat/Tool/Tool.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Tool.d.ts","sourceRoot":"","sources":["../../../src/chat/Tool/Tool.tsx"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAqDjD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,GAAG,MAAM,CAexE;AAgBD,qGAAqG;AACrG,wBAAgB,IAAI,CAAC,EACjB,IAAI,EACJ,sBAAsB,EACtB,YAAY,EACZ,UAAU,GACb,EAAE,iBAAiB,sCAoBnB"}
|