@tryghost/shade 0.1.0-alpha.4 → 0.1.0-alpha.41
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 +31 -65
- package/es/assets/images/index.js +2 -2
- package/es/components/page-templates/list-page.js +2 -1
- package/es/components/page-templates/list-page.js.map +1 -1
- package/es/components/patterns/filter-bar.js +4 -6
- package/es/components/patterns/filter-bar.js.map +1 -1
- package/es/components/patterns/filters.js +35 -22
- package/es/components/patterns/filters.js.map +1 -1
- package/es/components/patterns/gh-chart.js +6 -3
- package/es/components/patterns/gh-chart.js.map +1 -1
- package/es/components/patterns/image-upload.js +20 -15
- package/es/components/patterns/image-upload.js.map +1 -1
- package/es/components/patterns/kpi-tabs.js +4 -1
- package/es/components/patterns/kpi-tabs.js.map +1 -1
- package/es/components/patterns/page-header.js +20 -44
- package/es/components/patterns/page-header.js.map +1 -1
- package/es/components/patterns/setting-group-variants.js +1 -1
- package/es/components/patterns/setting-group-variants.js.map +1 -1
- package/es/components/patterns/setting-group.js +2 -2
- package/es/components/patterns/setting-group.js.map +1 -1
- package/es/components/patterns/settings-modal-variants.js +3 -0
- package/es/components/patterns/settings-modal-variants.js.map +1 -1
- package/es/components/patterns/settings-modal.js +9 -2
- package/es/components/patterns/settings-modal.js.map +1 -1
- package/es/components/patterns/share-modal.js +5 -17
- package/es/components/patterns/share-modal.js.map +1 -1
- package/es/components/ui/alert-dialog.js +5 -7
- package/es/components/ui/alert-dialog.js.map +1 -1
- package/es/components/ui/avatar.js +8 -4
- package/es/components/ui/avatar.js.map +1 -1
- package/es/components/ui/badge-variants.js +2 -1
- package/es/components/ui/badge-variants.js.map +1 -1
- package/es/components/ui/banner-variants.js +13 -5
- package/es/components/ui/banner-variants.js.map +1 -1
- package/es/components/ui/banner.js +9 -3
- package/es/components/ui/banner.js.map +1 -1
- package/es/components/ui/button-variants.js +2 -33
- package/es/components/ui/button-variants.js.map +1 -1
- package/es/components/ui/button.js +17 -5
- package/es/components/ui/button.js.map +1 -1
- package/es/components/ui/calendar.js +5 -6
- package/es/components/ui/calendar.js.map +1 -1
- package/es/components/ui/card-variants.js +3 -2
- package/es/components/ui/card-variants.js.map +1 -1
- package/es/components/ui/card.js +7 -4
- package/es/components/ui/card.js.map +1 -1
- package/es/components/ui/chart.js +2 -29
- package/es/components/ui/chart.js.map +1 -1
- package/es/components/ui/checkbox.js +1 -1
- package/es/components/ui/checkbox.js.map +1 -1
- package/es/components/ui/code-editor-view.js +1 -1
- package/es/components/ui/code-editor-view.js.map +1 -1
- package/es/components/ui/combobox.js +2 -2
- package/es/components/ui/combobox.js.map +1 -1
- package/es/components/ui/copy-field.js +2 -4
- package/es/components/ui/copy-field.js.map +1 -1
- package/es/components/ui/data-list.js +2 -4
- package/es/components/ui/data-list.js.map +1 -1
- package/es/components/ui/dialog.js +34 -10
- package/es/components/ui/dialog.js.map +1 -1
- package/es/components/ui/dropzone-variants.js +26 -10
- package/es/components/ui/dropzone-variants.js.map +1 -1
- package/es/components/ui/dropzone.js +2 -2
- package/es/components/ui/dropzone.js.map +1 -1
- package/es/components/ui/field.js +4 -4
- package/es/components/ui/field.js.map +1 -1
- package/es/components/ui/floating-sidebar.js +49 -16
- package/es/components/ui/floating-sidebar.js.map +1 -1
- package/es/components/ui/image-overlay-button.js +2 -2
- package/es/components/ui/image-overlay-button.js.map +1 -1
- package/es/components/ui/indicator-variants.js +2 -2
- package/es/components/ui/indicator-variants.js.map +1 -1
- package/es/components/ui/input-group-variants.js +5 -5
- package/es/components/ui/input-group-variants.js.map +1 -1
- package/es/components/ui/input-group.js +4 -7
- package/es/components/ui/input-group.js.map +1 -1
- package/es/components/ui/input-surface.js +3 -3
- package/es/components/ui/input-surface.js.map +1 -1
- package/es/components/ui/input.js +1 -1
- package/es/components/ui/input.js.map +1 -1
- package/es/components/ui/navbar.js +1 -3
- package/es/components/ui/navbar.js.map +1 -1
- package/es/components/ui/pagemenu.js +51 -15
- package/es/components/ui/pagemenu.js.map +1 -1
- package/es/components/ui/radio-group-variants.js +1 -1
- package/es/components/ui/radio-group-variants.js.map +1 -1
- package/es/components/ui/select-variants.js +6 -14
- package/es/components/ui/select-variants.js.map +1 -1
- package/es/components/ui/select.js +1 -4
- package/es/components/ui/select.js.map +1 -1
- package/es/components/ui/sheet.js +1 -1
- package/es/components/ui/sheet.js.map +1 -1
- package/es/components/ui/sidebar.js +1 -1
- package/es/components/ui/simple-pagination.js +4 -7
- package/es/components/ui/simple-pagination.js.map +1 -1
- package/es/components/ui/sticky-footer.js +59 -22
- package/es/components/ui/sticky-footer.js.map +1 -1
- package/es/components/ui/table.js +2 -2
- package/es/components/ui/table.js.map +1 -1
- package/es/components/ui/tabs-variants.js +23 -1
- package/es/components/ui/tabs-variants.js.map +1 -1
- package/es/components/ui/tabs.js +102 -21
- package/es/components/ui/tabs.js.map +1 -1
- package/es/components/ui/textarea.js +1 -1
- package/es/components/ui/textarea.js.map +1 -1
- package/es/components/ui/toast.js +2 -0
- package/es/components/ui/toggle-group.js +1 -3
- package/es/components/ui/toggle-group.js.map +1 -1
- package/es/components/ui/toggle-variants.js +1 -7
- package/es/components/ui/toggle-variants.js.map +1 -1
- package/es/components/ui/toggle.js +1 -2
- package/es/components/ui/toggle.js.map +1 -1
- package/es/components/ui/token-field.js +4 -4
- package/es/components/ui/token-field.js.map +1 -1
- package/es/components/ui/tooltip.js +8 -17
- package/es/components/ui/tooltip.js.map +1 -1
- package/es/components/ui/trend-badge.js +46 -12
- package/es/components/ui/trend-badge.js.map +1 -1
- package/es/components.js +7 -6
- package/es/{images-CUcakpOD.js → images-DtbFINdz.js} +3 -23
- package/es/images-DtbFINdz.js.map +1 -0
- package/es/index.js +7 -6
- package/es/lib/date-utils.js +151 -0
- package/es/lib/date-utils.js.map +1 -0
- package/es/lib/ds-utils.js +16 -72
- package/es/lib/ds-utils.js.map +1 -1
- package/es/lib/utils.js +3 -2
- package/es/providers/header-tooltip-provider.js +1 -4
- package/es/providers/header-tooltip-provider.js.map +1 -1
- package/es/providers/shade-context.js +2 -1
- package/es/providers/shade-context.js.map +1 -1
- package/es/providers/shade-provider.js +4 -3
- package/es/providers/shade-provider.js.map +1 -1
- package/es/shade-app.js +5 -3
- package/es/shade-app.js.map +1 -1
- package/es/shade-scope.js +3 -2
- package/es/shade-scope.js.map +1 -1
- package/es/tokens.js +56 -8
- package/es/tokens.js.map +1 -1
- package/es/utils.js +3 -2
- package/package.json +6 -6
- package/preflight.css +0 -10
- package/styles.css +118 -12
- package/tailwind.theme.css +237 -187
- package/theme-variables.css +412 -44
- package/types/app.d.ts +5 -5
- package/types/assets/images/index.d.ts +0 -1
- package/types/assets/images/index.d.ts.map +1 -1
- package/types/components/page-templates/list-page.d.ts +2 -1
- package/types/components/page-templates/list-page.d.ts.map +1 -1
- package/types/components/page-templates/modal-page.d.ts +1 -1
- package/types/components/patterns/color-picker.d.ts +2 -2
- package/types/components/patterns/filter-bar.d.ts +2 -2
- package/types/components/patterns/filter-bar.d.ts.map +1 -1
- package/types/components/patterns/filters-helpers.d.ts +1 -1
- package/types/components/patterns/filters.d.ts +2 -4
- package/types/components/patterns/filters.d.ts.map +1 -1
- package/types/components/patterns/gh-chart.d.ts.map +1 -1
- package/types/components/patterns/image-upload.d.ts +3 -3
- package/types/components/patterns/image-upload.d.ts.map +1 -1
- package/types/components/patterns/kpi-tabs.d.ts +5 -2
- package/types/components/patterns/kpi-tabs.d.ts.map +1 -1
- package/types/components/patterns/page-header.d.ts +17 -14
- package/types/components/patterns/page-header.d.ts.map +1 -1
- package/types/components/patterns/setting-group.d.ts +8 -8
- package/types/components/patterns/settings-modal-variants.d.ts +3 -0
- package/types/components/patterns/settings-modal-variants.d.ts.map +1 -1
- package/types/components/patterns/settings-modal.d.ts +12 -3
- package/types/components/patterns/settings-modal.d.ts.map +1 -1
- package/types/components/patterns/share-modal.d.ts +3 -3
- package/types/components/patterns/share-modal.d.ts.map +1 -1
- package/types/components/patterns/use-dirty-confirmation.d.ts +1 -1
- package/types/components/ui/alert-dialog.d.ts +1 -1
- package/types/components/ui/alert-dialog.d.ts.map +1 -1
- package/types/components/ui/avatar.d.ts.map +1 -1
- package/types/components/ui/badge-variants.d.ts +1 -1
- package/types/components/ui/badge-variants.d.ts.map +1 -1
- package/types/components/ui/badge.d.ts +1 -1
- package/types/components/ui/banner-variants.d.ts +1 -1
- package/types/components/ui/banner-variants.d.ts.map +1 -1
- package/types/components/ui/banner.d.ts +3 -1
- package/types/components/ui/banner.d.ts.map +1 -1
- package/types/components/ui/button-variants.d.ts +0 -1
- package/types/components/ui/button-variants.d.ts.map +1 -1
- package/types/components/ui/button.d.ts +7 -2
- package/types/components/ui/button.d.ts.map +1 -1
- package/types/components/ui/calendar.d.ts +1 -1
- package/types/components/ui/calendar.d.ts.map +1 -1
- package/types/components/ui/card-variants.d.ts +1 -1
- package/types/components/ui/card-variants.d.ts.map +1 -1
- package/types/components/ui/card.d.ts +1 -1
- package/types/components/ui/card.d.ts.map +1 -1
- package/types/components/ui/chart.d.ts +1 -17
- package/types/components/ui/chart.d.ts.map +1 -1
- package/types/components/ui/code-editor.d.ts +1 -1
- package/types/components/ui/combobox.d.ts.map +1 -1
- package/types/components/ui/copy-field.d.ts +1 -1
- package/types/components/ui/copy-field.d.ts.map +1 -1
- package/types/components/ui/data-list.d.ts.map +1 -1
- package/types/components/ui/dialog.d.ts +11 -2
- package/types/components/ui/dialog.d.ts.map +1 -1
- package/types/components/ui/dropzone-variants.d.ts +3 -2
- package/types/components/ui/dropzone-variants.d.ts.map +1 -1
- package/types/components/ui/dropzone.d.ts +1 -1
- package/types/components/ui/field.d.ts +1 -1
- package/types/components/ui/field.d.ts.map +1 -1
- package/types/components/ui/floating-sidebar.d.ts +12 -3
- package/types/components/ui/floating-sidebar.d.ts.map +1 -1
- package/types/components/ui/image-overlay-button.d.ts +1 -1
- package/types/components/ui/image-overlay-button.d.ts.map +1 -1
- package/types/components/ui/indicator.d.ts +1 -1
- package/types/components/ui/input-group-variants.d.ts.map +1 -1
- package/types/components/ui/input-group.d.ts +2 -2
- package/types/components/ui/input-group.d.ts.map +1 -1
- package/types/components/ui/input-surface.d.ts +3 -3
- package/types/components/ui/input-surface.d.ts.map +1 -1
- package/types/components/ui/multi-select-combobox.d.ts +1 -1
- package/types/components/ui/navbar.d.ts.map +1 -1
- package/types/components/ui/pagemenu.d.ts +3 -0
- package/types/components/ui/pagemenu.d.ts.map +1 -1
- package/types/components/ui/preview-chrome.d.ts +1 -1
- package/types/components/ui/select-variants.d.ts +0 -1
- package/types/components/ui/select-variants.d.ts.map +1 -1
- package/types/components/ui/select.d.ts +2 -2
- package/types/components/ui/select.d.ts.map +1 -1
- package/types/components/ui/sheet.d.ts.map +1 -1
- package/types/components/ui/sidebar.d.ts +2 -2
- package/types/components/ui/simple-pagination.d.ts.map +1 -1
- package/types/components/ui/sticky-footer.d.ts +9 -2
- package/types/components/ui/sticky-footer.d.ts.map +1 -1
- package/types/components/ui/tabs-variants.d.ts +5 -1
- package/types/components/ui/tabs-variants.d.ts.map +1 -1
- package/types/components/ui/tabs.d.ts.map +1 -1
- package/types/components/ui/toast.d.ts +2 -0
- package/types/components/ui/toast.d.ts.map +1 -0
- package/types/components/ui/toggle-group.d.ts +4 -6
- package/types/components/ui/toggle-group.d.ts.map +1 -1
- package/types/components/ui/toggle-variants.d.ts +0 -1
- package/types/components/ui/toggle-variants.d.ts.map +1 -1
- package/types/components/ui/toggle.d.ts +2 -3
- package/types/components/ui/toggle.d.ts.map +1 -1
- package/types/components/ui/token-field.d.ts +3 -3
- package/types/components/ui/token-field.d.ts.map +1 -1
- package/types/components/ui/tooltip.d.ts.map +1 -1
- package/types/components/ui/trend-badge.d.ts +1 -0
- package/types/components/ui/trend-badge.d.ts.map +1 -1
- package/types/components.d.ts +2 -1
- package/types/components.d.ts.map +1 -1
- package/types/lib/date-utils.d.ts +17 -0
- package/types/lib/date-utils.d.ts.map +1 -0
- package/types/lib/ds-utils.d.ts +2 -16
- package/types/lib/ds-utils.d.ts.map +1 -1
- package/types/lib/utils.d.ts +1 -0
- package/types/lib/utils.d.ts.map +1 -1
- package/types/providers/header-tooltip-provider.d.ts.map +1 -1
- package/types/providers/shade-context.d.ts +4 -1
- package/types/providers/shade-context.d.ts.map +1 -1
- package/types/providers/shade-provider.d.ts +3 -2
- package/types/providers/shade-provider.d.ts.map +1 -1
- package/types/shade-app.d.ts +8 -3
- package/types/shade-app.d.ts.map +1 -1
- package/types/shade-scope.d.ts.map +1 -1
- package/types/tokens.d.ts +1 -1
- package/types/tokens.d.ts.map +1 -1
- package/types/utils.d.ts +2 -1
- package/types/utils.d.ts.map +1 -1
- package/es/images-CUcakpOD.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-editor-view.js","names":[],"sources":["../../../src/components/ui/code-editor-view.tsx"],"sourcesContent":["import CodeMirror, {\n EditorView,\n tooltips,\n type BasicSetupOptions,\n type ReactCodeMirrorProps,\n type ReactCodeMirrorRef,\n} from '@uiw/react-codemirror';\nimport React, {\n type FocusEventHandler,\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { FieldDescription, FieldLabel } from '@/components/ui/field';\nimport { inputSurface } from '@/components/ui/input-surface';\nimport { Stack } from '@/components/primitives/stack';\nimport { cn } from '@/lib/utils';\nimport { useFocusContext } from '@/providers/shade-context';\nimport type { Extension } from '@codemirror/state';\n\nexport interface CodeEditorProps extends Omit<\n ReactCodeMirrorProps,\n 'value' | 'onChange' | 'extensions' | 'title'\n> {\n title?: React.ReactNode;\n value?: string;\n height?: string;\n error?: boolean;\n hint?: React.ReactNode;\n clearBg?: boolean;\n extensions: Array<Extension | Promise<Extension> | (() => Extension | Promise<Extension>)>;\n ariaLabel?: string;\n onChange?: (value: string) => void;\n}\n\nconst codeMirrorClasses = [\n '[&_.cm-editor]:bg-transparent',\n '[&_.cm-editor]:border-transparent',\n '[&_.cm-scroller]:font-mono',\n '[&_.cm-scroller]:border-transparent',\n '[&_.cm-activeLine]:bg-transparent',\n '[&_.cm-activeLineGutter]:bg-transparent',\n '[&_.cm-gutters]:bg-muted',\n '[&_.cm-gutters]:text-muted-foreground',\n '[&_.cm-gutters]:border-border',\n '[&_.cm-cursor]:border-foreground',\n].join(' ');\n\n// Imported asynchronously by CodeEditor so CodeMirror stays out of the main bundle.\nconst CodeEditorView = forwardRef<ReactCodeMirrorRef, CodeEditorProps>(function CodeEditorView(\n {\n title,\n value,\n height = '200px',\n error,\n hint,\n clearBg = true,\n extensions,\n ariaLabel,\n editable = true,\n onChange,\n onFocus,\n onBlur,\n className,\n ...props\n },\n ref,\n) {\n const id = useId();\n const labelId = `${id}-label`;\n const hintId = `${id}-description`;\n const hasTitle = Boolean(title);\n const sizeRef = useRef<HTMLDivElement>(null);\n const { darkMode, setFocusState } = useFocusContext();\n const focusedRef = useRef(false);\n const setFocusStateRef = useRef(setFocusState);\n const [width, setWidth] = useState(100);\n const [resolvedExtensions, setResolvedExtensions] = useState<Extension[]>([]);\n\n setFocusStateRef.current = setFocusState;\n\n // Keep autocomplete outside the editor and accordion overflow boundaries.\n // CodeMirror can switch fixed tooltips to absolute after its first layout\n // measurement. A viewport-sized body host gives both positioning modes the\n // same coordinate space, preventing the visible first-frame jump.\n const [tooltipParent] = useState(() => document.createElement('div'));\n\n useEffect(() => {\n tooltipParent.className = 'shade cm-tooltip-parent pointer-events-none fixed inset-0 z-[60]';\n document.body.appendChild(tooltipParent);\n\n return () => {\n tooltipParent.remove();\n };\n }, [tooltipParent]);\n\n const basicSetup = useMemo<BasicSetupOptions>(\n () => ({\n crosshairCursor: false,\n searchKeymap: false,\n }),\n [],\n );\n\n const editorExtensions = useMemo(() => {\n const contentAttributes: Record<string, string> = { id };\n\n if (hasTitle) {\n contentAttributes['aria-labelledby'] = labelId;\n } else if (ariaLabel) {\n contentAttributes['aria-label'] = ariaLabel;\n }\n if (error) {\n contentAttributes['aria-invalid'] = 'true';\n }\n if (hint) {\n contentAttributes['aria-describedby'] = hintId;\n }\n if (!editable) {\n contentAttributes['aria-disabled'] = 'true';\n }\n\n return [\n ...resolvedExtensions,\n tooltips({ position: 'fixed', parent: tooltipParent }),\n EditorView.contentAttributes.of(contentAttributes),\n ];\n }, [\n ariaLabel,\n editable,\n error,\n hasTitle,\n hint,\n hintId,\n id,\n labelId,\n resolvedExtensions,\n tooltipParent,\n ]);\n\n const handleFocus: FocusEventHandler<HTMLDivElement> = (event) => {\n onFocus?.(event);\n focusedRef.current = true;\n setFocusState(true);\n };\n\n const handleBlur: FocusEventHandler<HTMLDivElement> = (event) => {\n onBlur?.(event);\n focusedRef.current = false;\n setFocusState(false);\n };\n\n const handleLabelClick = () => {\n if (editable) {\n document.getElementById(id)?.focus();\n }\n };\n\n useEffect(() => {\n return () => {\n if (focusedRef.current) {\n setFocusStateRef.current(false);\n }\n };\n }, []);\n\n useEffect(() => {\n let cancelled = false;\n\n const pendingExtensions = extensions.map((extension) =>\n typeof extension === 'function' ? extension() : extension,\n );\n\n Promise.all(pendingExtensions).then(\n (nextExtensions) => {\n if (!cancelled) {\n setResolvedExtensions(nextExtensions);\n }\n },\n () => {\n if (!cancelled) {\n setResolvedExtensions([]);\n }\n },\n );\n\n return () => {\n cancelled = true;\n };\n }, [extensions]);\n\n useEffect(() => {\n const resizeObserver = new ResizeObserver(([entry]) => {\n setWidth(entry.contentRect.width);\n });\n\n resizeObserver.observe(sizeRef.current!);\n\n return () => resizeObserver.disconnect();\n }, []);\n\n const styles = cn(\n inputSurface('within'),\n 'peer
|
|
1
|
+
{"version":3,"file":"code-editor-view.js","names":[],"sources":["../../../src/components/ui/code-editor-view.tsx"],"sourcesContent":["import CodeMirror, {\n EditorView,\n tooltips,\n type BasicSetupOptions,\n type ReactCodeMirrorProps,\n type ReactCodeMirrorRef,\n} from '@uiw/react-codemirror';\nimport React, {\n type FocusEventHandler,\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { FieldDescription, FieldLabel } from '@/components/ui/field';\nimport { inputSurface } from '@/components/ui/input-surface';\nimport { Stack } from '@/components/primitives/stack';\nimport { cn } from '@/lib/utils';\nimport { useFocusContext } from '@/providers/shade-context';\nimport type { Extension } from '@codemirror/state';\n\nexport interface CodeEditorProps extends Omit<\n ReactCodeMirrorProps,\n 'value' | 'onChange' | 'extensions' | 'title'\n> {\n title?: React.ReactNode;\n value?: string;\n height?: string;\n error?: boolean;\n hint?: React.ReactNode;\n clearBg?: boolean;\n extensions: Array<Extension | Promise<Extension> | (() => Extension | Promise<Extension>)>;\n ariaLabel?: string;\n onChange?: (value: string) => void;\n}\n\nconst codeMirrorClasses = [\n '[&_.cm-editor]:bg-transparent',\n '[&_.cm-editor]:border-transparent',\n '[&_.cm-scroller]:font-mono',\n '[&_.cm-scroller]:border-transparent',\n '[&_.cm-activeLine]:bg-transparent',\n '[&_.cm-activeLineGutter]:bg-transparent',\n '[&_.cm-gutters]:bg-muted',\n '[&_.cm-gutters]:text-muted-foreground',\n '[&_.cm-gutters]:border-border',\n '[&_.cm-cursor]:border-foreground',\n].join(' ');\n\n// Imported asynchronously by CodeEditor so CodeMirror stays out of the main bundle.\nconst CodeEditorView = forwardRef<ReactCodeMirrorRef, CodeEditorProps>(function CodeEditorView(\n {\n title,\n value,\n height = '200px',\n error,\n hint,\n clearBg = true,\n extensions,\n ariaLabel,\n editable = true,\n onChange,\n onFocus,\n onBlur,\n className,\n ...props\n },\n ref,\n) {\n const id = useId();\n const labelId = `${id}-label`;\n const hintId = `${id}-description`;\n const hasTitle = Boolean(title);\n const sizeRef = useRef<HTMLDivElement>(null);\n const { darkMode, setFocusState } = useFocusContext();\n const focusedRef = useRef(false);\n const setFocusStateRef = useRef(setFocusState);\n const [width, setWidth] = useState(100);\n const [resolvedExtensions, setResolvedExtensions] = useState<Extension[]>([]);\n\n setFocusStateRef.current = setFocusState;\n\n // Keep autocomplete outside the editor and accordion overflow boundaries.\n // CodeMirror can switch fixed tooltips to absolute after its first layout\n // measurement. A viewport-sized body host gives both positioning modes the\n // same coordinate space, preventing the visible first-frame jump.\n const [tooltipParent] = useState(() => document.createElement('div'));\n\n useEffect(() => {\n tooltipParent.className = 'shade cm-tooltip-parent pointer-events-none fixed inset-0 z-[60]';\n document.body.appendChild(tooltipParent);\n\n return () => {\n tooltipParent.remove();\n };\n }, [tooltipParent]);\n\n const basicSetup = useMemo<BasicSetupOptions>(\n () => ({\n crosshairCursor: false,\n searchKeymap: false,\n }),\n [],\n );\n\n const editorExtensions = useMemo(() => {\n const contentAttributes: Record<string, string> = { id };\n\n if (hasTitle) {\n contentAttributes['aria-labelledby'] = labelId;\n } else if (ariaLabel) {\n contentAttributes['aria-label'] = ariaLabel;\n }\n if (error) {\n contentAttributes['aria-invalid'] = 'true';\n }\n if (hint) {\n contentAttributes['aria-describedby'] = hintId;\n }\n if (!editable) {\n contentAttributes['aria-disabled'] = 'true';\n }\n\n return [\n ...resolvedExtensions,\n tooltips({ position: 'fixed', parent: tooltipParent }),\n EditorView.contentAttributes.of(contentAttributes),\n ];\n }, [\n ariaLabel,\n editable,\n error,\n hasTitle,\n hint,\n hintId,\n id,\n labelId,\n resolvedExtensions,\n tooltipParent,\n ]);\n\n const handleFocus: FocusEventHandler<HTMLDivElement> = (event) => {\n onFocus?.(event);\n focusedRef.current = true;\n setFocusState(true);\n };\n\n const handleBlur: FocusEventHandler<HTMLDivElement> = (event) => {\n onBlur?.(event);\n focusedRef.current = false;\n setFocusState(false);\n };\n\n const handleLabelClick = () => {\n if (editable) {\n document.getElementById(id)?.focus();\n }\n };\n\n useEffect(() => {\n return () => {\n if (focusedRef.current) {\n setFocusStateRef.current(false);\n }\n };\n }, []);\n\n useEffect(() => {\n let cancelled = false;\n\n const pendingExtensions = extensions.map((extension) =>\n typeof extension === 'function' ? extension() : extension,\n );\n\n Promise.all(pendingExtensions).then(\n (nextExtensions) => {\n if (!cancelled) {\n setResolvedExtensions(nextExtensions);\n }\n },\n () => {\n if (!cancelled) {\n setResolvedExtensions([]);\n }\n },\n );\n\n return () => {\n cancelled = true;\n };\n }, [extensions]);\n\n useEffect(() => {\n const resizeObserver = new ResizeObserver(([entry]) => {\n setWidth(entry.contentRect.width);\n });\n\n resizeObserver.observe(sizeRef.current!);\n\n return () => resizeObserver.disconnect();\n }, []);\n\n const styles = cn(\n inputSurface('within'),\n 'peer w-full max-w-full overflow-hidden',\n clearBg && 'bg-transparent',\n height === 'full' && 'h-full',\n !editable && 'cursor-not-allowed opacity-50',\n codeMirrorClasses,\n className,\n );\n\n return (\n <div className={cn('w-full', height === 'full' && 'h-full')}>\n <div ref={sizeRef} />\n <Stack className={height === 'full' ? 'h-full' : ''} gap=\"xs\" style={{ width }}>\n {title && (\n <FieldLabel id={labelId} onClick={handleLabelClick}>\n {title}\n </FieldLabel>\n )}\n <CodeMirror\n ref={ref}\n basicSetup={basicSetup}\n className={styles}\n editable={editable}\n extensions={editorExtensions}\n height={height === 'full' ? '100%' : height}\n theme={darkMode ? 'dark' : 'light'}\n value={value}\n onBlur={handleBlur}\n onChange={onChange}\n onFocus={handleFocus}\n {...props}\n />\n {hint && (\n <FieldDescription className={cn(error && 'text-destructive')} id={hintId}>\n {hint}\n </FieldDescription>\n )}\n </Stack>\n </div>\n );\n});\n\nCodeEditorView.displayName = 'CodeEditorView';\n\nexport default CodeEditorView;\n"],"mappings":"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"}
|
|
@@ -10,11 +10,11 @@ var ComboboxTrigger = React$1.forwardRef(({ children, className, ...props }, ref
|
|
|
10
10
|
asChild: true,
|
|
11
11
|
children: /* @__PURE__ */ jsxs("button", {
|
|
12
12
|
ref,
|
|
13
|
-
className: cn(inputSurface("self"), inputSurfaceClasses.disabledFieldSelf, "flex h-(--control-height) w-full min-w-0 items-center justify-between
|
|
13
|
+
className: cn(inputSurface("self"), inputSurfaceClasses.disabledFieldSelf, "flex h-(--control-height) w-full min-w-0 items-center justify-between pr-2 pl-3 text-(length:--text-field) hover:bg-button-hover", className),
|
|
14
14
|
role: "combobox",
|
|
15
15
|
...props,
|
|
16
16
|
type: "button",
|
|
17
|
-
children: [children, /* @__PURE__ */ jsx(ChevronDown, { className: "ml-2 size-4 shrink-0 opacity-50" })]
|
|
17
|
+
children: [children, /* @__PURE__ */ jsx(ChevronDown, { className: "-mr-0.5 ml-2 size-4 shrink-0 opacity-50" })]
|
|
18
18
|
})
|
|
19
19
|
}));
|
|
20
20
|
ComboboxTrigger.displayName = "ComboboxTrigger";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.js","names":[],"sources":["../../../src/components/ui/combobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ChevronDown } from 'lucide-react';\n\nimport { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';\nimport { inputSurface, inputSurfaceClasses } from '@/components/ui/input-surface';\nimport { cn } from '@/lib/utils';\n\nconst Combobox = Popover;\n\nconst ComboboxTrigger = React.forwardRef<\n HTMLButtonElement,\n Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'>\n>(({ children, className, ...props }, ref) => (\n <PopoverTrigger asChild>\n <button\n ref={ref}\n className={cn(\n inputSurface('self'),\n inputSurfaceClasses.disabledFieldSelf,\n 'flex h-(--control-height) w-full min-w-0 items-center justify-between
|
|
1
|
+
{"version":3,"file":"combobox.js","names":[],"sources":["../../../src/components/ui/combobox.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ChevronDown } from 'lucide-react';\n\nimport { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';\nimport { inputSurface, inputSurfaceClasses } from '@/components/ui/input-surface';\nimport { cn } from '@/lib/utils';\n\nconst Combobox = Popover;\n\nconst ComboboxTrigger = React.forwardRef<\n HTMLButtonElement,\n Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'>\n>(({ children, className, ...props }, ref) => (\n <PopoverTrigger asChild>\n <button\n ref={ref}\n className={cn(\n inputSurface('self'),\n inputSurfaceClasses.disabledFieldSelf,\n // Chevron position matches SelectTrigger.\n 'flex h-(--control-height) w-full min-w-0 items-center justify-between pr-2 pl-3 text-(length:--text-field) hover:bg-button-hover',\n className,\n )}\n role=\"combobox\"\n {...props}\n type=\"button\"\n >\n {children}\n <ChevronDown className=\"-mr-0.5 ml-2 size-4 shrink-0 opacity-50\" />\n </button>\n </PopoverTrigger>\n));\nComboboxTrigger.displayName = 'ComboboxTrigger';\n\ninterface ComboboxValueProps extends React.HTMLAttributes<HTMLSpanElement> {\n placeholder?: boolean;\n}\n\nconst ComboboxValue = React.forwardRef<HTMLSpanElement, ComboboxValueProps>(\n ({ className, placeholder = false, ...props }, ref) => (\n <span\n ref={ref}\n className={cn(\n 'min-w-0 flex-1 truncate text-left',\n placeholder && 'text-muted-foreground',\n className,\n )}\n {...props}\n />\n ),\n);\nComboboxValue.displayName = 'ComboboxValue';\n\nconst ComboboxContent = React.forwardRef<\n React.ElementRef<typeof PopoverContent>,\n React.ComponentPropsWithoutRef<typeof PopoverContent>\n>(({ align = 'start', className, ...props }, ref) => (\n <PopoverContent\n ref={ref}\n align={align}\n className={cn('z-[9999] w-(--radix-popover-trigger-width) p-0', className)}\n {...props}\n />\n));\nComboboxContent.displayName = 'ComboboxContent';\n\nexport { Combobox, ComboboxContent, ComboboxTrigger, ComboboxValue };\n"],"mappings":";;;;;;;AAOA,IAAM,WAAW;AAEjB,IAAM,kBAAkB,QAAM,YAG3B,EAAE,UAAU,WAAW,GAAG,SAAS,QACpC,oBAAC,gBAAD;CAAgB,SAAA;WACd,qBAAC,UAAD;EACO;EACL,WAAW,GACT,aAAa,MAAM,GACnB,oBAAoB,mBAEpB,oIACA,SACF;EACA,MAAK;EACL,GAAI;EACJ,MAAK;YAXP,CAaG,UACD,oBAAC,aAAD,EAAa,WAAU,0CAA2C,CAAA,CAC5D;;AACM,CAAA,CACjB;AACD,gBAAgB,cAAc;AAM9B,IAAM,gBAAgB,QAAM,YACzB,EAAE,WAAW,cAAc,OAAO,GAAG,SAAS,QAC7C,oBAAC,QAAD;CACO;CACL,WAAW,GACT,qCACA,eAAe,yBACf,SACF;CACA,GAAI;AACL,CAAA,CAEL;AACA,cAAc,cAAc;AAE5B,IAAM,kBAAkB,QAAM,YAG3B,EAAE,QAAQ,SAAS,WAAW,GAAG,SAAS,QAC3C,oBAAC,gBAAD;CACO;CACE;CACP,WAAW,GAAG,kDAAkD,SAAS;CACzE,GAAI;AACL,CAAA,CACF;AACD,gBAAgB,cAAc"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { cn } from "../../lib/ds-utils.js";
|
|
2
|
-
import { useShade } from "../../providers/shade-context.js";
|
|
3
2
|
import { Inline } from "../primitives/inline.js";
|
|
4
3
|
import { Stack } from "../primitives/stack.js";
|
|
5
4
|
import { Text } from "../primitives/text.js";
|
|
@@ -83,7 +82,7 @@ var CopyFieldLabel = React$1.forwardRef(({ className, id, ...props }, ref) => {
|
|
|
83
82
|
CopyFieldLabel.displayName = "CopyFieldLabel";
|
|
84
83
|
var CopyFieldContent = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
85
84
|
ref,
|
|
86
|
-
className: cn(inputSurface("within"), "group/copy-field-content relative flex h-(--control-height) w-full items-center overflow-hidden bg-
|
|
85
|
+
className: cn(inputSurface("within"), "group/copy-field-content relative flex h-(--control-height) w-full items-center overflow-hidden bg-field-readonly-surface px-3 py-1 group-data-[disabled=true]/copy-field:cursor-not-allowed group-data-[disabled=true]/copy-field:opacity-50", className),
|
|
87
86
|
"data-slot": "copy-field-content",
|
|
88
87
|
...props
|
|
89
88
|
}));
|
|
@@ -107,10 +106,9 @@ var CopyFieldValue = React$1.forwardRef(({ children, className, ...props }, ref)
|
|
|
107
106
|
});
|
|
108
107
|
CopyFieldValue.displayName = "CopyFieldValue";
|
|
109
108
|
var CopyFieldActions = React$1.forwardRef(({ className, ...props }, ref) => {
|
|
110
|
-
const { isAdmin7 } = useShade();
|
|
111
109
|
return /* @__PURE__ */ jsx(Inline, {
|
|
112
110
|
ref,
|
|
113
|
-
className: cn("absolute top-1/2 right-[1px] -translate-y-1/2 gap-px bg-
|
|
111
|
+
className: cn("absolute top-1/2 right-[1px] -translate-y-1/2 gap-px bg-field-readonly-surface pl-1 transition-opacity md:pointer-events-none md:opacity-0 md:group-focus-within/copy-field-content:pointer-events-auto md:group-focus-within/copy-field-content:opacity-100 md:group-hover/copy-field-content:pointer-events-auto md:group-hover/copy-field-content:opacity-100 [&_button]:h-6 [&_button:not([data-slot=copy-field-copy-button])]:bg-field-readonly-surface [&_button:not([data-slot=copy-field-copy-button])]:hover:bg-secondary [&_button[data-control-shape=rounded]]:rounded-sm", className),
|
|
114
112
|
"data-slot": "copy-field-actions",
|
|
115
113
|
gap: "none",
|
|
116
114
|
...props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-field.js","names":[],"sources":["../../../src/components/ui/copy-field.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Inline, Stack, Text } from '@/components/primitives';\nimport { Button, type ButtonProps } from '@/components/ui/button';\nimport { inputSurface } from '@/components/ui/input-surface';\nimport { cn } from '@/lib/utils';\
|
|
1
|
+
{"version":3,"file":"copy-field.js","names":[],"sources":["../../../src/components/ui/copy-field.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Inline, Stack, Text } from '@/components/primitives';\nimport { Button, type ButtonProps } from '@/components/ui/button';\nimport { inputSurface } from '@/components/ui/input-surface';\nimport { cn } from '@/lib/utils';\n\ntype CopyFieldContextValue = {\n copied: boolean;\n copy: () => Promise<void>;\n disabled: boolean;\n labelId: string;\n value: string;\n};\n\nconst CopyFieldContext = React.createContext<CopyFieldContextValue | null>(null);\n\nfunction useCopyField() {\n const context = React.useContext(CopyFieldContext);\n\n if (!context) {\n throw new Error('CopyField subcomponents must be used within CopyField');\n }\n\n return context;\n}\n\ninterface CopyFieldProps extends React.HTMLAttributes<HTMLDivElement> {\n disabled?: boolean;\n value: string;\n}\n\nconst CopyField = React.forwardRef<HTMLDivElement, CopyFieldProps>(\n ({ children, className, disabled = false, value, ...props }, ref) => {\n const [copied, setCopied] = React.useState(false);\n const labelId = React.useId();\n const resetTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n\n React.useEffect(() => {\n setCopied(false);\n\n if (resetTimer.current) {\n clearTimeout(resetTimer.current);\n resetTimer.current = null;\n }\n }, [value]);\n\n React.useEffect(() => {\n return () => {\n if (resetTimer.current) {\n clearTimeout(resetTimer.current);\n }\n };\n }, []);\n\n const copy = React.useCallback(async () => {\n if (disabled) {\n return;\n }\n\n try {\n await navigator.clipboard.writeText(value);\n setCopied(true);\n\n if (resetTimer.current) {\n clearTimeout(resetTimer.current);\n }\n\n resetTimer.current = setTimeout(() => setCopied(false), 2000);\n } catch {\n setCopied(false);\n }\n }, [disabled, value]);\n\n const contextValue = React.useMemo(\n () => ({ copied, copy, disabled, labelId, value }),\n [copied, copy, disabled, labelId, value],\n );\n\n return (\n <CopyFieldContext.Provider value={contextValue}>\n <Stack\n ref={ref}\n className={cn('group/copy-field w-full', className)}\n data-disabled={disabled || undefined}\n data-slot=\"copy-field\"\n gap=\"xs\"\n {...props}\n >\n {children}\n </Stack>\n </CopyFieldContext.Provider>\n );\n },\n);\nCopyField.displayName = 'CopyField';\n\nconst CopyFieldLabel = React.forwardRef<HTMLElement, React.ComponentProps<typeof Text>>(\n ({ className, id, ...props }, ref) => {\n const { labelId } = useCopyField();\n\n return (\n <Text\n ref={ref}\n as=\"div\"\n className={cn(\n 'text-control! font-medium group-data-[disabled=true]/copy-field:opacity-50',\n className,\n )}\n data-slot=\"copy-field-label\"\n id={id || labelId}\n leading=\"snug\"\n {...props}\n />\n );\n },\n);\nCopyFieldLabel.displayName = 'CopyFieldLabel';\n\nconst CopyFieldContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\n inputSurface('within'),\n 'group/copy-field-content relative flex h-(--control-height) w-full items-center overflow-hidden bg-field-readonly-surface px-3 py-1 group-data-[disabled=true]/copy-field:cursor-not-allowed group-data-[disabled=true]/copy-field:opacity-50',\n className,\n )}\n data-slot=\"copy-field-content\"\n {...props}\n />\n ),\n);\nCopyFieldContent.displayName = 'CopyFieldContent';\n\nconst CopyFieldValue = React.forwardRef<HTMLElement, React.ComponentProps<typeof Text>>(\n ({ children, className, ...props }, ref) => {\n const { disabled, labelId, value } = useCopyField();\n\n return (\n <Text\n ref={ref}\n aria-disabled={disabled || undefined}\n aria-labelledby={\n props['aria-label'] || props['aria-labelledby'] ? props['aria-labelledby'] : labelId\n }\n aria-readonly=\"true\"\n as=\"div\"\n className={cn('min-w-0 truncate pr-2 text-muted-foreground', className)}\n data-slot=\"copy-field-value\"\n leading=\"snug\"\n role=\"textbox\"\n tabIndex={disabled ? undefined : 0}\n {...props}\n >\n {children ?? value}\n </Text>\n );\n },\n);\nCopyFieldValue.displayName = 'CopyFieldValue';\n\nconst CopyFieldActions = React.forwardRef<HTMLElement, React.ComponentProps<typeof Inline>>(\n ({ className, ...props }, ref) => {\n return (\n <Inline\n ref={ref}\n className={cn(\n 'absolute top-1/2 right-[1px] -translate-y-1/2 gap-px bg-field-readonly-surface pl-1 transition-opacity md:pointer-events-none md:opacity-0 md:group-focus-within/copy-field-content:pointer-events-auto md:group-focus-within/copy-field-content:opacity-100 md:group-hover/copy-field-content:pointer-events-auto md:group-hover/copy-field-content:opacity-100 [&_button]:h-6 [&_button:not([data-slot=copy-field-copy-button])]:bg-field-readonly-surface [&_button:not([data-slot=copy-field-copy-button])]:hover:bg-secondary [&_button[data-control-shape=rounded]]:rounded-sm',\n className,\n )}\n data-slot=\"copy-field-actions\"\n gap=\"none\"\n {...props}\n />\n );\n },\n);\nCopyFieldActions.displayName = 'CopyFieldActions';\n\ninterface CopyFieldCopyButtonProps extends Omit<ButtonProps, 'children'> {\n children?: React.ReactNode;\n copiedLabel?: React.ReactNode;\n}\n\nconst CopyFieldCopyButton = React.forwardRef<HTMLButtonElement, CopyFieldCopyButtonProps>(\n ({ children = 'Copy', className, copiedLabel = 'Copied', disabled, onClick, ...props }, ref) => {\n const { copied, copy, disabled: fieldDisabled } = useCopyField();\n\n return (\n <Button\n ref={ref}\n className={cn(\n 'bg-surface-elevated hover:border-border-strong/40 hover:bg-surface-elevated',\n className,\n )}\n disabled={fieldDisabled || disabled}\n size=\"sm\"\n type=\"button\"\n variant=\"outline\"\n onClick={async (event) => {\n await copy();\n onClick?.(event);\n }}\n {...props}\n data-slot=\"copy-field-copy-button\"\n >\n {copied ? copiedLabel : children}\n </Button>\n );\n },\n);\nCopyFieldCopyButton.displayName = 'CopyFieldCopyButton';\n\nexport {\n CopyField,\n CopyFieldActions,\n CopyFieldContent,\n CopyFieldCopyButton,\n CopyFieldLabel,\n CopyFieldValue,\n};\nexport type { CopyFieldProps };\n"],"mappings":"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"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { cn } from "../../lib/ds-utils.js";
|
|
2
|
-
import { useShade } from "../../providers/shade-context.js";
|
|
3
2
|
import React from "react";
|
|
4
3
|
import { jsx } from "react/jsx-runtime";
|
|
5
4
|
//#region src/components/ui/data-list.tsx
|
|
@@ -15,7 +14,7 @@ DataList.displayName = "DataList";
|
|
|
15
14
|
var DataListHeader = React.forwardRef(({ children, className, ...props }, ref) => {
|
|
16
15
|
return /* @__PURE__ */ jsx("div", {
|
|
17
16
|
ref,
|
|
18
|
-
className: cn("flex items-center justify-between gap-2 border-b p-2 text-xs font-medium tracking-wide text-muted-foreground uppercase", className),
|
|
17
|
+
className: cn("column-label flex items-center justify-between gap-2 border-b p-2 text-xs font-medium tracking-wide text-muted-foreground uppercase", className),
|
|
19
18
|
...props,
|
|
20
19
|
children
|
|
21
20
|
});
|
|
@@ -40,10 +39,9 @@ var DataListBody = React.forwardRef(({ children, className, ...props }, ref) =>
|
|
|
40
39
|
});
|
|
41
40
|
DataListBody.displayName = "DataListBody";
|
|
42
41
|
var DataListRow = React.forwardRef(({ children, className, ...props }, ref) => {
|
|
43
|
-
const { isAdmin7 } = useShade();
|
|
44
42
|
return /* @__PURE__ */ jsx("div", {
|
|
45
43
|
ref,
|
|
46
|
-
className: cn("group/row relative flex items-center justify-between gap-3 py-0.5 before:absolute before:-inset-x-0.5 before:inset-y-0.5 before:z-0 before:bg-muted/60 before:opacity-0 hover:before:opacity-100",
|
|
44
|
+
className: cn("group/row relative flex items-center justify-between gap-3 py-0.5 before:absolute before:-inset-x-0.5 before:inset-y-0.5 before:z-0 before:rounded-control before:bg-muted/60 before:opacity-0 hover:before:opacity-100", className),
|
|
47
45
|
...props,
|
|
48
46
|
children
|
|
49
47
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-list.js","names":[],"sources":["../../../src/components/ui/data-list.tsx"],"sourcesContent":["import { useShade } from '@/providers/shade-context';\nimport { cn } from '@/lib/utils';\nimport React from 'react';\n\n/* Data List main component\n/* -------------------------------------------------------------------------- */\ninterface DataListProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataList = React.forwardRef<HTMLDivElement, DataListProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div ref={ref} className={cn('flex flex-col items-stretch', className)} {...props}>\n {children}\n </div>\n );\n },\n);\n\nDataList.displayName = 'DataList';\n\n/* Header\n/* -------------------------------------------------------------------------- */\ninterface DataListHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListHeader = React.forwardRef<HTMLDivElement, DataListHeaderProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'flex items-center justify-between gap-2 border-b p-2 text-xs font-medium tracking-wide text-muted-foreground uppercase',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListHeader.displayName = 'DataListHeader';\n\n/* Head\n/* -------------------------------------------------------------------------- */\ninterface DataListHeadProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListHead = React.forwardRef<HTMLDivElement, DataListHeadProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div ref={ref} className={cn('', className)} {...props}>\n {children}\n </div>\n );\n },\n);\n\nDataListHead.displayName = 'DataListHead';\n\n/* Body\n/* -------------------------------------------------------------------------- */\ninterface DataListBodyProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListBody = React.forwardRef<HTMLDivElement, DataListBodyProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div ref={ref} className={cn('flex flex-col items-stretch pt-1.5', className)} {...props}>\n {children}\n </div>\n );\n },\n);\n\nDataListBody.displayName = 'DataListBody';\n\n/* Data row\n/* -------------------------------------------------------------------------- */\ninterface DataListRowProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListRow = React.forwardRef<HTMLDivElement, DataListRowProps>(\n ({ children, className, ...props }, ref) => {\n const { isAdmin7 } = useShade();\n return (\n <div\n ref={ref}\n className={cn(\n 'group/row relative flex items-center justify-between gap-3 py-0.5 before:absolute before:-inset-x-0.5 before:inset-y-0.5 before:z-0 before:bg-muted/60 before:opacity-0 hover:before:opacity-100',\n isAdmin7 ? 'before:rounded-control' : 'before:rounded-[6px]',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListRow.displayName = 'DataListRow';\n\n/* Bar\n/* -------------------------------------------------------------------------- */\ninterface DataListBarProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListBar = React.forwardRef<HTMLDivElement, DataListBarProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'absolute inset-x-0 inset-y-1 z-0 origin-left rounded-[4px] bg-state-info/10 transition-all group-hover/row:bg-state-info/25 dark:bg-state-info/20 dark:group-hover/row:bg-state-info/35',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListBar.displayName = 'DataListBar';\n\n/* List item content\n/* -------------------------------------------------------------------------- */\ninterface DataListItemContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemContent = React.forwardRef<HTMLDivElement, DataListItemContentProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'relative z-10 flex max-w-[calc(100%-32px)] min-w-0 items-center p-2 text-sm font-medium transition-[max-width] duration-300 ease-in-out group-hover/datalist:max-w-[calc(100%-100px)]',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemContent.displayName = 'DataListItemContent';\n\n/* Value\n/* -------------------------------------------------------------------------- */\ninterface DataListItemValueProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemValue = React.forwardRef<HTMLDivElement, DataListItemValueProps>(\n ({ children, className, ...props }, ref) => {\n // Apply animation styles when there are multiple children\n const childrenArray = React.Children.toArray(children);\n const hasMultipleChildren = childrenArray.length > 1;\n\n return (\n <div\n ref={ref}\n className={cn(\n 'z-10 flex items-center',\n // Apply animation styles when there are multiple children\n hasMultipleChildren &&\n '[&>[data-type=\"value-abs\"]]:transition-transform [&>[data-type=\"value-abs\"]]:duration-300 [&>[data-type=\"value-abs\"]]:group-hover/datalist:-translate-x-14',\n hasMultipleChildren &&\n '[&>[data-type=\"value-perc\"]]:invisible [&>[data-type=\"value-perc\"]]:absolute [&>[data-type=\"value-perc\"]]:right-0 [&>[data-type=\"value-perc\"]]:translate-x-14 [&>[data-type=\"value-perc\"]]:opacity-0 [&>[data-type=\"value-perc\"]]:transition-all [&>[data-type=\"value-perc\"]]:duration-300 [&>[data-type=\"value-perc\"]]:group-hover/datalist:visible [&>[data-type=\"value-perc\"]]:group-hover/datalist:translate-x-0 [&>[data-type=\"value-perc\"]]:group-hover/datalist:opacity-100',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemValue.displayName = 'DataListItemValue';\n\n/* Value absolute value, e.g. 996.178.341\n/* -------------------------------------------------------------------------- */\ninterface DataListItemValueAbsProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemValueAbs = React.forwardRef<HTMLDivElement, DataListItemValueAbsProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn('z-10 px-2 font-mono text-sm', className)}\n data-type=\"value-abs\"\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemValueAbs.displayName = 'DataListItemValueAbs';\n\n/* Value percentage value, e.g. 85%\n/* -------------------------------------------------------------------------- */\ninterface DataListItemValuePercProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemValuePerc = React.forwardRef<HTMLDivElement, DataListItemValuePercProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn('px-3 font-mono text-sm text-muted-foreground', className)}\n data-type=\"value-perc\"\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemValuePerc.displayName = 'DataListItemValuePerc';\n\n/* End of components\n/* -------------------------------------------------------------------------- */\nexport {\n DataList,\n DataListHeader,\n DataListHead,\n DataListBody,\n DataListRow,\n DataListBar,\n DataListItemContent,\n DataListItemValue,\n DataListItemValueAbs,\n DataListItemValuePerc,\n};\n"],"mappings":";;;;;AAWA,IAAM,WAAW,MAAM,YACpB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EAAU;EAAK,WAAW,GAAG,+BAA+B,SAAS;EAAG,GAAI;EACzE;CACE,CAAA;AAET,CACF;AAEA,SAAS,cAAc;AASvB,IAAM,iBAAiB,MAAM,YAC1B,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,0HACA,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,eAAe,cAAc;AAS7B,IAAM,eAAe,MAAM,YACxB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EAAU;EAAK,WAAW,GAAG,IAAI,SAAS;EAAG,GAAI;EAC9C;CACE,CAAA;AAET,CACF;AAEA,aAAa,cAAc;AAS3B,IAAM,eAAe,MAAM,YACxB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EAAU;EAAK,WAAW,GAAG,sCAAsC,SAAS;EAAG,GAAI;EAChF;CACE,CAAA;AAET,CACF;AAEA,aAAa,cAAc;AAS3B,IAAM,cAAc,MAAM,YACvB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,MAAM,EAAE,aAAa,SAAS;CAC9B,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,oMACA,WAAW,2BAA2B,wBACtC,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,YAAY,cAAc;AAS1B,IAAM,cAAc,MAAM,YACvB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,2LACA,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,YAAY,cAAc;AAS1B,IAAM,sBAAsB,MAAM,YAC/B,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,yLACA,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,oBAAoB,cAAc;AASlC,IAAM,oBAAoB,MAAM,YAC7B,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAG1C,MAAM,sBADgB,MAAM,SAAS,QAAQ,QACjB,CAAA,CAAc,SAAS;CAEnD,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,0BAEA,uBACE,oKACF,uBACE,0eACF,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,kBAAkB,cAAc;AAShC,IAAM,uBAAuB,MAAM,YAChC,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GAAG,+BAA+B,SAAS;EACtD,aAAU;EACV,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,qBAAqB,cAAc;AASnC,IAAM,wBAAwB,MAAM,YACjC,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GAAG,gDAAgD,SAAS;EACvE,aAAU;EACV,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,sBAAsB,cAAc"}
|
|
1
|
+
{"version":3,"file":"data-list.js","names":[],"sources":["../../../src/components/ui/data-list.tsx"],"sourcesContent":["import { cn } from '@/lib/utils';\nimport React from 'react';\n\n/* Data List main component\n/* -------------------------------------------------------------------------- */\ninterface DataListProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataList = React.forwardRef<HTMLDivElement, DataListProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div ref={ref} className={cn('flex flex-col items-stretch', className)} {...props}>\n {children}\n </div>\n );\n },\n);\n\nDataList.displayName = 'DataList';\n\n/* Header\n/* -------------------------------------------------------------------------- */\ninterface DataListHeaderProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListHeader = React.forwardRef<HTMLDivElement, DataListHeaderProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'column-label flex items-center justify-between gap-2 border-b p-2 text-xs font-medium tracking-wide text-muted-foreground uppercase',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListHeader.displayName = 'DataListHeader';\n\n/* Head\n/* -------------------------------------------------------------------------- */\ninterface DataListHeadProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListHead = React.forwardRef<HTMLDivElement, DataListHeadProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div ref={ref} className={cn('', className)} {...props}>\n {children}\n </div>\n );\n },\n);\n\nDataListHead.displayName = 'DataListHead';\n\n/* Body\n/* -------------------------------------------------------------------------- */\ninterface DataListBodyProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListBody = React.forwardRef<HTMLDivElement, DataListBodyProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div ref={ref} className={cn('flex flex-col items-stretch pt-1.5', className)} {...props}>\n {children}\n </div>\n );\n },\n);\n\nDataListBody.displayName = 'DataListBody';\n\n/* Data row\n/* -------------------------------------------------------------------------- */\ninterface DataListRowProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListRow = React.forwardRef<HTMLDivElement, DataListRowProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'group/row relative flex items-center justify-between gap-3 py-0.5 before:absolute before:-inset-x-0.5 before:inset-y-0.5 before:z-0 before:rounded-control before:bg-muted/60 before:opacity-0 hover:before:opacity-100',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListRow.displayName = 'DataListRow';\n\n/* Bar\n/* -------------------------------------------------------------------------- */\ninterface DataListBarProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListBar = React.forwardRef<HTMLDivElement, DataListBarProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'absolute inset-x-0 inset-y-1 z-0 origin-left rounded-[4px] bg-state-info/10 transition-all group-hover/row:bg-state-info/25 dark:bg-state-info/20 dark:group-hover/row:bg-state-info/35',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListBar.displayName = 'DataListBar';\n\n/* List item content\n/* -------------------------------------------------------------------------- */\ninterface DataListItemContentProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemContent = React.forwardRef<HTMLDivElement, DataListItemContentProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'relative z-10 flex max-w-[calc(100%-32px)] min-w-0 items-center p-2 text-sm font-medium transition-[max-width] duration-300 ease-in-out group-hover/datalist:max-w-[calc(100%-100px)]',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemContent.displayName = 'DataListItemContent';\n\n/* Value\n/* -------------------------------------------------------------------------- */\ninterface DataListItemValueProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemValue = React.forwardRef<HTMLDivElement, DataListItemValueProps>(\n ({ children, className, ...props }, ref) => {\n // Apply animation styles when there are multiple children\n const childrenArray = React.Children.toArray(children);\n const hasMultipleChildren = childrenArray.length > 1;\n\n return (\n <div\n ref={ref}\n className={cn(\n 'z-10 flex items-center',\n // Apply animation styles when there are multiple children\n hasMultipleChildren &&\n '[&>[data-type=\"value-abs\"]]:transition-transform [&>[data-type=\"value-abs\"]]:duration-300 [&>[data-type=\"value-abs\"]]:group-hover/datalist:-translate-x-14',\n hasMultipleChildren &&\n '[&>[data-type=\"value-perc\"]]:invisible [&>[data-type=\"value-perc\"]]:absolute [&>[data-type=\"value-perc\"]]:right-0 [&>[data-type=\"value-perc\"]]:translate-x-14 [&>[data-type=\"value-perc\"]]:opacity-0 [&>[data-type=\"value-perc\"]]:transition-all [&>[data-type=\"value-perc\"]]:duration-300 [&>[data-type=\"value-perc\"]]:group-hover/datalist:visible [&>[data-type=\"value-perc\"]]:group-hover/datalist:translate-x-0 [&>[data-type=\"value-perc\"]]:group-hover/datalist:opacity-100',\n className,\n )}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemValue.displayName = 'DataListItemValue';\n\n/* Value absolute value, e.g. 996.178.341\n/* -------------------------------------------------------------------------- */\ninterface DataListItemValueAbsProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemValueAbs = React.forwardRef<HTMLDivElement, DataListItemValueAbsProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn('z-10 px-2 font-mono text-sm', className)}\n data-type=\"value-abs\"\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemValueAbs.displayName = 'DataListItemValueAbs';\n\n/* Value percentage value, e.g. 85%\n/* -------------------------------------------------------------------------- */\ninterface DataListItemValuePercProps extends React.HTMLAttributes<HTMLDivElement> {\n children?: React.ReactNode;\n className?: string;\n}\n\nconst DataListItemValuePerc = React.forwardRef<HTMLDivElement, DataListItemValuePercProps>(\n ({ children, className, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn('px-3 font-mono text-sm text-muted-foreground', className)}\n data-type=\"value-perc\"\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nDataListItemValuePerc.displayName = 'DataListItemValuePerc';\n\n/* End of components\n/* -------------------------------------------------------------------------- */\nexport {\n DataList,\n DataListHeader,\n DataListHead,\n DataListBody,\n DataListRow,\n DataListBar,\n DataListItemContent,\n DataListItemValue,\n DataListItemValueAbs,\n DataListItemValuePerc,\n};\n"],"mappings":";;;;AAUA,IAAM,WAAW,MAAM,YACpB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EAAU;EAAK,WAAW,GAAG,+BAA+B,SAAS;EAAG,GAAI;EACzE;CACE,CAAA;AAET,CACF;AAEA,SAAS,cAAc;AASvB,IAAM,iBAAiB,MAAM,YAC1B,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,uIACA,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,eAAe,cAAc;AAS7B,IAAM,eAAe,MAAM,YACxB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EAAU;EAAK,WAAW,GAAG,IAAI,SAAS;EAAG,GAAI;EAC9C;CACE,CAAA;AAET,CACF;AAEA,aAAa,cAAc;AAS3B,IAAM,eAAe,MAAM,YACxB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EAAU;EAAK,WAAW,GAAG,sCAAsC,SAAS;EAAG,GAAI;EAChF;CACE,CAAA;AAET,CACF;AAEA,aAAa,cAAc;AAS3B,IAAM,cAAc,MAAM,YACvB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,2NACA,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,YAAY,cAAc;AAS1B,IAAM,cAAc,MAAM,YACvB,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,2LACA,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,YAAY,cAAc;AAS1B,IAAM,sBAAsB,MAAM,YAC/B,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,yLACA,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,oBAAoB,cAAc;AASlC,IAAM,oBAAoB,MAAM,YAC7B,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAG1C,MAAM,sBADgB,MAAM,SAAS,QAAQ,QACjB,CAAA,CAAc,SAAS;CAEnD,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GACT,0BAEA,uBACE,oKACF,uBACE,0eACF,SACF;EACA,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,kBAAkB,cAAc;AAShC,IAAM,uBAAuB,MAAM,YAChC,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GAAG,+BAA+B,SAAS;EACtD,aAAU;EACV,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,qBAAqB,cAAc;AASnC,IAAM,wBAAwB,MAAM,YACjC,EAAE,UAAU,WAAW,GAAG,SAAS,QAAQ;CAC1C,OACE,oBAAC,OAAD;EACO;EACL,WAAW,GAAG,gDAAgD,SAAS;EACvE,aAAU;EACV,GAAI;EAEH;CACE,CAAA;AAET,CACF;AAEA,sBAAsB,cAAc"}
|
|
@@ -1,25 +1,49 @@
|
|
|
1
1
|
import { cn } from "../../lib/ds-utils.js";
|
|
2
2
|
import { ShadeScope } from "../../shade-scope.js";
|
|
3
3
|
import * as React$1 from "react";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
6
6
|
//#region src/components/ui/dialog.tsx
|
|
7
|
-
var
|
|
7
|
+
var DialogModalContext = React$1.createContext(true);
|
|
8
|
+
var Dialog = ({ modal = true, ...props }) => /* @__PURE__ */ jsx(DialogModalContext.Provider, {
|
|
9
|
+
value: modal,
|
|
10
|
+
children: /* @__PURE__ */ jsx(DialogPrimitive.Root, {
|
|
11
|
+
modal,
|
|
12
|
+
...props
|
|
13
|
+
})
|
|
14
|
+
});
|
|
8
15
|
var DialogTrigger = DialogPrimitive.Trigger;
|
|
9
16
|
var DialogPortal = DialogPrimitive.Portal;
|
|
10
17
|
var DialogClose = DialogPrimitive.Close;
|
|
11
18
|
var DialogOverlay = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Overlay, {
|
|
12
19
|
ref,
|
|
13
20
|
className: cn("fixed inset-0 z-50 transform-gpu bg-black/30 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0 dark:bg-black/60", className),
|
|
21
|
+
"data-slot": "dialog-overlay",
|
|
14
22
|
...props
|
|
15
23
|
}));
|
|
16
24
|
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
var dialogPanelClassName = "z-50 grid w-full max-w-lg transform-gpu gap-6 bg-surface-elevated-2 p-6 shadow-lg [--sticky-footer-background:var(--surface-elevated-2)] outline-hidden duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95";
|
|
26
|
+
var DialogContent = React$1.forwardRef(({ className, children, scroll = "fixed", ...props }, ref) => {
|
|
27
|
+
const modal = React$1.useContext(DialogModalContext);
|
|
28
|
+
const panel = /* @__PURE__ */ jsx(DialogPrimitive.Content, {
|
|
29
|
+
ref,
|
|
30
|
+
className: cn(scroll === "overlay" ? "pointer-events-auto relative rounded-lg" : "fixed top-[8vmin] left-[50%] translate-x-[-50%] sm:rounded-lg", dialogPanelClassName, className),
|
|
31
|
+
...props,
|
|
32
|
+
children
|
|
33
|
+
});
|
|
34
|
+
const scrollingPanel = /* @__PURE__ */ jsx("div", {
|
|
35
|
+
className: "flex min-h-full items-start justify-center px-4 py-[8vmin]",
|
|
36
|
+
children: panel
|
|
37
|
+
});
|
|
38
|
+
return /* @__PURE__ */ jsx(DialogPortal, { children: /* @__PURE__ */ jsx(ShadeScope, { children: scroll === "overlay" ? modal ? /* @__PURE__ */ jsx(DialogOverlay, {
|
|
39
|
+
className: "overflow-y-auto duration-200",
|
|
40
|
+
children: scrollingPanel
|
|
41
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
42
|
+
className: "pointer-events-none fixed inset-0 z-50 overflow-y-auto",
|
|
43
|
+
"data-slot": "dialog-scroller",
|
|
44
|
+
children: scrollingPanel
|
|
45
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(DialogOverlay, {}), panel] }) }) });
|
|
46
|
+
});
|
|
23
47
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
24
48
|
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
25
49
|
className: cn("flex flex-col gap-y-1.5 text-center sm:text-left", className),
|
|
@@ -27,13 +51,13 @@ var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
|
27
51
|
});
|
|
28
52
|
DialogHeader.displayName = "DialogHeader";
|
|
29
53
|
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
30
|
-
className: cn("flex flex-col-reverse sm:flex-row sm:items-end sm:justify-end sm:gap-2
|
|
54
|
+
className: cn("flex flex-col-reverse sm:flex-row sm:items-end sm:justify-end sm:gap-2", className),
|
|
31
55
|
...props
|
|
32
56
|
});
|
|
33
57
|
DialogFooter.displayName = "DialogFooter";
|
|
34
58
|
var DialogTitle = React$1.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(DialogPrimitive.Title, {
|
|
35
59
|
ref,
|
|
36
|
-
className: cn("text-xl leading-none font-semibold tracking-tight", className),
|
|
60
|
+
className: cn("text-xl leading-none font-semibold tracking-tight in-data-[admin7-design=true]:font-title", className),
|
|
37
61
|
...props
|
|
38
62
|
}));
|
|
39
63
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","names":[],"sources":["../../../src/components/ui/dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\n\nimport { cn } from '@/lib/utils';\nimport { ShadeScope } from '@/shade-scope';\n\nconst Dialog = DialogPrimitive.Root;\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'fixed inset-0 z-50 transform-gpu bg-black/30 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0 dark:bg-black/60',\n className,\n )}\n {...props}\n />\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\
|
|
1
|
+
{"version":3,"file":"dialog.js","names":[],"sources":["../../../src/components/ui/dialog.tsx"],"sourcesContent":["import * as React from 'react';\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\n\nimport { cn } from '@/lib/utils';\nimport { ShadeScope } from '@/shade-scope';\n\n// Radix keeps whether a dialog is modal to itself, and the overlay scroll layout needs to know.\nconst DialogModalContext = React.createContext(true);\n\nconst Dialog = ({ modal = true, ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) => (\n <DialogModalContext.Provider value={modal}>\n <DialogPrimitive.Root modal={modal} {...props} />\n </DialogModalContext.Provider>\n);\n\nconst DialogTrigger = DialogPrimitive.Trigger;\n\nconst DialogPortal = DialogPrimitive.Portal;\n\nconst DialogClose = DialogPrimitive.Close;\n\nconst DialogOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'fixed inset-0 z-50 transform-gpu bg-black/30 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0 dark:bg-black/60',\n className,\n )}\n data-slot=\"dialog-overlay\"\n {...props}\n />\n));\nDialogOverlay.displayName = DialogPrimitive.Overlay.displayName;\n\n// The panel itself, shared by both ways a dialog can sit on the page.\nconst dialogPanelClassName =\n 'z-50 grid w-full max-w-lg transform-gpu gap-6 bg-surface-elevated-2 p-6 shadow-lg [--sticky-footer-background:var(--surface-elevated-2)] outline-hidden duration-200 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95';\n\nexport interface DialogContentProps extends React.ComponentPropsWithoutRef<\n typeof DialogPrimitive.Content\n> {\n /**\n * How a dialog taller than the window scrolls. `fixed` (the default) pins the dialog near\n * the top of the window, so it needs its own height limit and inner scroll. `overlay` makes\n * the backdrop the scroll container instead: the whole dialog scrolls as one piece, the way\n * a page does.\n */\n scroll?: 'fixed' | 'overlay';\n}\n\nconst DialogContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n DialogContentProps\n>(({ className, children, scroll = 'fixed', ...props }, ref) => {\n const modal = React.useContext(DialogModalContext);\n\n const panel = (\n <DialogPrimitive.Content\n ref={ref}\n className={cn(\n scroll === 'overlay'\n ? 'pointer-events-auto relative rounded-lg'\n : 'fixed top-[8vmin] left-[50%] translate-x-[-50%] sm:rounded-lg',\n dialogPanelClassName,\n className,\n )}\n {...props}\n >\n {children}\n </DialogPrimitive.Content>\n );\n\n // The space around the dialog is padding on this wrapper, not on the scroll container:\n // browsers leave a scroll container's own bottom padding out of what it scrolls, which\n // would leave the dialog flush with the bottom of the window.\n const scrollingPanel = (\n <div className=\"flex min-h-full items-start justify-center px-4 py-[8vmin]\">{panel}</div>\n );\n\n return (\n <DialogPortal>\n <ShadeScope>\n {scroll === 'overlay' ? (\n modal ? (\n // The dialog sits inside the backdrop here, so the backdrop animates as long as the\n // dialog does; otherwise closing unmounts the dialog part-way through its animation.\n <DialogOverlay className=\"overflow-y-auto duration-200\">{scrollingPanel}</DialogOverlay>\n ) : (\n // Radix renders no backdrop for a non-modal dialog, and the page behind stays\n // usable, so this scroll container lets presses beside the dialog through.\n <div\n className=\"pointer-events-none fixed inset-0 z-50 overflow-y-auto\"\n data-slot=\"dialog-scroller\"\n >\n {scrollingPanel}\n </div>\n )\n ) : (\n <>\n <DialogOverlay />\n {panel}\n </>\n )}\n </ShadeScope>\n </DialogPortal>\n );\n});\nDialogContent.displayName = DialogPrimitive.Content.displayName;\n\nconst DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div className={cn('flex flex-col gap-y-1.5 text-center sm:text-left', className)} {...props} />\n);\nDialogHeader.displayName = 'DialogHeader';\n\nconst DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (\n <div\n className={cn(\n 'flex flex-col-reverse sm:flex-row sm:items-end sm:justify-end sm:gap-2',\n className,\n )}\n {...props}\n />\n);\nDialogFooter.displayName = 'DialogFooter';\n\nconst DialogTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn(\n 'text-xl leading-none font-semibold tracking-tight in-data-[admin7-design=true]:font-title',\n className,\n )}\n {...props}\n />\n));\nDialogTitle.displayName = DialogPrimitive.Title.displayName;\n\nconst DialogDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn('text-muted-foreground', className)}\n {...props}\n />\n));\nDialogDescription.displayName = DialogPrimitive.Description.displayName;\n\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogTrigger,\n DialogClose,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n};\n"],"mappings":";;;;;;AAOA,IAAM,qBAAqB,QAAM,cAAc,IAAI;AAEnD,IAAM,UAAU,EAAE,QAAQ,MAAM,GAAG,YACjC,oBAAC,mBAAmB,UAApB;CAA6B,OAAO;WAClC,oBAAC,gBAAgB,MAAjB;EAA6B;EAAO,GAAI;CAAQ,CAAA;AACrB,CAAA;AAG/B,IAAM,gBAAgB,gBAAgB;AAEtC,IAAM,eAAe,gBAAgB;AAErC,IAAM,cAAc,gBAAgB;AAEpC,IAAM,gBAAgB,QAAM,YAGzB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,gBAAgB,SAAjB;CACO;CACL,WAAW,GACT,yLACA,SACF;CACA,aAAU;CACV,GAAI;AACL,CAAA,CACF;AACD,cAAc,cAAc,gBAAgB,QAAQ;AAGpD,IAAM,uBACJ;AAcF,IAAM,gBAAgB,QAAM,YAGzB,EAAE,WAAW,UAAU,SAAS,SAAS,GAAG,SAAS,QAAQ;CAC9D,MAAM,QAAQ,QAAM,WAAW,kBAAkB;CAEjD,MAAM,QACJ,oBAAC,gBAAgB,SAAjB;EACO;EACL,WAAW,GACT,WAAW,YACP,4CACA,iEACJ,sBACA,SACF;EACA,GAAI;EAEH;CACsB,CAAA;CAM3B,MAAM,iBACJ,oBAAC,OAAD;EAAK,WAAU;YAA8D;CAAW,CAAA;CAG1F,OACE,oBAAC,cAAD,EAAA,UACE,oBAAC,YAAD,EAAA,UACG,WAAW,YACV,QAGE,oBAAC,eAAD;EAAe,WAAU;YAAgC;CAA8B,CAAA,IAIvF,oBAAC,OAAD;EACE,WAAU;EACV,aAAU;YAET;CACE,CAAA,IAGP,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,eAAD,CAAgB,CAAA,GACf,KACD,EAAA,CAAA,EAEM,CAAA,EACA,CAAA;AAElB,CAAC;AACD,cAAc,cAAc,gBAAgB,QAAQ;AAEpD,IAAM,gBAAgB,EAAE,WAAW,GAAG,YACpC,oBAAC,OAAD;CAAK,WAAW,GAAG,oDAAoD,SAAS;CAAG,GAAI;AAAQ,CAAA;AAEjG,aAAa,cAAc;AAE3B,IAAM,gBAAgB,EAAE,WAAW,GAAG,YACpC,oBAAC,OAAD;CACE,WAAW,GACT,0EACA,SACF;CACA,GAAI;AACL,CAAA;AAEH,aAAa,cAAc;AAE3B,IAAM,cAAc,QAAM,YAGvB,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,gBAAgB,OAAjB;CACO;CACL,WAAW,GACT,6FACA,SACF;CACA,GAAI;AACL,CAAA,CACF;AACD,YAAY,cAAc,gBAAgB,MAAM;AAEhD,IAAM,oBAAoB,QAAM,YAG7B,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAAC,gBAAgB,aAAjB;CACO;CACL,WAAW,GAAG,yBAAyB,SAAS;CAChD,GAAI;AACL,CAAA,CACF;AACD,kBAAkB,cAAc,gBAAgB,YAAY"}
|
|
@@ -4,21 +4,37 @@ import { inputSurface } from "./input-surface.js";
|
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
5
|
//#region src/components/ui/dropzone-variants.ts
|
|
6
6
|
var dropzoneBaseVariants = cva("flex cursor-pointer flex-col items-center justify-center outline-hidden", {
|
|
7
|
-
variants: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
default: cn(inputSurface("self"), "border-2 border-dashed bg-transparent p-10 hover:border-border-strong"),
|
|
10
|
+
filled: cn(inputSurface("self"), "border-transparent bg-muted p-3 hover:bg-interactive-hover"),
|
|
11
|
+
button: "flex-row",
|
|
12
|
+
buttonSecondary: "flex-row"
|
|
13
|
+
},
|
|
14
|
+
admin7Design: {
|
|
15
|
+
true: "",
|
|
16
|
+
false: ""
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
compoundVariants: [{
|
|
20
|
+
variant: ["default", "filled"],
|
|
21
|
+
admin7Design: true,
|
|
22
|
+
className: "text-muted-foreground [&_svg.lucide]:stroke-[1.25px]"
|
|
23
|
+
}, {
|
|
24
|
+
variant: "default",
|
|
25
|
+
admin7Design: true,
|
|
26
|
+
className: "border"
|
|
27
|
+
}],
|
|
13
28
|
defaultVariants: { variant: "default" }
|
|
14
29
|
});
|
|
15
|
-
function dropzoneVariants(props = {},
|
|
16
|
-
return cn(dropzoneBaseVariants(
|
|
17
|
-
|
|
30
|
+
function dropzoneVariants(props = {}, shape = "pill", admin7Design = true) {
|
|
31
|
+
return cn(dropzoneBaseVariants({
|
|
32
|
+
variant: props.variant,
|
|
33
|
+
admin7Design
|
|
34
|
+
}), props.class, props.variant === "button" && buttonVariants({
|
|
18
35
|
shape,
|
|
19
36
|
variant: "outline"
|
|
20
37
|
}), props.variant === "buttonSecondary" && buttonVariants({
|
|
21
|
-
isAdmin7,
|
|
22
38
|
shape,
|
|
23
39
|
size: "sm",
|
|
24
40
|
variant: "secondary"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropzone-variants.js","names":[],"sources":["../../../src/components/ui/dropzone-variants.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\nimport { buttonVariants } from '@/components/ui/button-variants';\nimport { inputSurface } from '@/components/ui/input-surface';\nimport { cn } from '@/lib/utils';\nimport type { ControlShape } from '@/providers/shade-context';\n\nconst dropzoneBaseVariants = cva(\n 'flex cursor-pointer flex-col items-center justify-center outline-hidden',\n {\n variants: {\n variant: {\n default: cn(\n inputSurface('self'),\n 'border-2 border-dashed bg-transparent p-10 hover:border-border-strong',\n ),\n filled: cn(\n inputSurface('self'),\n 'border-transparent bg-muted p-3 hover:bg-interactive-hover',\n ),\n button: 'flex-row',\n buttonSecondary: 'flex-row',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n);\n\n// Keep the exported variants function useful outside the component, with current defaults.\nfunction dropzoneVariants(\n props: Parameters<typeof dropzoneBaseVariants>[0] = {},\n
|
|
1
|
+
{"version":3,"file":"dropzone-variants.js","names":[],"sources":["../../../src/components/ui/dropzone-variants.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\nimport { buttonVariants } from '@/components/ui/button-variants';\nimport { inputSurface } from '@/components/ui/input-surface';\nimport { cn } from '@/lib/utils';\nimport type { ControlShape } from '@/providers/shade-context';\n\nconst dropzoneBaseVariants = cva(\n 'flex cursor-pointer flex-col items-center justify-center outline-hidden',\n {\n variants: {\n variant: {\n default: cn(\n inputSurface('self'),\n 'border-2 border-dashed bg-transparent p-10 hover:border-border-strong',\n ),\n filled: cn(\n inputSurface('self'),\n 'border-transparent bg-muted p-3 hover:bg-interactive-hover',\n ),\n button: 'flex-row',\n buttonSecondary: 'flex-row',\n },\n admin7Design: {\n true: '',\n false: '',\n },\n },\n compoundVariants: [\n {\n variant: ['default', 'filled'],\n admin7Design: true,\n className: 'text-muted-foreground [&_svg.lucide]:stroke-[1.25px]',\n },\n { variant: 'default', admin7Design: true, className: 'border' },\n ],\n defaultVariants: {\n variant: 'default',\n },\n },\n);\n\n// Keep the exported variants function useful outside the component, with current defaults.\nfunction dropzoneVariants(\n props: Omit<NonNullable<Parameters<typeof dropzoneBaseVariants>[0]>, 'admin7Design'> = {},\n shape: ControlShape = 'pill',\n admin7Design = true,\n) {\n return cn(\n dropzoneBaseVariants({ variant: props.variant, admin7Design }),\n props.class,\n props.variant === 'button' && buttonVariants({ shape, variant: 'outline' }),\n props.variant === 'buttonSecondary' &&\n buttonVariants({ shape, size: 'sm', variant: 'secondary' }),\n props.className,\n );\n}\n\nexport { dropzoneVariants };\n"],"mappings":";;;;;AAMA,IAAM,uBAAuB,IAC3B,2EACA;CACE,UAAU;EACR,SAAS;GACP,SAAS,GACP,aAAa,MAAM,GACnB,uEACF;GACA,QAAQ,GACN,aAAa,MAAM,GACnB,4DACF;GACA,QAAQ;GACR,iBAAiB;EACnB;EACA,cAAc;GACZ,MAAM;GACN,OAAO;EACT;CACF;CACA,kBAAkB,CAChB;EACE,SAAS,CAAC,WAAW,QAAQ;EAC7B,cAAc;EACd,WAAW;CACb,GACA;EAAE,SAAS;EAAW,cAAc;EAAM,WAAW;CAAS,CAChE;CACA,iBAAiB,EACf,SAAS,UACX;AACF,CACF;AAGA,SAAS,iBACP,QAAuF,CAAC,GACxF,QAAsB,QACtB,eAAe,MACf;CACA,OAAO,GACL,qBAAqB;EAAE,SAAS,MAAM;EAAS;CAAa,CAAC,GAC7D,MAAM,OACN,MAAM,YAAY,YAAY,eAAe;EAAE;EAAO,SAAS;CAAU,CAAC,GAC1E,MAAM,YAAY,qBAChB,eAAe;EAAE;EAAO,MAAM;EAAM,SAAS;CAAY,CAAC,GAC5D,MAAM,SACR;AACF"}
|
|
@@ -6,7 +6,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
import { useDropzone } from "react-dropzone";
|
|
7
7
|
//#region src/components/ui/dropzone.tsx
|
|
8
8
|
var Dropzone = React$1.forwardRef(({ accept, multiple = false, maxFiles = multiple ? 0 : 1, disabled = false, noDragEventsBubbling = false, inputId, inputAriaLabel, inputTestId, onDropAccepted, onDropRejected, variant, className, children, ...props }, ref) => {
|
|
9
|
-
const { controlShape,
|
|
9
|
+
const { controlShape, admin7Design } = useShade();
|
|
10
10
|
const { getRootProps, getInputProps, rootRef, isDragActive, isDragAccept, isDragReject, isFocused, isFileDialogActive, open } = useDropzone({
|
|
11
11
|
accept,
|
|
12
12
|
multiple,
|
|
@@ -35,7 +35,7 @@ var Dropzone = React$1.forwardRef(({ accept, multiple = false, maxFiles = multip
|
|
|
35
35
|
tabIndex: disabled ? -1 : 0,
|
|
36
36
|
"aria-disabled": disabled,
|
|
37
37
|
"aria-invalid": isDragReject || void 0,
|
|
38
|
-
className: cn(dropzoneVariants({ variant },
|
|
38
|
+
className: cn(dropzoneVariants({ variant }, controlShape, admin7Design), disabled && "pointer-events-none cursor-not-allowed opacity-60", isDragReject && "border-state-danger bg-state-danger/10", isDragActive && !isDragReject && !disabled && "border-state-success bg-state-success/10", className)
|
|
39
39
|
});
|
|
40
40
|
return /* @__PURE__ */ jsxs("div", {
|
|
41
41
|
ref: setRootRefs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropzone.js","names":[],"sources":["../../../src/components/ui/dropzone.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Accept, DropEvent, FileRejection, useDropzone } from 'react-dropzone';\nimport { type VariantProps } from 'class-variance-authority';\nimport { dropzoneVariants } from '@/components/ui/dropzone-variants';\nimport { useShade } from '@/providers/shade-context';\nimport { cn } from '@/lib/utils';\n\ntype DropzoneRenderProps = {\n isDragActive: boolean;\n isDragAccept: boolean;\n isDragReject: boolean;\n isFocused: boolean;\n isFileDialogActive: boolean;\n open: () => void;\n};\n\nexport interface DropzoneProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'children'>,\n VariantProps<typeof dropzoneVariants> {\n accept?: Accept;\n multiple?: boolean;\n maxFiles?: number;\n disabled?: boolean;\n noDragEventsBubbling?: boolean;\n inputId?: string;\n inputAriaLabel?: string;\n inputTestId?: string;\n onDropAccepted?: (files: File[], event: DropEvent) => void;\n onDropRejected?: (fileRejections: FileRejection[], event: DropEvent) => void;\n children?: React.ReactNode | ((props: DropzoneRenderProps) => React.ReactNode);\n}\n\nexport const Dropzone = React.forwardRef<HTMLDivElement, DropzoneProps>(\n (\n {\n accept,\n multiple = false,\n maxFiles = multiple ? 0 : 1,\n disabled = false,\n noDragEventsBubbling = false,\n inputId,\n inputAriaLabel,\n inputTestId,\n onDropAccepted,\n onDropRejected,\n variant,\n className,\n children,\n ...props\n },\n ref,\n ) => {\n const { controlShape,
|
|
1
|
+
{"version":3,"file":"dropzone.js","names":[],"sources":["../../../src/components/ui/dropzone.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Accept, DropEvent, FileRejection, useDropzone } from 'react-dropzone';\nimport { type VariantProps } from 'class-variance-authority';\nimport { dropzoneVariants } from '@/components/ui/dropzone-variants';\nimport { useShade } from '@/providers/shade-context';\nimport { cn } from '@/lib/utils';\n\ntype DropzoneRenderProps = {\n isDragActive: boolean;\n isDragAccept: boolean;\n isDragReject: boolean;\n isFocused: boolean;\n isFileDialogActive: boolean;\n open: () => void;\n};\n\nexport interface DropzoneProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'children'>,\n VariantProps<typeof dropzoneVariants> {\n accept?: Accept;\n multiple?: boolean;\n maxFiles?: number;\n disabled?: boolean;\n noDragEventsBubbling?: boolean;\n inputId?: string;\n inputAriaLabel?: string;\n inputTestId?: string;\n onDropAccepted?: (files: File[], event: DropEvent) => void;\n onDropRejected?: (fileRejections: FileRejection[], event: DropEvent) => void;\n children?: React.ReactNode | ((props: DropzoneRenderProps) => React.ReactNode);\n}\n\nexport const Dropzone = React.forwardRef<HTMLDivElement, DropzoneProps>(\n (\n {\n accept,\n multiple = false,\n maxFiles = multiple ? 0 : 1,\n disabled = false,\n noDragEventsBubbling = false,\n inputId,\n inputAriaLabel,\n inputTestId,\n onDropAccepted,\n onDropRejected,\n variant,\n className,\n children,\n ...props\n },\n ref,\n ) => {\n const { controlShape, admin7Design } = useShade();\n const {\n getRootProps,\n getInputProps,\n rootRef,\n isDragActive,\n isDragAccept,\n isDragReject,\n isFocused,\n isFileDialogActive,\n open,\n } = useDropzone({\n accept,\n multiple,\n maxFiles,\n disabled,\n noDragEventsBubbling,\n onDropAccepted,\n onDropRejected,\n });\n\n const content =\n typeof children === 'function'\n ? children({\n isDragActive,\n isDragAccept,\n isDragReject,\n isFocused,\n isFileDialogActive,\n open,\n })\n : children;\n\n const setRootRefs = (element: HTMLDivElement | null) => {\n (rootRef as React.MutableRefObject<HTMLDivElement | null>).current = element;\n\n if (typeof ref === 'function') {\n ref(element);\n } else if (ref) {\n ref.current = element;\n }\n };\n\n const dropzoneRootProps = getRootProps({\n ...props,\n role: 'button',\n tabIndex: disabled ? -1 : 0,\n 'aria-disabled': disabled,\n 'aria-invalid': isDragReject || undefined,\n className: cn(\n dropzoneVariants({ variant }, controlShape, admin7Design),\n disabled && 'pointer-events-none cursor-not-allowed opacity-60',\n isDragReject && 'border-state-danger bg-state-danger/10',\n isDragActive && !isDragReject && !disabled && 'border-state-success bg-state-success/10',\n className,\n ),\n }) as React.HTMLAttributes<HTMLDivElement> & { ref?: React.Ref<HTMLDivElement> };\n\n // Destructure out the ref from getRootProps — we use setRootRefs instead\n const { ref: _, ...rootProps } = dropzoneRootProps; // eslint-disable-line @typescript-eslint/no-unused-vars\n\n return (\n <div ref={setRootRefs} {...rootProps}>\n <input\n {...getInputProps()}\n aria-label={inputAriaLabel}\n data-testid={inputTestId}\n id={inputId}\n />\n {content}\n </div>\n );\n },\n);\n\nDropzone.displayName = 'Dropzone';\n"],"mappings":";;;;;;;AAiCA,IAAa,WAAW,QAAM,YAE1B,EACE,QACA,WAAW,OACX,WAAW,WAAW,IAAI,GAC1B,WAAW,OACX,uBAAuB,OACvB,SACA,gBACA,aACA,gBACA,gBACA,SACA,WACA,UACA,GAAG,SAEL,QACG;CACH,MAAM,EAAE,cAAc,iBAAiB,SAAS;CAChD,MAAM,EACJ,cACA,eACA,SACA,cACA,cACA,cACA,WACA,oBACA,SACE,YAAY;EACd;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC;CAED,MAAM,UACJ,OAAO,aAAa,aAChB,SAAS;EACP;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,IACD;CAEN,MAAM,eAAe,YAAmC;EACtD,QAA2D,UAAU;EAErE,IAAI,OAAO,QAAQ,YACjB,IAAI,OAAO;OACN,IAAI,KACT,IAAI,UAAU;CAElB;CAkBA,MAAM,EAAE,KAAK,GAAG,GAAG,cAhBO,aAAa;EACrC,GAAG;EACH,MAAM;EACN,UAAU,WAAW,KAAK;EAC1B,iBAAiB;EACjB,gBAAgB,gBAAgB,KAAA;EAChC,WAAW,GACT,iBAAiB,EAAE,QAAQ,GAAG,cAAc,YAAY,GACxD,YAAY,qDACZ,gBAAgB,0CAChB,gBAAgB,CAAC,gBAAgB,CAAC,YAAY,4CAC9C,SACF;CACF,CAGiC;CAEjC,OACE,qBAAC,OAAD;EAAK,KAAK;EAAa,GAAI;YAA3B,CACE,oBAAC,SAAD;GACE,GAAI,cAAc;GAClB,cAAY;GACZ,eAAa;GACb,IAAI;EACL,CAAA,GACA,OACE;;AAET,CACF;AAEA,SAAS,cAAc"}
|
|
@@ -27,16 +27,16 @@ function FieldGroup({ className, ...props }) {
|
|
|
27
27
|
...props
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
-
var fieldVariants = cva("group/field flex w-full gap-2
|
|
30
|
+
var fieldVariants = cva("group/field flex w-full gap-2", {
|
|
31
31
|
variants: { orientation: {
|
|
32
|
-
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
|
|
32
|
+
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto in-data-[admin7-mobile=true]:max-lg:[&>.sr-only]:w-px"],
|
|
33
33
|
horizontal: [
|
|
34
34
|
"flex-row items-center",
|
|
35
35
|
"[&>[data-slot=field-label]]:flex-auto",
|
|
36
36
|
"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
37
37
|
],
|
|
38
38
|
responsive: [
|
|
39
|
-
"flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto",
|
|
39
|
+
"flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto in-data-[admin7-mobile=true]:max-lg:[&>.sr-only]:w-px",
|
|
40
40
|
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
41
41
|
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
42
42
|
]
|
|
@@ -61,7 +61,7 @@ function FieldContent({ className, ...props }) {
|
|
|
61
61
|
}
|
|
62
62
|
function FieldLabel({ className, ...props }) {
|
|
63
63
|
return /* @__PURE__ */ jsx(Label, {
|
|
64
|
-
className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>[data-slot=field]]:p-4", "has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10", className),
|
|
64
|
+
className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 in-data-[admin7-design=true]:group-data-[orientation=vertical]/field:leading-none", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>[data-slot=field]]:p-4", "has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10", className),
|
|
65
65
|
"data-slot": "field-label",
|
|
66
66
|
...props
|
|
67
67
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","names":[],"sources":["../../../src/components/ui/field.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '@/lib/utils';\nimport { Label } from '@/components/ui/label';\nimport { Separator } from '@/components/ui/separator';\n\nfunction FieldSet({ className, ...props }: React.ComponentProps<'fieldset'>) {\n return (\n <fieldset\n className={cn(\n 'flex flex-col gap-6',\n 'has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3',\n className,\n )}\n data-slot=\"field-set\"\n {...props}\n />\n );\n}\n\nfunction FieldLegend({\n className,\n variant = 'legend',\n ...props\n}: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {\n return (\n <legend\n className={cn(\n 'm-0 mb-2 w-fit border-0 p-0 leading-snug font-medium text-foreground',\n 'data-[variant=legend]:text-base',\n 'data-[variant=label]:text-control',\n className,\n )}\n data-slot=\"field-legend\"\n data-variant={variant}\n {...props}\n />\n );\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n className={cn(\n 'group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4',\n className,\n )}\n data-slot=\"field-group\"\n {...props}\n />\n );\n}\n\nconst fieldVariants = cva('group/field flex w-full gap-2
|
|
1
|
+
{"version":3,"file":"field.js","names":[],"sources":["../../../src/components/ui/field.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '@/lib/utils';\nimport { Label } from '@/components/ui/label';\nimport { Separator } from '@/components/ui/separator';\n\nfunction FieldSet({ className, ...props }: React.ComponentProps<'fieldset'>) {\n return (\n <fieldset\n className={cn(\n 'flex flex-col gap-6',\n 'has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3',\n className,\n )}\n data-slot=\"field-set\"\n {...props}\n />\n );\n}\n\nfunction FieldLegend({\n className,\n variant = 'legend',\n ...props\n}: React.ComponentProps<'legend'> & { variant?: 'legend' | 'label' }) {\n return (\n <legend\n className={cn(\n 'm-0 mb-2 w-fit border-0 p-0 leading-snug font-medium text-foreground',\n 'data-[variant=legend]:text-base',\n 'data-[variant=label]:text-control',\n className,\n )}\n data-slot=\"field-legend\"\n data-variant={variant}\n {...props}\n />\n );\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n className={cn(\n 'group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4',\n className,\n )}\n data-slot=\"field-group\"\n {...props}\n />\n );\n}\n\n// Auto-width hidden labels can extend the scrollable area beyond narrow fields.\nconst fieldVariants = cva('group/field flex w-full gap-2', {\n variants: {\n orientation: {\n vertical: [\n 'flex-col [&>*]:w-full [&>.sr-only]:w-auto in-data-[admin7-mobile=true]:max-lg:[&>.sr-only]:w-px',\n ],\n horizontal: [\n 'flex-row items-center',\n '[&>[data-slot=field-label]]:flex-auto',\n 'has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n ],\n responsive: [\n 'flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto in-data-[admin7-mobile=true]:max-lg:[&>.sr-only]:w-px',\n '@md/field-group:[&>[data-slot=field-label]]:flex-auto',\n '@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px',\n ],\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n});\n\nfunction Field({\n className,\n orientation = 'vertical',\n ...props\n}: React.ComponentProps<'div'> & VariantProps<typeof fieldVariants>) {\n return (\n <div\n className={cn(fieldVariants({ orientation }), className)}\n data-orientation={orientation}\n data-slot=\"field\"\n role=\"group\"\n {...props}\n />\n );\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n className={cn('group/field-content flex flex-1 flex-col gap-0.5 leading-snug', className)}\n data-slot=\"field-content\"\n {...props}\n />\n );\n}\n\nfunction FieldLabel({ className, ...props }: React.ComponentProps<typeof Label>) {\n return (\n <Label\n className={cn(\n 'group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 in-data-[admin7-design=true]:group-data-[orientation=vertical]/field:leading-none',\n 'has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>[data-slot=field]]:p-4',\n 'has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10',\n className,\n )}\n data-slot=\"field-label\"\n {...props}\n />\n );\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n className={cn(\n 'flex w-fit items-center gap-2 text-control leading-snug font-medium group-data-[disabled=true]/field:opacity-50',\n className,\n )}\n data-slot=\"field-label\"\n {...props}\n />\n );\n}\n\nfunction FieldDescription({ className, ...props }: React.ComponentProps<'p'>) {\n return (\n <p\n className={cn(\n 'text-sm leading-normal font-normal text-muted-foreground group-has-[[data-orientation=horizontal]]/field:text-balance',\n 'last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5',\n '[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary',\n className,\n )}\n data-slot=\"field-description\"\n {...props}\n />\n );\n}\n\nfunction FieldSeparator({\n children,\n className,\n ...props\n}: React.ComponentProps<'div'> & {\n children?: React.ReactNode;\n}) {\n return (\n <div\n className={cn(\n 'relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2',\n className,\n )}\n data-content={!!children}\n data-slot=\"field-separator\"\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n className=\"relative mx-auto block w-fit bg-background px-2 text-muted-foreground\"\n data-slot=\"field-separator-content\"\n >\n {children}\n </span>\n )}\n </div>\n );\n}\n\nfunction FieldError({\n className,\n children,\n errors,\n ...props\n}: React.ComponentProps<'div'> & {\n errors?: Array<{ message?: string } | undefined>;\n}) {\n const content = useMemo(() => {\n if (children) {\n return children;\n }\n\n if (!errors) {\n return null;\n }\n\n if (errors?.length === 1 && errors[0]?.message) {\n return errors[0].message;\n }\n\n return (\n <ul className=\"ml-4 flex list-disc flex-col gap-1\">\n {errors.map((error) => error?.message && <li key={error.message}>{error.message}</li>)}\n </ul>\n );\n }, [children, errors]);\n\n if (!content) {\n return null;\n }\n\n return (\n <div\n className={cn('text-control font-normal text-destructive', className)}\n data-slot=\"field-error\"\n role=\"alert\"\n {...props}\n >\n {content}\n </div>\n );\n}\n\nexport {\n Field,\n FieldLabel,\n FieldDescription,\n FieldError,\n FieldGroup,\n FieldLegend,\n FieldSeparator,\n FieldSet,\n FieldContent,\n FieldTitle,\n};\n"],"mappings":";;;;;;;AAOA,SAAS,SAAS,EAAE,WAAW,GAAG,SAA2C;CAC3E,OACE,oBAAC,YAAD;EACE,WAAW,GACT,uBACA,gFACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EACnB,WACA,UAAU,UACV,GAAG,SACiE;CACpE,OACE,oBAAC,UAAD;EACE,WAAW,GACT,wEACA,mCACA,qCACA,SACF;EACA,aAAU;EACV,gBAAc;EACd,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,oBAAC,OAAD;EACE,WAAW,GACT,0IACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAGA,IAAM,gBAAgB,IAAI,iCAAiC;CACzD,UAAU,EACR,aAAa;EACX,UAAU,CACR,iGACF;EACA,YAAY;GACV;GACA;GACA;EACF;EACA,YAAY;GACV;GACA;GACA;EACF;CACF,EACF;CACA,iBAAiB,EACf,aAAa,WACf;AACF,CAAC;AAED,SAAS,MAAM,EACb,WACA,cAAc,YACd,GAAG,SACgE;CACnE,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,cAAc,EAAE,YAAY,CAAC,GAAG,SAAS;EACvD,oBAAkB;EAClB,aAAU;EACV,MAAK;EACL,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EAAE,WAAW,GAAG,SAAsC;CAC1E,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,iEAAiE,SAAS;EACxF,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAA6C;CAC/E,OACE,oBAAC,OAAD;EACE,WAAW,GACT,kMACA,mKACA,6HACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,oBAAC,OAAD;EACE,WAAW,GACT,mHACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAoC;CAC5E,OACE,oBAAC,KAAD;EACE,WAAW,GACT,yHACA,gEACA,qEACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,eAAe,EACtB,UACA,WACA,GAAG,SAGF;CACD,OACE,qBAAC,OAAD;EACE,WAAW,GACT,6EACA,SACF;EACA,gBAAc,CAAC,CAAC;EAChB,aAAU;EACV,GAAI;YAPN,CASE,oBAAC,WAAD,EAAW,WAAU,2BAA4B,CAAA,GAChD,YACC,oBAAC,QAAD;GACE,WAAU;GACV,aAAU;GAET;EACG,CAAA,CAEL;;AAET;AAEA,SAAS,WAAW,EAClB,WACA,UACA,QACA,GAAG,SAGF;CACD,MAAM,UAAU,cAAc;EAC5B,IAAI,UACF,OAAO;EAGT,IAAI,CAAC,QACH,OAAO;EAGT,IAAI,QAAQ,WAAW,KAAK,OAAO,EAAE,EAAE,SACrC,OAAO,OAAO,EAAE,CAAC;EAGnB,OACE,oBAAC,MAAD;GAAI,WAAU;aACX,OAAO,KAAK,UAAU,OAAO,WAAW,oBAAC,MAAD,EAAA,UAAyB,MAAM,QAAY,GAAlC,MAAM,OAA4B,CAAC;EACnF,CAAA;CAER,GAAG,CAAC,UAAU,MAAM,CAAC;CAErB,IAAI,CAAC,SACH,OAAO;CAGT,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,6CAA6C,SAAS;EACpE,aAAU;EACV,MAAK;EACL,GAAI;YAEH;CACE,CAAA;AAET"}
|