@langchain/macaw-components 1.0.0-beta.0 → 1.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{LoadingIndicator-DgtU9aqD.js → LoadingIndicator-CDcArsiM.js} +13 -12
- package/dist/_chunks/LoadingIndicator-CDcArsiM.js.map +1 -0
- package/dist/_chunks/render-attachment-icon-BWBEMxXZ.js +270 -0
- package/dist/_chunks/render-attachment-icon-BWBEMxXZ.js.map +1 -0
- package/dist/catalog.json +527 -408
- package/dist/components/Attachment/Attachment.d.ts +21 -0
- package/dist/components/Attachment/Attachment.js +165 -0
- package/dist/components/Attachment/Attachment.js.map +1 -0
- package/dist/components/Attachment/AttachmentList.d.ts +5 -0
- package/dist/components/Attachment/AttachmentList.js +32 -0
- package/dist/components/Attachment/AttachmentList.js.map +1 -0
- package/dist/components/Attachment/index.d.ts +4 -0
- package/dist/components/Attachment/index.js +3 -0
- package/dist/components/Attachment/render-attachment-icon.d.ts +3 -0
- package/dist/components/Attachment/render-attachment-icon.js +2 -0
- package/dist/components/Avatar/Avatar.js +2 -2
- package/dist/components/Badge/Badge.d.ts +2 -0
- package/dist/components/Badge/Badge.js +12 -1
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Banner/Banner.js +1 -1
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/constants.js +2 -2
- package/dist/components/Button/constants.js.map +1 -1
- package/dist/components/ChartCard/ChartCard.d.ts +1 -4
- package/dist/components/ChartCard/ChartCard.js +2 -2
- package/dist/components/ChartCard/ChartCard.js.map +1 -1
- package/dist/components/ChartCard/ChartCardSkeleton.d.ts +1 -1
- package/dist/components/ChartCard/ChartCardSkeleton.js +37 -0
- package/dist/components/ChartCard/ChartCardSkeleton.js.map +1 -1
- package/dist/components/ChartLegend/ChartLegend.js +2 -2
- package/dist/components/ChartLegend/ChartLegendItemRenderer.js +2 -2
- package/dist/components/ChartLegend/ChartLegendItemRenderer.js.map +1 -1
- package/dist/components/Code/Code.utils.d.ts +3 -2
- package/dist/components/Code/Code.utils.js +7 -3
- package/dist/components/Code/Code.utils.js.map +1 -1
- package/dist/components/Code/CodeLanguageSelect.d.ts +7 -0
- package/dist/components/Code/CodeLanguageSelect.js +29 -0
- package/dist/components/Code/CodeLanguageSelect.js.map +1 -0
- package/dist/components/Code/CodeLite.js +3 -0
- package/dist/components/Code/CodeLite.js.map +1 -1
- package/dist/components/Code/CodeToolbar.d.ts +7 -0
- package/dist/components/Code/CodeToolbar.js +19 -0
- package/dist/components/Code/CodeToolbar.js.map +1 -0
- package/dist/components/Code/codeLanguages.d.ts +7 -0
- package/dist/components/Code/codeLanguages.js +59 -0
- package/dist/components/Code/codeLanguages.js.map +1 -0
- package/dist/components/Code/index.d.ts +15 -2
- package/dist/components/Code/index.js +70 -50
- package/dist/components/Code/index.js.map +1 -1
- package/dist/components/Code/types.d.ts +1 -1
- package/dist/components/Command/Command.d.ts +10 -13
- package/dist/components/Command/Command.js +7 -2
- package/dist/components/Command/Command.js.map +1 -1
- package/dist/components/Command/CommandMenu.d.ts +7 -1
- package/dist/components/Command/CommandMenu.js +17 -9
- package/dist/components/Command/CommandMenu.js.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.d.ts +6 -0
- package/dist/components/ContextMenu/ContextMenu.js +3 -2
- package/dist/components/ContextMenu/ContextMenu.js.map +1 -1
- package/dist/components/CopyButton/CopyButton.js +2 -2
- package/dist/components/Dialog/index.js +2 -2
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +11 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +5 -4
- package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/components/ErrorMessage/ErrorMessage.js +1 -1
- package/dist/components/GroupedTabs/GroupedTabs.d.ts +5 -2
- package/dist/components/GroupedTabs/GroupedTabs.js +33 -26
- package/dist/components/GroupedTabs/GroupedTabs.js.map +1 -1
- package/dist/components/IconButton/IconButton.js +2 -2
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/LineChart/LineChart.d.ts +2 -2
- package/dist/components/LineChart/LineChart.js +3 -1
- package/dist/components/LineChart/LineChart.js.map +1 -1
- package/dist/components/LineChart/LineChart.types.d.ts +16 -0
- package/dist/components/LineChart/LineChartPlot.d.ts +3 -2
- package/dist/components/LineChart/LineChartPlot.js +8 -1
- package/dist/components/LineChart/LineChartPlot.js.map +1 -1
- package/dist/components/LineChart/LineChartVerticalMarkers.d.ts +8 -0
- package/dist/components/LineChart/LineChartVerticalMarkers.js +47 -0
- package/dist/components/LineChart/LineChartVerticalMarkers.js.map +1 -0
- package/dist/components/LineChart/index.d.ts +1 -1
- package/dist/components/Logo/index.js +11 -6
- package/dist/components/Logo/index.js.map +1 -1
- package/dist/components/MetricChart/MetricChart.d.ts +2 -0
- package/dist/components/MetricChart/MetricChart.js +15 -4
- package/dist/components/MetricChart/MetricChart.js.map +1 -1
- package/dist/components/MetricChart/formatters.js +15 -2
- package/dist/components/MetricChart/formatters.js.map +1 -1
- package/dist/components/MetricChart/index.d.ts +1 -1
- package/dist/components/Pane/Pane.js +2 -2
- package/dist/components/SankeyChart/AnimatedSankeyLink.d.ts +17 -0
- package/dist/components/SankeyChart/AnimatedSankeyLink.js +44 -0
- package/dist/components/SankeyChart/AnimatedSankeyLink.js.map +1 -0
- package/dist/components/SankeyChart/AnimatedSankeyNode.d.ts +16 -0
- package/dist/components/SankeyChart/AnimatedSankeyNode.js +42 -0
- package/dist/components/SankeyChart/AnimatedSankeyNode.js.map +1 -0
- package/dist/components/SankeyChart/SankeyChart.d.ts +42 -0
- package/dist/components/SankeyChart/SankeyChart.js +185 -0
- package/dist/components/SankeyChart/SankeyChart.js.map +1 -0
- package/dist/components/SankeyChart/SankeyChart.types.d.ts +90 -0
- package/dist/components/SankeyChart/SankeyChart.types.js +0 -0
- package/dist/components/SankeyChart/SankeyChart.utils.d.ts +21 -0
- package/dist/components/SankeyChart/SankeyChart.utils.js +299 -0
- package/dist/components/SankeyChart/SankeyChart.utils.js.map +1 -0
- package/dist/components/SankeyChart/SankeyNodeLabel.d.ts +10 -0
- package/dist/components/SankeyChart/SankeyNodeLabel.js +30 -0
- package/dist/components/SankeyChart/SankeyNodeLabel.js.map +1 -0
- package/dist/components/SankeyChart/SankeyNodeLabel.utils.d.ts +9 -0
- package/dist/components/SankeyChart/SankeyNodeLabel.utils.js +29 -0
- package/dist/components/SankeyChart/SankeyNodeLabel.utils.js.map +1 -0
- package/dist/components/SankeyChart/constants.d.ts +22 -0
- package/dist/components/SankeyChart/constants.js +27 -0
- package/dist/components/SankeyChart/constants.js.map +1 -0
- package/dist/components/SankeyChart/index.d.ts +5 -0
- package/dist/components/SankeyChart/index.js +4 -0
- package/dist/components/Select/Select.js +5 -5
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/SelectPrimitive.d.ts +6 -0
- package/dist/components/Select/SelectPrimitive.js +3 -2
- package/dist/components/Select/SelectPrimitive.js.map +1 -1
- package/dist/components/Slider/Slider.js +10 -3
- package/dist/components/Slider/Slider.js.map +1 -1
- package/dist/components/SplitViewPane/SplitViewPane.d.ts +2 -1
- package/dist/components/SplitViewPane/SplitViewPane.js +113 -219
- package/dist/components/SplitViewPane/SplitViewPane.js.map +1 -1
- package/dist/components/SplitViewPane/SplitViewPaneHeader.js +2 -2
- package/dist/components/SplitViewPane/useShowChildren.d.ts +5 -0
- package/dist/components/SplitViewPane/useShowChildren.js +14 -0
- package/dist/components/SplitViewPane/useShowChildren.js.map +1 -0
- package/dist/components/SplitViewPane/useSplitViewPaneResize.d.ts +21 -0
- package/dist/components/SplitViewPane/useSplitViewPaneResize.js +145 -0
- package/dist/components/SplitViewPane/useSplitViewPaneResize.js.map +1 -0
- package/dist/components/Textarea/Textarea.d.ts +4 -3
- package/dist/components/Textarea/Textarea.js +7 -21
- package/dist/components/Textarea/Textarea.js.map +1 -1
- package/dist/components/ThinkingState/LoadingIndicator.d.ts +1 -0
- package/dist/components/ThinkingState/LoadingIndicator.js +1 -1
- package/dist/components/ThinkingState/ThinkingState.d.ts +1 -0
- package/dist/components/ThinkingState/ThinkingState.js +5 -4
- package/dist/components/ThinkingState/ThinkingState.js.map +1 -1
- package/dist/components/ThinkingState/index.js +1 -1
- package/dist/components/Toast/index.js +33 -28
- package/dist/components/Toast/index.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +2 -2
- package/dist/components/Typeahead/Typeahead.js +18 -8
- package/dist/components/Typeahead/Typeahead.js.map +1 -1
- package/dist/components/Typeahead/Typeahead.types.d.ts +2 -0
- package/dist/components/Typeahead/TypeaheadParts.d.ts +3 -1
- package/dist/components/Typeahead/TypeaheadParts.js +7 -6
- package/dist/components/Typeahead/TypeaheadParts.js.map +1 -1
- package/dist/components/Typeahead/TypeaheadView.js +19 -13
- package/dist/components/Typeahead/TypeaheadView.js.map +1 -1
- package/dist/components/Typeahead/useTypeaheadDomSync.d.ts +1 -1
- package/dist/components/Typeahead/useTypeaheadDomSync.js +14 -8
- package/dist/components/Typeahead/useTypeaheadDomSync.js.map +1 -1
- package/dist/components/Typeahead/useTypeaheadUncontrolledInput.d.ts +2 -1
- package/dist/components/Typeahead/useTypeaheadUncontrolledInput.js +10 -9
- package/dist/components/Typeahead/useTypeaheadUncontrolledInput.js.map +1 -1
- package/dist/components/UnsavedChangesDialog.js +2 -2
- package/dist/components/index.d.ts +3 -1
- package/dist/components/index.js +7 -5
- package/dist/components.css +22 -18
- package/dist/hooks/useDebouncedCommit.d.ts +14 -0
- package/dist/hooks/useDebouncedCommit.js +35 -0
- package/dist/hooks/useDebouncedCommit.js.map +1 -0
- package/dist/icons/LongTailPhosphorIcons.js +1 -1
- package/dist/icons/PaddedPhosphorIcons.d.ts +1 -0
- package/dist/icons/PaddedPhosphorIcons.js +4 -2
- package/dist/icons/PaddedPhosphorIcons.js.map +1 -1
- package/dist/icons/WeightedPhosphorIcons.d.ts +1 -0
- package/dist/icons/WeightedPhosphorIcons.js +3 -1
- package/dist/icons/WeightedPhosphorIcons.js.map +1 -1
- package/dist/icons/index.js +3 -3
- package/dist/index.js +7 -5
- package/dist/utilities.css +1 -1
- package/dist/utils/chartColors.d.ts +2 -1
- package/dist/utils/chartColors.js +2 -1
- package/dist/utils/chartColors.js.map +1 -1
- package/dist/utils/componentSizes.d.ts +0 -1
- package/dist/utils/componentSizes.js.map +1 -1
- package/dist/utils/lazy-codemirror-loader.d.ts +0 -2
- package/dist/utils/lazy-codemirror-loader.js +1 -3
- package/dist/utils/lazy-codemirror-loader.js.map +1 -1
- package/docs/DESIGN.md +17 -0
- package/docs/STYLES.md +4 -1
- package/package.json +21 -8
- package/dist/_chunks/LoadingIndicator-DgtU9aqD.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chartColors.js","names":[],"sources":["../../src/utils/chartColors.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport {\n useColorScheme,\n type ResolvedThemeMode,\n} from '../hooks/useColorScheme';\n\n/**\n * Semantic colors for data visualization. These values intentionally remain\n * CSS variable references because SVG fill/stroke props cannot consume\n * Tailwind classes. Theme-specific values
|
|
1
|
+
{"version":3,"file":"chartColors.js","names":[],"sources":["../../src/utils/chartColors.ts"],"sourcesContent":["import { useMemo } from 'react';\n\nimport {\n useColorScheme,\n type ResolvedThemeMode,\n} from '../hooks/useColorScheme';\n\n/**\n * Semantic colors for data visualization. These values intentionally remain\n * CSS variable references because SVG fill/stroke props cannot consume\n * Tailwind classes. Theme-specific values come from\n * `@langchain/macaw-tokens/tokens.css`.\n */\nexport const CHART_CATEGORICAL_LINE_COLORS = Array.from(\n { length: 20 },\n (_, index) => `var(--chart-categorical-line-${index + 1})`\n);\n\nexport const CHART_CATEGORICAL_FILL_COLORS = Array.from(\n { length: 20 },\n (_, index) => `var(--chart-categorical-fill-${index + 1})`\n);\n\nexport const CHART_COMPARISON_COLORS = Array.from(\n { length: 10 },\n (_, index) => `var(--chart-comparison-${index + 1})`\n);\n\nexport const CHART_SINGLE_FILL_COLOR = 'var(--chart-single-fill)';\nexport const CHART_OTHER_COLOR = 'var(--chart-other)';\nexport const CHART_INTERACTION_CONTRAST_COLOR =\n 'var(--chart-interaction-contrast)';\nexport const CHART_ON_COLOR = 'var(--chart-on-color)';\nexport const CHART_ON_WARNING_COLOR = 'var(--chart-on-warning)';\n\nexport const CHART_STATUS_COLORS = {\n positive: 'var(--chart-positive)',\n warning: 'var(--chart-warning)',\n negative: 'var(--chart-negative)',\n negativeSubtle: 'var(--chart-negative-subtle)',\n};\n\n/** Lower-luminance semantic colors for large filled marks. */\nexport const CHART_STATUS_FILL_COLORS = {\n positive: 'var(--chart-positive-fill)',\n warning: 'var(--chart-warning-fill)',\n negative: 'var(--chart-negative-fill)',\n};\n\nexport const CHART_BREAKDOWN_COLORS = {\n input: 'var(--chart-breakdown-input)',\n output: 'var(--chart-breakdown-output)',\n other: 'var(--chart-breakdown-other)',\n};\n\nexport const getCategoricalLineChartColor = (index: number): string =>\n CHART_CATEGORICAL_LINE_COLORS[index % CHART_CATEGORICAL_LINE_COLORS.length] ??\n CHART_CATEGORICAL_LINE_COLORS[0];\n\nexport const getCategoricalFillChartColor = (index: number): string =>\n CHART_CATEGORICAL_FILL_COLORS[index % CHART_CATEGORICAL_FILL_COLORS.length] ??\n CHART_SINGLE_FILL_COLOR;\n\nconst getPaletteIndexForKey = (key: string): number => {\n let hash = 0;\n for (const character of key) {\n hash = (hash * 31 + character.charCodeAt(0)) >>> 0;\n }\n return hash;\n};\n\nexport const getLineChartColorForKey = (key: string): string =>\n getCategoricalLineChartColor(getPaletteIndexForKey(key));\n\nexport const getFillChartColorForKey = (key: string): string =>\n getCategoricalFillChartColor(getPaletteIndexForKey(key));\n\nexport const getCategoricalFillColor = (color: string): string => {\n const lineIndex = CHART_CATEGORICAL_LINE_COLORS.indexOf(color);\n return lineIndex === -1\n ? color\n : (CHART_CATEGORICAL_FILL_COLORS[lineIndex] ?? color);\n};\n\nexport const getChartStatusColor = (\n ...labels: Array<string | undefined>\n): string | undefined => {\n const normalized = labels.map((label) => label?.trim().toLowerCase());\n if (normalized.includes('success')) return CHART_STATUS_COLORS.positive;\n if (\n normalized.includes('error') ||\n normalized.some((label) => /^fail(?:ed|ing|ures?|s)?$/.test(label ?? ''))\n ) {\n return CHART_STATUS_COLORS.negative;\n }\n return undefined;\n};\n\nexport type ChartColorResolver = (color: string) => string;\n\n/** Resolve semantic CSS variables for renderers that run outside the DOM. */\nconst resolveChartColor = (\n color: string,\n resolvedMode: ResolvedThemeMode\n): string => {\n if (typeof document === 'undefined') return color;\n\n const root = document.documentElement;\n if (root.dataset.theme && root.dataset.theme !== resolvedMode) return color;\n\n const styles = getComputedStyle(root);\n let resolved = color;\n for (let depth = 0; depth < 10 && resolved.includes('var('); depth += 1) {\n resolved = resolved.replace(\n /var\\(\\s*(--[a-z0-9-]+)\\s*(?:,\\s*((?:[^()]|[a-z-]+\\([^()]*\\))+))?\\)/gi,\n (match, property: string, fallback: string | undefined) =>\n styles.getPropertyValue(property).trim() || fallback?.trim() || match\n );\n }\n return resolved;\n};\n\nexport const useChartColorResolver = (): ChartColorResolver => {\n const { resolvedMode } = useColorScheme();\n\n return useMemo(() => {\n const cache = new Map<string, string>();\n return (color: string) => {\n const cached = cache.get(color);\n if (cached !== undefined) return cached;\n\n const resolved = resolveChartColor(color, resolvedMode);\n if (!resolved.includes('var(')) cache.set(color, resolved);\n return resolved;\n };\n }, [resolvedMode]);\n};\n"],"mappings":";;;;;;;;;AAaA,IAAa,gCAAgC,MAAM,KACjD,EAAE,QAAQ,GAAG,IACZ,GAAG,UAAU,gCAAgC,QAAQ,EAAE,EAC1D;AAEA,IAAa,gCAAgC,MAAM,KACjD,EAAE,QAAQ,GAAG,IACZ,GAAG,UAAU,gCAAgC,QAAQ,EAAE,EAC1D;AAEA,IAAa,0BAA0B,MAAM,KAC3C,EAAE,QAAQ,GAAG,IACZ,GAAG,UAAU,0BAA0B,QAAQ,EAAE,EACpD;AAEA,IAAa,0BAA0B;AACvC,IAAa,oBAAoB;AACjC,IAAa,mCACX;AACF,IAAa,iBAAiB;AAC9B,IAAa,yBAAyB;AAEtC,IAAa,sBAAsB;CACjC,UAAU;CACV,SAAS;CACT,UAAU;CACV,gBAAgB;AAClB;;AAGA,IAAa,2BAA2B;CACtC,UAAU;CACV,SAAS;CACT,UAAU;AACZ;AAEA,IAAa,yBAAyB;CACpC,OAAO;CACP,QAAQ;CACR,OAAO;AACT;AAEA,IAAa,gCAAgC,UAC3C,8BAA8B,QAAQ,8BAA8B,WACpE,8BAA8B;AAEhC,IAAa,gCAAgC,UAC3C,8BAA8B,QAAQ,8BAA8B,WAAA;AAGtE,IAAM,yBAAyB,QAAwB;CACrD,IAAI,OAAO;CACX,KAAK,MAAM,aAAa,KACtB,OAAQ,OAAO,KAAK,UAAU,WAAW,CAAC,MAAO;CAEnD,OAAO;AACT;AAEA,IAAa,2BAA2B,QACtC,6BAA6B,sBAAsB,GAAG,CAAC;AAEzD,IAAa,2BAA2B,QACtC,6BAA6B,sBAAsB,GAAG,CAAC;AAEzD,IAAa,2BAA2B,UAA0B;CAChE,MAAM,YAAY,8BAA8B,QAAQ,KAAK;CAC7D,OAAO,cAAc,KACjB,QACC,8BAA8B,cAAc;AACnD;AAEA,IAAa,uBACX,GAAG,WACoB;CACvB,MAAM,aAAa,OAAO,KAAK,UAAU,OAAO,KAAK,CAAC,CAAC,YAAY,CAAC;CACpE,IAAI,WAAW,SAAS,SAAS,GAAG,OAAO,oBAAoB;CAC/D,IACE,WAAW,SAAS,OAAO,KAC3B,WAAW,MAAM,UAAU,4BAA4B,KAAK,SAAS,EAAE,CAAC,GAExE,OAAO,oBAAoB;AAG/B;;AAKA,IAAM,qBACJ,OACA,iBACW;CACX,IAAI,OAAO,aAAa,aAAa,OAAO;CAE5C,MAAM,OAAO,SAAS;CACtB,IAAI,KAAK,QAAQ,SAAS,KAAK,QAAQ,UAAU,cAAc,OAAO;CAEtE,MAAM,SAAS,iBAAiB,IAAI;CACpC,IAAI,WAAW;CACf,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,SAAS,SAAS,MAAM,GAAG,SAAS,GACpE,WAAW,SAAS,QAClB,yEACC,OAAO,UAAkB,aACxB,OAAO,iBAAiB,QAAQ,CAAC,CAAC,KAAK,KAAK,UAAU,KAAK,KAAK,KACpE;CAEF,OAAO;AACT;AAEA,IAAa,8BAAkD;CAC7D,MAAM,EAAE,iBAAiB,eAAe;CAExC,OAAO,cAAc;EACnB,MAAM,wBAAQ,IAAI,IAAoB;EACtC,QAAQ,UAAkB;GACxB,MAAM,SAAS,MAAM,IAAI,KAAK;GAC9B,IAAI,WAAW,KAAA,GAAW,OAAO;GAEjC,MAAM,WAAW,kBAAkB,OAAO,YAAY;GACtD,IAAI,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,IAAI,OAAO,QAAQ;GACzD,OAAO;EACT;CACF,GAAG,CAAC,YAAY,CAAC;AACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentSizes.js","names":[],"sources":["../../src/utils/componentSizes.ts"],"sourcesContent":["/**\n * Named outer-size contracts shared by related design-system components.\n *\n * Each family owns its supported tiers. Do not combine these into a universal\n * size type: the same name is meaningful only within its component family.\n */\n/** Components: Decorated Icon, Avatar, and Spinner. */\nexport const VISUAL_ELEMENT_SIZES = {\n xxs: { name: 'xxs', rem: 0.75, className: 'size-3' },\n xs: { name: 'xs', rem: 1, className: 'size-4' },\n sm: { name: 'sm', rem: 1.25, className: 'size-5' },\n md: { name: 'md', rem: 1.5, className: 'size-6' },\n} as const;\n\nexport type VisualElementSize = keyof typeof VISUAL_ELEMENT_SIZES;\n\n/**\n * Components: Button, IconButton, ButtonGroup, CopyButton, Input,\n * CommandInput, Select, Typeahead, and GroupedTabs.\n */\nexport const CONTROL_SIZES = {\n xs: {\n name: 'xs',\n rem: 1.25,\n heightClassName: 'h-5',\n minHeightClassName: 'min-h-5',\n },\n sm: {\n name: 'sm',\n rem: 1.5,\n heightClassName: 'h-6',\n minHeightClassName: 'min-h-6',\n },\n md: {\n name: 'md',\n rem: 2,\n heightClassName: 'h-8',\n minHeightClassName: 'min-h-8',\n },\n lg: {\n name: 'lg',\n rem: 2.5,\n heightClassName: 'h-10',\n minHeightClassName: 'min-h-10',\n },\n} as const;\n\nexport type ControlSize = keyof typeof CONTROL_SIZES;\n\n/**\n * Components: Checkbox, RadioButton, Switch, and RadioCard support every tier.\n * RadioGroupItem and Slider retain intrinsic/default geometry. Applies to\n * indicator geometry, not intrinsic row/card height.\n */\nexport const SELECTION_CONTROL_SIZES = {\n sm: {\n name: 'sm',\n rem: 1,\n className: 'size-4',\n heightClassName: 'h-4',\n },\n md: {\n name: 'md',\n rem: 1.25,\n className: 'size-5',\n heightClassName: 'h-5',\n },\n} as const;\n\nexport type SelectionControlSize = keyof typeof SELECTION_CONTROL_SIZES;\n\n/**\n * Keeps compact visual indicators at least 24px pointer targets without\n * changing their layout geometry.\n */\nexport const SELECTION_CONTROL_HIT_AREA_STYLES = `relative after:absolute after:left-1/2 after:top-1/2 after:min-h-6 after:min-w-6 after:-translate-x-1/2 after:-translate-y-1/2 after:content-['']`;\n\n/**\n * Components: CommandItem, DropdownMenuItem, DropdownMenuSubTrigger,\n * ContextMenuItem, SelectItem, and Typeahead option/create-option rows.\n */\nexport const OPTION_ROW_SIZES = {\n sm: { name: 'sm', rem: 1.5, minHeightClassName: 'min-h-6' },\n md: { name: 'md', rem: 2, minHeightClassName: 'min-h-8' },\n} as const;\n\
|
|
1
|
+
{"version":3,"file":"componentSizes.js","names":[],"sources":["../../src/utils/componentSizes.ts"],"sourcesContent":["/**\n * Named outer-size contracts shared by related design-system components.\n *\n * Each family owns its supported tiers. Do not combine these into a universal\n * size type: the same name is meaningful only within its component family.\n */\n/** Components: Decorated Icon, Avatar, and Spinner. */\nexport const VISUAL_ELEMENT_SIZES = {\n xxs: { name: 'xxs', rem: 0.75, className: 'size-3' },\n xs: { name: 'xs', rem: 1, className: 'size-4' },\n sm: { name: 'sm', rem: 1.25, className: 'size-5' },\n md: { name: 'md', rem: 1.5, className: 'size-6' },\n} as const;\n\nexport type VisualElementSize = keyof typeof VISUAL_ELEMENT_SIZES;\n\n/**\n * Components: Button, IconButton, ButtonGroup, CopyButton, Input,\n * CommandInput, Select, Typeahead, and GroupedTabs.\n */\nexport const CONTROL_SIZES = {\n xs: {\n name: 'xs',\n rem: 1.25,\n heightClassName: 'h-5',\n minHeightClassName: 'min-h-5',\n },\n sm: {\n name: 'sm',\n rem: 1.5,\n heightClassName: 'h-6',\n minHeightClassName: 'min-h-6',\n },\n md: {\n name: 'md',\n rem: 2,\n heightClassName: 'h-8',\n minHeightClassName: 'min-h-8',\n },\n lg: {\n name: 'lg',\n rem: 2.5,\n heightClassName: 'h-10',\n minHeightClassName: 'min-h-10',\n },\n} as const;\n\nexport type ControlSize = keyof typeof CONTROL_SIZES;\n\n/**\n * Components: Checkbox, RadioButton, Switch, and RadioCard support every tier.\n * RadioGroupItem and Slider retain intrinsic/default geometry. Applies to\n * indicator geometry, not intrinsic row/card height.\n */\nexport const SELECTION_CONTROL_SIZES = {\n sm: {\n name: 'sm',\n rem: 1,\n className: 'size-4',\n heightClassName: 'h-4',\n },\n md: {\n name: 'md',\n rem: 1.25,\n className: 'size-5',\n heightClassName: 'h-5',\n },\n} as const;\n\nexport type SelectionControlSize = keyof typeof SELECTION_CONTROL_SIZES;\n\n/**\n * Keeps compact visual indicators at least 24px pointer targets without\n * changing their layout geometry.\n */\nexport const SELECTION_CONTROL_HIT_AREA_STYLES = `relative after:absolute after:left-1/2 after:top-1/2 after:min-h-6 after:min-w-6 after:-translate-x-1/2 after:-translate-y-1/2 after:content-['']`;\n\n/**\n * Components: CommandItem, DropdownMenuItem, DropdownMenuSubTrigger,\n * ContextMenuItem, SelectItem, and Typeahead option/create-option rows.\n */\nexport const OPTION_ROW_SIZES = {\n sm: { name: 'sm', rem: 1.5, minHeightClassName: 'min-h-6' },\n md: { name: 'md', rem: 2, minHeightClassName: 'min-h-8' },\n} as const;\n\nexport type OptionRowSize = keyof typeof OPTION_ROW_SIZES;\n"],"mappings":";;;;;;;;AAOA,IAAa,uBAAuB;CAClC,KAAK;EAAE,MAAM;EAAO,KAAK;EAAM,WAAW;CAAS;CACnD,IAAI;EAAE,MAAM;EAAM,KAAK;EAAG,WAAW;CAAS;CAC9C,IAAI;EAAE,MAAM;EAAM,KAAK;EAAM,WAAW;CAAS;CACjD,IAAI;EAAE,MAAM;EAAM,KAAK;EAAK,WAAW;CAAS;AAClD;;;;;AAQA,IAAa,gBAAgB;CAC3B,IAAI;EACF,MAAM;EACN,KAAK;EACL,iBAAiB;EACjB,oBAAoB;CACtB;CACA,IAAI;EACF,MAAM;EACN,KAAK;EACL,iBAAiB;EACjB,oBAAoB;CACtB;CACA,IAAI;EACF,MAAM;EACN,KAAK;EACL,iBAAiB;EACjB,oBAAoB;CACtB;CACA,IAAI;EACF,MAAM;EACN,KAAK;EACL,iBAAiB;EACjB,oBAAoB;CACtB;AACF;;;;;;AASA,IAAa,0BAA0B;CACrC,IAAI;EACF,MAAM;EACN,KAAK;EACL,WAAW;EACX,iBAAiB;CACnB;CACA,IAAI;EACF,MAAM;EACN,KAAK;EACL,WAAW;EACX,iBAAiB;CACnB;AACF;;;;;AAQA,IAAa,oCAAoC;;;;;AAMjD,IAAa,mBAAmB;CAC9B,IAAI;EAAE,MAAM;EAAM,KAAK;EAAK,oBAAoB;CAAU;CAC1D,IAAI;EAAE,MAAM;EAAM,KAAK;EAAG,oBAAoB;CAAU;AAC1D"}
|
|
@@ -20,7 +20,6 @@ import type * as CmLegacyShell from '@codemirror/legacy-modes/mode/shell';
|
|
|
20
20
|
import type * as CmLint from '@codemirror/lint';
|
|
21
21
|
import type * as CmState from '@codemirror/state';
|
|
22
22
|
import type * as CmView from '@codemirror/view';
|
|
23
|
-
import type * as LezerCommon from '@lezer/common';
|
|
24
23
|
import type * as LezerHighlight from '@lezer/highlight';
|
|
25
24
|
import type * as LezerYaml from '@lezer/yaml';
|
|
26
25
|
import type * as TokyoDay from '@uiw/codemirror-theme-tokyo-night-day';
|
|
@@ -57,7 +56,6 @@ export type CMBundle = {
|
|
|
57
56
|
lezerYamlParser: typeof LezerYaml.parser;
|
|
58
57
|
lezerTagHighlighter: typeof LezerHighlight.tagHighlighter;
|
|
59
58
|
lezerHighlighTree: typeof LezerHighlight.highlightTree;
|
|
60
|
-
lezerCommon: typeof LezerCommon;
|
|
61
59
|
langJson: typeof CmLangJson.json;
|
|
62
60
|
langJavascript: typeof CmLangJs.javascript;
|
|
63
61
|
langPython: typeof CmLangPython.python;
|
|
@@ -15,14 +15,13 @@ function loadCodeMirror() {
|
|
|
15
15
|
import("@uiw/codemirror-theme-tokyo-night-storm"),
|
|
16
16
|
import("@lezer/highlight"),
|
|
17
17
|
import("@lezer/yaml"),
|
|
18
|
-
import("@lezer/common"),
|
|
19
18
|
import("@codemirror/lang-json"),
|
|
20
19
|
import("@codemirror/lang-javascript"),
|
|
21
20
|
import("@codemirror/lang-python"),
|
|
22
21
|
import("@codemirror/lang-markdown"),
|
|
23
22
|
import("@codemirror/legacy-modes/mode/shell"),
|
|
24
23
|
import("@codemirror/legacy-modes/mode/ruby")
|
|
25
|
-
]).then(([cmCore, cmCommands, cmLanguage, cmState, cmView, cmLint, tokyoDay, tokyoStorm, lezerHighlight, lezerYaml,
|
|
24
|
+
]).then(([cmCore, cmCommands, cmLanguage, cmState, cmView, cmLint, tokyoDay, tokyoStorm, lezerHighlight, lezerYaml, cmLangJson, cmLangJs, cmLangPython, cmLangMarkdown, cmLegacyShell, cmLegacyRuby]) => {
|
|
26
25
|
bundle = {
|
|
27
26
|
CodeMirror: cmCore.default,
|
|
28
27
|
defaultKeymap: cmCommands.defaultKeymap,
|
|
@@ -54,7 +53,6 @@ function loadCodeMirror() {
|
|
|
54
53
|
lezerTagHighlighter: lezerHighlight.tagHighlighter,
|
|
55
54
|
lezerHighlighTree: lezerHighlight.highlightTree,
|
|
56
55
|
lezerYamlParser: lezerYaml.parser,
|
|
57
|
-
lezerCommon: lezerCommonModule,
|
|
58
56
|
langJson: cmLangJson.json,
|
|
59
57
|
langJavascript: cmLangJs.javascript,
|
|
60
58
|
langPython: cmLangPython.python,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lazy-codemirror-loader.js","names":[],"sources":["../../src/utils/lazy-codemirror-loader.ts"],"sourcesContent":["/**\n * Lazy loader for CodeMirror and related packages.\n * Avoids loading @codemirror/*, @uiw/react-codemirror, and @lezer/* on initial\n * page load.\n *\n * Usage:\n * - Call loadCodeMirror() early (e.g. in App.tsx) to kick off loading in the background.\n * - Use the useCodeMirror() hook in components — returns CMBundle | null.\n * null means not yet loaded; components should render a fallback (or null).\n * - Never import @codemirror/* at the top level outside this file.\n */\n\nimport type * as CmCommands from '@codemirror/commands';\nimport type * as CmLangJs from '@codemirror/lang-javascript';\nimport type * as CmLangJson from '@codemirror/lang-json';\nimport type * as CmLangMarkdown from '@codemirror/lang-markdown';\nimport type * as CmLangPython from '@codemirror/lang-python';\nimport type * as CmLanguage from '@codemirror/language';\nimport type * as CmLegacyRuby from '@codemirror/legacy-modes/mode/ruby';\nimport type * as CmLegacyShell from '@codemirror/legacy-modes/mode/shell';\nimport type * as CmLint from '@codemirror/lint';\nimport type * as CmState from '@codemirror/state';\nimport type * as CmView from '@codemirror/view';\nimport type * as
|
|
1
|
+
{"version":3,"file":"lazy-codemirror-loader.js","names":[],"sources":["../../src/utils/lazy-codemirror-loader.ts"],"sourcesContent":["/**\n * Lazy loader for CodeMirror and related packages.\n * Avoids loading @codemirror/*, @uiw/react-codemirror, and @lezer/* on initial\n * page load.\n *\n * Usage:\n * - Call loadCodeMirror() early (e.g. in App.tsx) to kick off loading in the background.\n * - Use the useCodeMirror() hook in components — returns CMBundle | null.\n * null means not yet loaded; components should render a fallback (or null).\n * - Never import @codemirror/* at the top level outside this file.\n */\n\nimport type * as CmCommands from '@codemirror/commands';\nimport type * as CmLangJs from '@codemirror/lang-javascript';\nimport type * as CmLangJson from '@codemirror/lang-json';\nimport type * as CmLangMarkdown from '@codemirror/lang-markdown';\nimport type * as CmLangPython from '@codemirror/lang-python';\nimport type * as CmLanguage from '@codemirror/language';\nimport type * as CmLegacyRuby from '@codemirror/legacy-modes/mode/ruby';\nimport type * as CmLegacyShell from '@codemirror/legacy-modes/mode/shell';\nimport type * as CmLint from '@codemirror/lint';\nimport type * as CmState from '@codemirror/state';\nimport type * as CmView from '@codemirror/view';\nimport type * as LezerHighlight from '@lezer/highlight';\nimport type * as LezerYaml from '@lezer/yaml';\nimport type * as TokyoDay from '@uiw/codemirror-theme-tokyo-night-day';\nimport type * as TokyoStorm from '@uiw/codemirror-theme-tokyo-night-storm';\nimport type ReactCodeMirror from '@uiw/react-codemirror';\n\nexport type CMBundle = {\n // Core\n CodeMirror: typeof ReactCodeMirror;\n\n // Commands\n defaultKeymap: typeof CmCommands.defaultKeymap;\n\n // Language\n LanguageSupport: typeof CmLanguage.LanguageSupport;\n StreamLanguage: typeof CmLanguage.StreamLanguage;\n LRLanguage: typeof CmLanguage.LRLanguage;\n delimitedIndent: typeof CmLanguage.delimitedIndent;\n foldEffect: typeof CmLanguage.foldEffect;\n foldService: typeof CmLanguage.foldService;\n foldNodeProp: typeof CmLanguage.foldNodeProp;\n foldable: typeof CmLanguage.foldable;\n indentNodeProp: typeof CmLanguage.indentNodeProp;\n syntaxTree: typeof CmLanguage.syntaxTree;\n syntaxTreeAvailable: typeof CmLanguage.syntaxTreeAvailable;\n\n // State\n EditorState: typeof CmState.EditorState;\n StateEffect: typeof CmState.StateEffect;\n StateField: typeof CmState.StateField;\n RangeSetBuilder: typeof CmState.RangeSetBuilder;\n\n // View\n Decoration: typeof CmView.Decoration;\n EditorView: typeof CmView.EditorView;\n ViewPlugin: typeof CmView.ViewPlugin;\n WidgetType: typeof CmView.WidgetType;\n keymap: typeof CmView.keymap;\n\n // Lint\n lintGutter: typeof CmLint.lintGutter;\n linter: typeof CmLint.linter;\n\n // Themes\n tokyoNightDayInit: typeof TokyoDay.tokyoNightDayInit;\n tokyoNightStormInit: typeof TokyoStorm.tokyoNightStormInit;\n\n // Lezer\n lezerHighlightTags: typeof LezerHighlight.tags;\n lezerYamlParser: typeof LezerYaml.parser;\n lezerTagHighlighter: typeof LezerHighlight.tagHighlighter;\n lezerHighlighTree: typeof LezerHighlight.highlightTree;\n\n // Languages\n langJson: typeof CmLangJson.json;\n langJavascript: typeof CmLangJs.javascript;\n langPython: typeof CmLangPython.python;\n langMarkdown: typeof CmLangMarkdown.markdown;\n legacyModeShell: typeof CmLegacyShell.shell;\n legacyModeRuby: typeof CmLegacyRuby.ruby;\n};\n\nlet bundle: CMBundle | null = null;\nlet loadPromise: Promise<CMBundle> | null = null;\n\nexport function loadCodeMirror(): Promise<CMBundle> {\n if (bundle) return Promise.resolve(bundle);\n if (loadPromise) return loadPromise;\n\n loadPromise = Promise.all([\n import('@uiw/react-codemirror'),\n import('@codemirror/commands'),\n import('@codemirror/language'),\n import('@codemirror/state'),\n import('@codemirror/view'),\n import('@codemirror/lint'),\n import('@uiw/codemirror-theme-tokyo-night-day'),\n import('@uiw/codemirror-theme-tokyo-night-storm'),\n import('@lezer/highlight'),\n import('@lezer/yaml'),\n import('@codemirror/lang-json'),\n import('@codemirror/lang-javascript'),\n import('@codemirror/lang-python'),\n import('@codemirror/lang-markdown'),\n import('@codemirror/legacy-modes/mode/shell'),\n import('@codemirror/legacy-modes/mode/ruby'),\n ])\n .then(\n ([\n cmCore,\n cmCommands,\n cmLanguage,\n cmState,\n cmView,\n cmLint,\n tokyoDay,\n tokyoStorm,\n lezerHighlight,\n lezerYaml,\n cmLangJson,\n cmLangJs,\n cmLangPython,\n cmLangMarkdown,\n cmLegacyShell,\n cmLegacyRuby,\n ]): CMBundle => {\n bundle = {\n CodeMirror: cmCore.default,\n defaultKeymap: cmCommands.defaultKeymap,\n LanguageSupport: cmLanguage.LanguageSupport,\n StreamLanguage: cmLanguage.StreamLanguage,\n LRLanguage: cmLanguage.LRLanguage,\n delimitedIndent: cmLanguage.delimitedIndent,\n foldEffect: cmLanguage.foldEffect,\n foldService: cmLanguage.foldService,\n foldNodeProp: cmLanguage.foldNodeProp,\n foldable: cmLanguage.foldable,\n indentNodeProp: cmLanguage.indentNodeProp,\n syntaxTree: cmLanguage.syntaxTree,\n syntaxTreeAvailable: cmLanguage.syntaxTreeAvailable,\n EditorState: cmState.EditorState,\n StateEffect: cmState.StateEffect,\n StateField: cmState.StateField,\n RangeSetBuilder: cmState.RangeSetBuilder,\n Decoration: cmView.Decoration,\n EditorView: cmView.EditorView,\n ViewPlugin: cmView.ViewPlugin,\n WidgetType: cmView.WidgetType,\n keymap: cmView.keymap,\n lintGutter: cmLint.lintGutter,\n linter: cmLint.linter,\n tokyoNightStormInit: tokyoStorm.tokyoNightStormInit,\n tokyoNightDayInit: tokyoDay.tokyoNightDayInit,\n lezerHighlightTags: lezerHighlight.tags,\n lezerTagHighlighter: lezerHighlight.tagHighlighter,\n lezerHighlighTree: lezerHighlight.highlightTree,\n lezerYamlParser: lezerYaml.parser,\n langJson: cmLangJson.json,\n langJavascript: cmLangJs.javascript,\n langPython: cmLangPython.python,\n langMarkdown: cmLangMarkdown.markdown,\n legacyModeShell: cmLegacyShell.shell,\n legacyModeRuby: cmLegacyRuby.ruby,\n };\n return bundle;\n }\n )\n .catch((err) => {\n loadPromise = null;\n throw err;\n });\n\n return loadPromise;\n}\n\n/** Returns the bundle synchronously if already loaded, otherwise null. */\nexport function getCodeMirror(): CMBundle | null {\n return bundle;\n}\n"],"mappings":";AAqFA,IAAI,SAA0B;AAC9B,IAAI,cAAwC;AAE5C,SAAgB,iBAAoC;CAClD,IAAI,QAAQ,OAAO,QAAQ,QAAQ,MAAM;CACzC,IAAI,aAAa,OAAO;CAExB,cAAc,QAAQ,IAAI;EACxB,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;CACT,CAAC,CAAC,CACC,MACE,CACC,QACA,YACA,YACA,SACA,QACA,QACA,UACA,YACA,gBACA,WACA,YACA,UACA,cACA,gBACA,eACA,kBACc;EACd,SAAS;GACP,YAAY,OAAO;GACnB,eAAe,WAAW;GAC1B,iBAAiB,WAAW;GAC5B,gBAAgB,WAAW;GAC3B,YAAY,WAAW;GACvB,iBAAiB,WAAW;GAC5B,YAAY,WAAW;GACvB,aAAa,WAAW;GACxB,cAAc,WAAW;GACzB,UAAU,WAAW;GACrB,gBAAgB,WAAW;GAC3B,YAAY,WAAW;GACvB,qBAAqB,WAAW;GAChC,aAAa,QAAQ;GACrB,aAAa,QAAQ;GACrB,YAAY,QAAQ;GACpB,iBAAiB,QAAQ;GACzB,YAAY,OAAO;GACnB,YAAY,OAAO;GACnB,YAAY,OAAO;GACnB,YAAY,OAAO;GACnB,QAAQ,OAAO;GACf,YAAY,OAAO;GACnB,QAAQ,OAAO;GACf,qBAAqB,WAAW;GAChC,mBAAmB,SAAS;GAC5B,oBAAoB,eAAe;GACnC,qBAAqB,eAAe;GACpC,mBAAmB,eAAe;GAClC,iBAAiB,UAAU;GAC3B,UAAU,WAAW;GACrB,gBAAgB,SAAS;GACzB,YAAY,aAAa;GACzB,cAAc,eAAe;GAC7B,iBAAiB,cAAc;GAC/B,gBAAgB,aAAa;EAC/B;EACA,OAAO;CACT,CACF,CAAC,CACA,OAAO,QAAQ;EACd,cAAc;EACd,MAAM;CACR,CAAC;CAEH,OAAO;AACT;;AAGA,SAAgB,gBAAiC;CAC/C,OAAO;AACT"}
|
package/docs/DESIGN.md
CHANGED
|
@@ -42,6 +42,7 @@ Use existing components for their interaction contracts, not just their appearan
|
|
|
42
42
|
|
|
43
43
|
- Use `Button` for actions and `Link` for navigation.
|
|
44
44
|
- Use `IconButton` for an icon-only action and provide its `label`.
|
|
45
|
+
- Use `Attachment` and `AttachmentList` for file rows and thumbnails; consumers own uploads, preview safety, and file operations.
|
|
45
46
|
- Use `Input` or `Textarea` for text entry, `Select` for a known option list, and `Typeahead` when the user types to search or create options.
|
|
46
47
|
- Use `RadioGroup` for a short visible choice set and `RadioCard` when an option needs supporting content.
|
|
47
48
|
- Use `Dialog` for a short blocking decision and `Pane` for substantial editing or detail work.
|
|
@@ -49,11 +50,25 @@ Use existing components for their interaction contracts, not just their appearan
|
|
|
49
50
|
- Use `Banner` for persistent regional information, `useToast().createToast(...)` for the result of an action, and field hint/error APIs for validation.
|
|
50
51
|
- Use `ThinkingState` for active AI work (generation, reasoning, or tool use); name the work and show elapsed time only for longer waits.
|
|
51
52
|
- Use `LoadingIndicator` for the AI animation alone; announce status on its surrounding control or region.
|
|
53
|
+
- Set `speed="slow"` on `ThinkingState` or `LoadingIndicator` for a slower animation; reduced-motion preferences still take precedence.
|
|
52
54
|
- Use `Spinner` for routine saves, fetches, or refreshes, even within AI screens (e.g. fetching chat history).
|
|
53
55
|
- Use `Skeleton` for known content shapes, `LinearProgress` for regional loading, and `ProgressBar` for measurable completion.
|
|
54
56
|
|
|
55
57
|
Custom components should compose primitives and keep feature data, permissions, navigation, and domain behavior in the feature. Prefer a few composable parts over large prop surfaces and boolean-driven branches. Use named exports for new components, and update types, stories, and relevant guidance when behavior changes.
|
|
56
58
|
|
|
59
|
+
## Code editors
|
|
60
|
+
|
|
61
|
+
Import `Code`, `CodeToolbar`, and `CodeLanguageSelect` from
|
|
62
|
+
`@langchain/macaw-components/Code`. Use `Code` for editing and the lighter
|
|
63
|
+
`CodeLite` for read-only snippets. Supply a `toolbar` to compose language controls
|
|
64
|
+
and actions above the editor; include `CopyButton` there when needed. Without a
|
|
65
|
+
toolbar, `showCopyButton` keeps the floating copy control.
|
|
66
|
+
|
|
67
|
+
`CodeLanguageSelect` accepts language aliases such as `ts` and `py`, preserves
|
|
68
|
+
unknown language labels, and reports supported `CodeLanguageType` values.
|
|
69
|
+
`showFoldGutter={false}` hides folding controls. Use `onChange` for user edits and
|
|
70
|
+
`onUpdate` when an integration also needs selection or programmatic updates.
|
|
71
|
+
|
|
57
72
|
## Tokens
|
|
58
73
|
|
|
59
74
|
Tokens flow in one direction:
|
|
@@ -81,6 +96,8 @@ Choose color by meaning:
|
|
|
81
96
|
|
|
82
97
|
Chart SVG `fill` and `stroke` are the exception to Tailwind-only color usage. Import semantic values from `@langchain/macaw-components/utils/chartColors`; do not use raw visualization variables or literals.
|
|
83
98
|
|
|
99
|
+
Import `SankeyChart` from `@langchain/macaw-components/SankeyChart` for weighted flow diagrams. Compose it with `ChartCard`, `ChartLegend`, and `ChartTooltip`; consumers own data, value formatting, tooltips, and navigation.
|
|
100
|
+
|
|
84
101
|
## Icons
|
|
85
102
|
|
|
86
103
|
Use server-safe Phosphor leaf modules for general-purpose glyphs:
|
package/docs/STYLES.md
CHANGED
|
@@ -92,6 +92,9 @@ The same tier name is meaningful only within its family.
|
|
|
92
92
|
- `Input`, `CommandInput`, and `Textarea` default to the `lg` compatibility tier.
|
|
93
93
|
New consumers should choose `md` explicitly.
|
|
94
94
|
|
|
95
|
+
`Tabs` and `TabLabel` remain intrinsic page navigation; use `GroupedTabs` for
|
|
96
|
+
compact local navigation on the control scale.
|
|
97
|
+
|
|
95
98
|
## Label Casing
|
|
96
99
|
|
|
97
100
|
Use **Title Case** for names of things: field labels, section headings, tabs,
|
|
@@ -171,7 +174,7 @@ dashboard visualization shells.
|
|
|
171
174
|
- Consumers own charts, legends, data interactions, and empty states. Use the
|
|
172
175
|
`state` prop for standard loading and known data-fetching error states; it
|
|
173
176
|
does not catch chart-rendering exceptions.
|
|
174
|
-
- Set `skeletonVariant` to `bar`, `line`, `donut`, `metric`, or `
|
|
177
|
+
- Set `skeletonVariant` to `bar`, `line`, `donut`, `metric`, `sparkline`, or `sankey` to match the chart
|
|
175
178
|
shape while loading. Use `ChartCardSkeleton` directly for a chart placeholder
|
|
176
179
|
outside a card.
|
|
177
180
|
- Loading and error states have a baseline minimum height. Set an explicit card
|
package/package.json
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/macaw-components",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.6",
|
|
4
4
|
"description": "React components and usage guidance for the Macaw Design System.",
|
|
5
|
-
"homepage": "https://github.com/langchain-ai/macaw-design-system#readme",
|
|
6
|
-
"bugs": {
|
|
7
|
-
"url": "https://github.com/langchain-ai/macaw-design-system/issues"
|
|
8
|
-
},
|
|
9
5
|
"license": "MIT",
|
|
10
6
|
"repository": {
|
|
11
7
|
"type": "git",
|
|
@@ -32,6 +28,10 @@
|
|
|
32
28
|
"types": "./dist/index.d.ts",
|
|
33
29
|
"import": "./dist/index.js"
|
|
34
30
|
},
|
|
31
|
+
"./Attachment": {
|
|
32
|
+
"types": "./dist/components/Attachment/index.d.ts",
|
|
33
|
+
"import": "./dist/components/Attachment/index.js"
|
|
34
|
+
},
|
|
35
35
|
"./Avatar": {
|
|
36
36
|
"types": "./dist/components/Avatar/index.d.ts",
|
|
37
37
|
"import": "./dist/components/Avatar/index.js"
|
|
@@ -192,6 +192,10 @@
|
|
|
192
192
|
"types": "./dist/components/RadioGroup/index.d.ts",
|
|
193
193
|
"import": "./dist/components/RadioGroup/index.js"
|
|
194
194
|
},
|
|
195
|
+
"./SankeyChart": {
|
|
196
|
+
"types": "./dist/components/SankeyChart/index.d.ts",
|
|
197
|
+
"import": "./dist/components/SankeyChart/index.js"
|
|
198
|
+
},
|
|
195
199
|
"./Select": {
|
|
196
200
|
"types": "./dist/components/Select/index.d.ts",
|
|
197
201
|
"import": "./dist/components/Select/index.js"
|
|
@@ -301,6 +305,10 @@
|
|
|
301
305
|
"types": "./dist/components/index.d.ts",
|
|
302
306
|
"import": "./dist/components/index.js"
|
|
303
307
|
},
|
|
308
|
+
"./components/Attachment": {
|
|
309
|
+
"types": "./dist/components/Attachment/index.d.ts",
|
|
310
|
+
"import": "./dist/components/Attachment/index.js"
|
|
311
|
+
},
|
|
304
312
|
"./components/Avatar": {
|
|
305
313
|
"types": "./dist/components/Avatar/index.d.ts",
|
|
306
314
|
"import": "./dist/components/Avatar/index.js"
|
|
@@ -461,6 +469,10 @@
|
|
|
461
469
|
"types": "./dist/components/RadioGroup/index.d.ts",
|
|
462
470
|
"import": "./dist/components/RadioGroup/index.js"
|
|
463
471
|
},
|
|
472
|
+
"./components/SankeyChart": {
|
|
473
|
+
"types": "./dist/components/SankeyChart/index.d.ts",
|
|
474
|
+
"import": "./dist/components/SankeyChart/index.js"
|
|
475
|
+
},
|
|
464
476
|
"./components/Select": {
|
|
465
477
|
"types": "./dist/components/Select/index.d.ts",
|
|
466
478
|
"import": "./dist/components/Select/index.js"
|
|
@@ -544,6 +556,7 @@
|
|
|
544
556
|
"@fontsource/fira-code": "^5.2.7",
|
|
545
557
|
"@fontsource/inter": "^5.2.8",
|
|
546
558
|
"@headlessui/react": "^2.2.10",
|
|
559
|
+
"@langchain/macaw-tokens": "1.0.0-beta.6",
|
|
547
560
|
"@lezer/common": "^1.2.1",
|
|
548
561
|
"@lezer/highlight": "^1.2.0",
|
|
549
562
|
"@lezer/yaml": "^1.0.4",
|
|
@@ -585,8 +598,7 @@
|
|
|
585
598
|
"tailwind-merge": "^2.6",
|
|
586
599
|
"tailwindcss-animate": "^1.0.7",
|
|
587
600
|
"use-debounce": "^9.0.4",
|
|
588
|
-
"yaml": "^2.8.3"
|
|
589
|
-
"@langchain/macaw-tokens": "1.0.0-beta.0"
|
|
601
|
+
"yaml": "^2.8.3"
|
|
590
602
|
},
|
|
591
603
|
"peerDependencies": {
|
|
592
604
|
"react": ">=18.2.0 <20",
|
|
@@ -614,6 +626,7 @@
|
|
|
614
626
|
}
|
|
615
627
|
},
|
|
616
628
|
"scripts": {
|
|
617
|
-
"build": "node ../../scripts/build.mjs
|
|
629
|
+
"build": "node ../../scripts/build-components.mjs",
|
|
630
|
+
"storybook": "storybook dev -p 5264"
|
|
618
631
|
}
|
|
619
632
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingIndicator-DgtU9aqD.js","names":[],"sources":["../../src/components/ThinkingState/ThinkingState.module.css","../../src/components/ThinkingState/LoadingIndicator.tsx"],"sourcesContent":["/* Adapted from TurboKach/ai-native-react-components (MIT). See NOTICE. */\n.grid {\n display: inline-grid;\n grid-template: repeat(3, minmax(0, 1fr)) / repeat(3, minmax(0, 1fr));\n gap: 10%;\n}\n\n.pixel {\n border-radius: 1px;\n opacity: 0.15;\n animation: pixel-on var(--loading-cycle) ease-in-out infinite;\n}\n\n.dot {\n @apply rounded-full;\n}\n\n.inactive {\n opacity: 0.07;\n animation: none;\n}\n\n.grid[data-animated='false'] .pixel {\n animation: none;\n}\n\n.grid[data-animated='false'] .pixel:not(.inactive) {\n opacity: 0.5;\n}\n\n.shimmer {\n @apply bg-gradient-to-r from-text-tertiary from-35% via-text-primary via-50% to-text-tertiary to-65% bg-clip-text text-transparent;\n background-size: 200% 100%;\n animation: shimmer-text 1.4s linear infinite;\n}\n\n.brandShimmer {\n @apply via-text-brand-primary to-text-tertiary;\n}\n\n@keyframes pixel-on {\n 0%,\n 100% {\n opacity: 0.15;\n }\n 18%,\n 42% {\n opacity: 1;\n }\n 62% {\n opacity: 0.15;\n }\n}\n\n@keyframes shimmer-text {\n from {\n background-position: 150% 50%;\n }\n to {\n background-position: -50% 50%;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .pixel,\n .shimmer {\n animation: none;\n }\n\n .pixel:not(.inactive) {\n opacity: 0.5;\n }\n .shimmer {\n @apply text-secondary;\n background: none;\n }\n}\n\n@media (forced-colors: active) {\n .shimmer {\n background: none;\n color: CanvasText;\n }\n .pixel {\n background: CanvasText;\n }\n}\n","// Adapted from TurboKach/ai-native-react-components (MIT). See NOTICE.\nimport { forwardRef } from 'react';\nimport type { ComponentPropsWithRef, CSSProperties } from 'react';\n\nimport { cn } from '../../utils/cn';\nimport { VISUAL_ELEMENT_SIZES } from '../../utils/componentSizes';\n\nimport styles from './ThinkingState.module.css';\n\ntype ThinkingStateVariant = 'drive' | 'dots' | 'orbit';\n\nconst SIZES = {\n sm: VISUAL_ELEMENT_SIZES.xs.className,\n md: VISUAL_ELEMENT_SIZES.sm.className,\n lg: VISUAL_ELEMENT_SIZES.md.className,\n};\n\ninterface LoadingIndicatorProps extends Omit<\n ComponentPropsWithRef<'span'>,\n 'children'\n> {\n variant?: ThinkingStateVariant;\n /** Indicator outer size: sm=16px, md=20px, lg=24px. */\n size?: keyof typeof SIZES;\n tone?: 'neutral' | 'brand';\n /** Reduced-motion preferences always take precedence. */\n animated?: boolean;\n}\n\nconst CHEVRON_DELAYS = [90, 180, 270, 0, 90, 180, 90, 180, 270];\nconst PATTERNS: Record<\n ThinkingStateVariant,\n { delays: (number | null)[]; duration: string }\n> = {\n drive: { delays: CHEVRON_DELAYS, duration: '650ms' },\n dots: { delays: CHEVRON_DELAYS, duration: '650ms' },\n orbit: {\n delays: [0, 110, 220, 770, null, 330, 660, 550, 440],\n duration: '950ms',\n },\n};\n\ninterface IndicatorStyle extends CSSProperties {\n '--loading-cycle': string;\n}\n\n/** Decorative indicator. Announce loading on the surrounding control or region. */\nconst LoadingIndicator = forwardRef<HTMLSpanElement, LoadingIndicatorProps>(\n function LoadingIndicator(\n {\n variant = 'drive',\n size = 'sm',\n tone = 'neutral',\n animated = true,\n className,\n style,\n ...props\n },\n ref\n ) {\n const pattern = PATTERNS[variant];\n const indicatorStyle: IndicatorStyle = {\n '--loading-cycle': pattern.duration,\n ...style,\n };\n\n return (\n <span\n {...props}\n ref={ref}\n aria-hidden=\"true\"\n data-animated={animated}\n className={cn(\n styles.grid,\n SIZES[size],\n 'shrink-0',\n tone === 'brand' ? 'text-icon-brand' : 'text-icon-primary',\n className\n )}\n style={indicatorStyle}\n >\n {pattern.delays.map((delay, index) => (\n <span\n key={index}\n className={cn(\n styles.pixel,\n 'bg-current',\n variant === 'dots' && styles.dot,\n delay === null && styles.inactive\n )}\n style={{ animationDelay: `${delay ?? 0}ms` }}\n />\n ))}\n </span>\n );\n }\n);\n\nexport { LoadingIndicator };\nexport type { LoadingIndicatorProps, ThinkingStateVariant };\n"],"mappings":";;;;;;;;;;;;;;;;ACWA,IAAM,QAAQ;CACZ,IAAI,qBAAqB,GAAG;CAC5B,IAAI,qBAAqB,GAAG;CAC5B,IAAI,qBAAqB,GAAG;AAC9B;AAcA,IAAM,iBAAiB;CAAC;CAAI;CAAK;CAAK;CAAG;CAAI;CAAK;CAAI;CAAK;AAAG;AAC9D,IAAM,WAGF;CACF,OAAO;EAAE,QAAQ;EAAgB,UAAU;CAAQ;CACnD,MAAM;EAAE,QAAQ;EAAgB,UAAU;CAAQ;CAClD,OAAO;EACL,QAAQ;GAAC;GAAG;GAAK;GAAK;GAAK;GAAM;GAAK;GAAK;GAAK;EAAG;EACnD,UAAU;CACZ;AACF;;AAOA,IAAM,mBAAmB,WACvB,SAAS,iBACP,EACE,UAAU,SACV,OAAO,MACP,OAAO,WACP,WAAW,MACX,WACA,OACA,GAAG,SAEL,KACA;CACA,MAAM,UAAU,SAAS;CACzB,MAAM,iBAAiC;EACrC,mBAAmB,QAAQ;EAC3B,GAAG;CACL;CAEA,OACE,oBAAC,QAAD;EACE,GAAI;EACC;EACL,eAAY;EACZ,iBAAe;EACf,WAAW,GACT,6BAAO,MACP,MAAM,OACN,YACA,SAAS,UAAU,oBAAoB,qBACvC,SACF;EACA,OAAO;EAEN,UAAA,QAAQ,OAAO,KAAK,OAAO,UAC1B,oBAAC,QAAD;GAEE,WAAW,GACT,6BAAO,OACP,cACA,YAAY,UAAU,6BAAO,KAC7B,UAAU,QAAQ,6BAAO,QAC3B;GACA,OAAO,EAAE,gBAAgB,GAAG,SAAS,EAAE,IAAI;EAC5C,GARM,KAQN,CACF;CACG,CAAA;AAEV,CACF"}
|