@langchain/macaw-components 1.0.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base.css +5 -5
- package/dist/catalog.json +535 -480
- package/dist/components/Accordion/Accordion.d.ts +63 -0
- package/dist/components/Accordion/Accordion.js +170 -0
- package/dist/components/Accordion/Accordion.js.map +1 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/Accordion/index.js +2 -0
- package/dist/components/Attachment/Attachment.js +3 -3
- package/dist/components/Avatar/Avatar.js +1 -1
- package/dist/components/Banner/Banner.js +2 -2
- package/dist/components/Button/Button.js +2 -2
- package/dist/components/Button/constants.js +2 -2
- package/dist/components/Button/constants.js.map +1 -1
- package/dist/components/ChartCard/ChartCard.js +2 -2
- package/dist/components/ChartLegend/ChartLegend.js +1 -1
- package/dist/components/ChartTooltip/ChartTooltip.js +2 -2
- package/dist/components/ChartTooltip/ChartTooltip.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.js +1 -1
- package/dist/components/Code/CodeLite.js +2 -2
- package/dist/components/Code/index.js +1 -1
- package/dist/components/Command/Command.js +1 -1
- package/dist/components/Command/Command.js.map +1 -1
- package/dist/components/Command/CommandMenu.js +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +1 -1
- package/dist/components/ContextMenu/ContextMenu.js.map +1 -1
- package/dist/components/CopyButton/CopyButton.d.ts +3 -2
- package/dist/components/CopyButton/CopyButton.js +7 -2
- package/dist/components/CopyButton/CopyButton.js.map +1 -1
- package/dist/components/Dialog/index.d.ts +3 -2
- package/dist/components/Dialog/index.js +47 -20
- package/dist/components/Dialog/index.js.map +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +3 -3
- package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/components/ErrorMessage/ErrorMessage.js +3 -3
- package/dist/components/GroupedTabs/GroupedTabs.d.ts +3 -2
- package/dist/components/GroupedTabs/GroupedTabs.js +3 -1
- package/dist/components/GroupedTabs/GroupedTabs.js.map +1 -1
- package/dist/components/IconButton/IconButton.js +2 -2
- package/dist/components/Input/Input.js +8 -7
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/Input/inputStyles.js +4 -4
- package/dist/components/Input/inputStyles.js.map +1 -1
- package/dist/components/Link/Link.js +3 -3
- package/dist/components/Link/Link.js.map +1 -1
- package/dist/components/Pane/Pane.d.ts +3 -2
- package/dist/components/Pane/Pane.js +109 -103
- package/dist/components/Pane/Pane.js.map +1 -1
- package/dist/components/Popover/Popover.js +15 -4
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/Popover/constants.d.ts +1 -1
- package/dist/components/Popover/constants.js +1 -1
- package/dist/components/Popover/constants.js.map +1 -1
- package/dist/components/Select/Select.d.ts +10 -1
- package/dist/components/Select/Select.js +7 -5
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/SelectPrimitive.js +6 -4
- package/dist/components/Select/SelectPrimitive.js.map +1 -1
- package/dist/components/Select/index.d.ts +1 -1
- package/dist/components/SplitViewPane/SplitViewPaneHeader.js +2 -2
- package/dist/components/StatusBadge/StatusBadge.d.ts +27 -0
- package/dist/components/StatusBadge/StatusBadge.js +42 -0
- package/dist/components/StatusBadge/StatusBadge.js.map +1 -0
- package/dist/components/StatusBadge/index.d.ts +2 -0
- package/dist/components/StatusBadge/index.js +2 -0
- package/dist/components/Tabs/index.d.ts +3 -2
- package/dist/components/Tabs/index.js +3 -1
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Textarea/Textarea.js +8 -8
- package/dist/components/Textarea/Textarea.js.map +1 -1
- package/dist/components/Toast/index.js +3 -3
- package/dist/components/Toast/index.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +2 -2
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/Typeahead/TypeaheadParts.js +2 -2
- package/dist/components/Typeahead/TypeaheadView.js +10 -10
- package/dist/components/Typeahead/TypeaheadView.js.map +1 -1
- package/dist/components/UnsavedChangesDialog.js +2 -2
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +7 -6
- package/dist/icons/LongTailPhosphorIcons.js +1 -1
- package/dist/icons/PaddedPhosphorIcons.js +2 -2
- package/dist/index.js +7 -6
- package/dist/utilities.css +1 -1
- package/dist/utils/ModalLayerContext.d.ts +23 -0
- package/dist/utils/ModalLayerContext.js +92 -0
- package/dist/utils/ModalLayerContext.js.map +1 -0
- package/dist/utils/cn.js +4 -0
- package/dist/utils/cn.js.map +1 -1
- package/dist/utils/dataAttributes.d.ts +9 -0
- package/dist/utils/dataAttributes.js +13 -0
- package/dist/utils/dataAttributes.js.map +1 -0
- package/docs/DESIGN.md +21 -1
- package/docs/STYLES.md +84 -44
- package/package.json +20 -3
- package/tailwind.preset.cjs +11 -5
package/dist/utils/cn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cn.js","names":[],"sources":["../../src/utils/cn.tsx"],"sourcesContent":["import type { ClassValue } from 'clsx';\nimport { clsx } from 'clsx';\nimport { extendTailwindMerge } from 'tailwind-merge';\n\n/** Numeric brand palette keys from `theme.colors.brand` (Tailwind). */\nconst BRAND_PALETTE_STEPS = [\n '10',\n '25',\n '50',\n '75',\n '100',\n '200',\n '300',\n '400',\n '500',\n '600',\n '700',\n '800',\n '900',\n '950',\n] as const;\n\nconst brandBgClasses = BRAND_PALETTE_STEPS.map((step) => `bg-brand-${step}`);\nconst brandBorderClasses = BRAND_PALETTE_STEPS.map(\n (step) => `border-brand-${step}`\n);\nconst brandTextClasses = BRAND_PALETTE_STEPS.map(\n (step) => `text-brand-${step}`\n);\nconst buttonBorderColorClasses = [\n 'button-primary-underlined-border',\n 'button-primary-underlined-border-hover',\n 'button-secondary-underlined-border',\n 'button-secondary-underlined-border-hover',\n 'button-error-border',\n 'button-error-outlined-border',\n 'button-error-underlined-border',\n 'button-error-underlined-border-hover',\n 'button-error-disabled-border',\n];\nconst buttonTextColorClasses = [\n 'button-primary-underlined-foreground',\n 'button-primary-underlined-foreground-hover',\n 'button-error-underlined-foreground-hover',\n 'button-error-disabled-foreground',\n];\n\n// Lets `space-*` tokens dedupe against built-in spacing (keep in sync with tailwind.config.js).\nconst SPACE_SCALE_STEPS = [\n 'space-1',\n 'space-2',\n 'space-3',\n 'space-4',\n 'space-5',\n 'space-6',\n 'space-7',\n 'space-8',\n 'space-9',\n];\n\nconst customTwMerge = extendTailwindMerge({\n extend: {\n theme: {\n spacing: SPACE_SCALE_STEPS,\n shadow: ['slider-thumb'],\n },\n classGroups: {\n // Extend font-size to include custom display and caps classes\n 'font-size': [\n 'display-sm',\n 'display-base',\n 'display-lg',\n 'display-xl',\n 'display-2xl',\n 'caps-label-sm',\n 'caps-label-xs',\n 'text-xxs',\n 'text-xs',\n 'text-sm',\n 'text-base',\n 'text-lg',\n 'text-xl',\n ],\n // Extend bg-color to include custom background colors\n 'bg-color': [\n 'bg-primary',\n 'bg-primary-hover',\n 'bg-secondary',\n 'bg-secondary-hover',\n 'bg-tertiary',\n 'bg-quaternary',\n 'bg-surface-level-1',\n 'bg-surface-level-1-hover',\n 'bg-surface-level-2',\n 'bg-surface-level-2-hover',\n 'bg-surface-level-3',\n 'bg-surface-level-4',\n 'bg-disabled',\n 'bg-elevated',\n 'bg-elevated-hover',\n 'bg-elevated-selected',\n 'bg-overlay',\n 'bg-brand',\n 'bg-brand-hover',\n 'bg-brand-subtle',\n 'bg-brand-subtle-gradient',\n 'bg-brand-subtle-hover',\n 'bg-brand-illustration',\n 'bg-brand-muted',\n 'bg-brand-primary',\n 'bg-brand-primary-hover',\n 'bg-brand-secondary',\n 'bg-brand-secondary-hover',\n 'bg-brand-tertiary',\n 'bg-purple',\n 'bg-success',\n 'bg-success-subtle',\n 'bg-success-primary',\n 'bg-success-secondary',\n 'bg-success-strong',\n 'bg-error',\n 'bg-error-subtle',\n 'bg-error-primary',\n 'bg-error-secondary',\n 'bg-error-strong',\n 'button-error-bg-hover',\n 'bg-warning',\n 'bg-warning-subtle',\n 'bg-warning-primary',\n 'bg-warning-secondary',\n 'bg-warning-strong',\n 'bg-control-active',\n 'bg-control-active-hover',\n 'bg-control-thumb',\n 'bg-control-disabled',\n 'bg-selected',\n 'bg-selected-hover',\n ...brandBgClasses,\n ],\n // Extend border-color to include custom border colors\n 'border-color': [\n 'border-default',\n 'border-subtle',\n 'border-muted',\n 'border-faint',\n 'border-primary',\n 'border-secondary',\n 'border-tertiary',\n 'border-quaternary',\n 'border-error',\n 'border-error-strong',\n 'border-brand',\n 'border-brand-strong',\n 'border-brand-subtle',\n 'border-strong',\n 'border-disabled',\n 'border-focus',\n 'border-warning',\n 'border-success',\n 'border-purple',\n 'border-status-green',\n 'border-status-orange',\n 'border-status-yellow',\n 'border-status-red',\n ...brandBorderClasses,\n ...buttonBorderColorClasses,\n ],\n // Extend text-color to include custom text colors\n 'text-color': [\n 'text-primary',\n 'text-secondary',\n 'text-tertiary',\n 'text-quaternary',\n 'text-disabled',\n 'text-error-secondary',\n 'text-warning-secondary',\n 'text-success-secondary',\n 'text-placeholder',\n 'text-control-active-foreground',\n 'text-purple',\n 'text-brand-primary',\n 'text-brand-secondary',\n 'text-brand-tertiary',\n 'text-brand-disabled',\n 'text-brand-on-fill',\n 'text-link',\n 'text-link-hover',\n 'text-status-green',\n 'text-status-orange',\n 'text-status-yellow',\n 'text-status-red',\n 'text-button-primary',\n 'text-icon-primary',\n 'text-icon-secondary',\n 'text-icon-tertiary',\n 'text-icon-disabled',\n 'text-icon-brand',\n 'text-icon-error',\n 'text-icon-success',\n 'text-icon-warning',\n ...brandTextClasses,\n ...buttonTextColorClasses,\n ],\n },\n },\n});\n\nexport const cn = (...inputs: ClassValue[]) => {\n return customTwMerge(clsx(inputs));\n};\n"],"mappings":";;;;AAKA,IAAM,sBAAsB;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,IAAM,iBAAiB,oBAAoB,KAAK,SAAS,YAAY,MAAM;AAC3E,IAAM,qBAAqB,oBAAoB,KAC5C,SAAS,gBAAgB,MAC5B;AACA,IAAM,mBAAmB,oBAAoB,KAC1C,SAAS,cAAc,MAC1B;AACA,IAAM,2BAA2B;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,IAAM,yBAAyB;CAC7B;CACA;CACA;CACA;AACF;AAeA,IAAM,gBAAgB,oBAAoB,EACxC,QAAQ;CACN,OAAO;EACL,SAAS;GAdb;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EAMa;EACT,QAAQ,CAAC,cAAc;CACzB;CACA,aAAa;EAEX,aAAa;GACX;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EAEA,YAAY;GACV;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,GAAG;EACL;EAEA,gBAAgB;GACd;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,GAAG;GACH,GAAG;EACL;EAEA,cAAc;GACZ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,GAAG;GACH,GAAG;EACL;CACF;AACF,EACF,CAAC;AAED,IAAa,MAAM,GAAG,WAAyB;CAC7C,OAAO,cAAc,KAAK,MAAM,CAAC;AACnC"}
|
|
1
|
+
{"version":3,"file":"cn.js","names":[],"sources":["../../src/utils/cn.tsx"],"sourcesContent":["import type { ClassValue } from 'clsx';\nimport { clsx } from 'clsx';\nimport { extendTailwindMerge } from 'tailwind-merge';\n\n/** Numeric brand palette keys from `theme.colors.brand` (Tailwind). */\nconst BRAND_PALETTE_STEPS = [\n '10',\n '25',\n '50',\n '75',\n '100',\n '200',\n '300',\n '400',\n '500',\n '600',\n '700',\n '800',\n '900',\n '950',\n] as const;\n\nconst brandBgClasses = BRAND_PALETTE_STEPS.map((step) => `bg-brand-${step}`);\nconst brandBorderClasses = BRAND_PALETTE_STEPS.map(\n (step) => `border-brand-${step}`\n);\nconst brandTextClasses = BRAND_PALETTE_STEPS.map(\n (step) => `text-brand-${step}`\n);\nconst buttonBorderColorClasses = [\n 'button-primary-underlined-border',\n 'button-primary-underlined-border-hover',\n 'button-secondary-border',\n 'button-secondary-border-hover',\n 'button-secondary-underlined-border',\n 'button-secondary-underlined-border-hover',\n 'button-error-border',\n 'button-error-outlined-border',\n 'button-error-underlined-border',\n 'button-error-underlined-border-hover',\n 'button-error-disabled-border',\n];\nconst buttonTextColorClasses = [\n 'button-primary-underlined-foreground',\n 'button-primary-underlined-foreground-hover',\n 'button-error-underlined-foreground-hover',\n 'button-error-disabled-foreground',\n];\n\n// Lets `space-*` tokens dedupe against built-in spacing (keep in sync with tailwind.config.js).\nconst SPACE_SCALE_STEPS = [\n 'space-1',\n 'space-2',\n 'space-3',\n 'space-4',\n 'space-5',\n 'space-6',\n 'space-7',\n 'space-8',\n 'space-9',\n];\n\nconst customTwMerge = extendTailwindMerge({\n extend: {\n theme: {\n spacing: SPACE_SCALE_STEPS,\n shadow: ['slider-thumb'],\n },\n classGroups: {\n // Extend font-size to include custom display and caps classes\n 'font-size': [\n 'display-sm',\n 'display-base',\n 'display-lg',\n 'display-xl',\n 'display-2xl',\n 'caps-label-sm',\n 'caps-label-xs',\n 'text-xxs',\n 'text-xs',\n 'text-sm',\n 'text-base',\n 'text-lg',\n 'text-xl',\n ],\n // Extend bg-color to include custom background colors\n 'bg-color': [\n 'bg-primary',\n 'bg-primary-hover',\n 'bg-secondary',\n 'bg-secondary-hover',\n 'bg-tertiary',\n 'bg-quaternary',\n 'bg-surface-level-1',\n 'bg-surface-level-1-hover',\n 'bg-surface-level-2',\n 'bg-surface-level-2-hover',\n 'bg-surface-level-3',\n 'bg-surface-level-4',\n 'bg-disabled',\n 'bg-input',\n 'bg-input-disabled',\n 'bg-elevated',\n 'bg-elevated-hover',\n 'bg-elevated-selected',\n 'bg-overlay',\n 'bg-brand',\n 'bg-brand-hover',\n 'bg-brand-subtle',\n 'bg-brand-subtle-gradient',\n 'bg-brand-subtle-hover',\n 'bg-brand-illustration',\n 'bg-brand-muted',\n 'bg-brand-primary',\n 'bg-brand-primary-hover',\n 'bg-brand-secondary',\n 'bg-brand-secondary-hover',\n 'bg-brand-tertiary',\n 'bg-purple',\n 'bg-success',\n 'bg-success-subtle',\n 'bg-success-primary',\n 'bg-success-secondary',\n 'bg-success-strong',\n 'bg-error',\n 'bg-error-subtle',\n 'bg-error-primary',\n 'bg-error-secondary',\n 'bg-error-strong',\n 'button-error-bg-hover',\n 'bg-warning',\n 'bg-warning-subtle',\n 'bg-warning-primary',\n 'bg-warning-secondary',\n 'bg-warning-strong',\n 'bg-control-active',\n 'bg-control-active-hover',\n 'bg-control-thumb',\n 'bg-control-disabled',\n 'bg-selected',\n 'bg-selected-hover',\n ...brandBgClasses,\n ],\n // Extend border-color to include custom border colors\n 'border-color': [\n 'border-default',\n 'border-subtle',\n 'border-muted',\n 'border-faint',\n 'border-primary',\n 'border-secondary',\n 'border-tertiary',\n 'border-quaternary',\n 'border-error',\n 'border-error-strong',\n 'border-brand',\n 'border-brand-strong',\n 'border-brand-subtle',\n 'border-strong',\n 'border-disabled',\n 'border-focus',\n 'border-warning',\n 'border-success',\n 'border-purple',\n 'border-status-green',\n 'border-status-orange',\n 'border-status-yellow',\n 'border-status-red',\n ...brandBorderClasses,\n ...buttonBorderColorClasses,\n ],\n // Extend text-color to include custom text colors\n 'text-color': [\n 'text-primary',\n 'text-secondary',\n 'text-tertiary',\n 'text-quaternary',\n 'text-disabled',\n 'text-error-secondary',\n 'text-warning-secondary',\n 'text-success-secondary',\n 'text-placeholder',\n 'text-control-active-foreground',\n 'text-purple',\n 'text-brand-primary',\n 'text-brand-secondary',\n 'text-brand-tertiary',\n 'text-brand-disabled',\n 'text-brand-on-fill',\n 'text-link',\n 'text-link-hover',\n 'text-status-green',\n 'text-status-orange',\n 'text-status-yellow',\n 'text-status-red',\n 'text-button-primary',\n 'text-icon-primary',\n 'text-icon-secondary',\n 'text-icon-tertiary',\n 'text-icon-disabled',\n 'text-icon-brand',\n 'text-icon-error',\n 'text-icon-success',\n 'text-icon-warning',\n ...brandTextClasses,\n ...buttonTextColorClasses,\n ],\n },\n },\n});\n\nexport const cn = (...inputs: ClassValue[]) => {\n return customTwMerge(clsx(inputs));\n};\n"],"mappings":";;;;AAKA,IAAM,sBAAsB;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,IAAM,iBAAiB,oBAAoB,KAAK,SAAS,YAAY,MAAM;AAC3E,IAAM,qBAAqB,oBAAoB,KAC5C,SAAS,gBAAgB,MAC5B;AACA,IAAM,mBAAmB,oBAAoB,KAC1C,SAAS,cAAc,MAC1B;AACA,IAAM,2BAA2B;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AACA,IAAM,yBAAyB;CAC7B;CACA;CACA;CACA;AACF;AAeA,IAAM,gBAAgB,oBAAoB,EACxC,QAAQ;CACN,OAAO;EACL,SAAS;GAdb;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EAMa;EACT,QAAQ,CAAC,cAAc;CACzB;CACA,aAAa;EAEX,aAAa;GACX;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EAEA,YAAY;GACV;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,GAAG;EACL;EAEA,gBAAgB;GACd;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,GAAG;GACH,GAAG;EACL;EAEA,cAAc;GACZ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,GAAG;GACH,GAAG;EACL;CACF;AACF,EACF,CAAC;AAED,IAAa,MAAM,GAAG,WAAyB;CAC7C,OAAO,cAAc,KAAK,MAAM,CAAC;AACnC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type DataAttributes = {
|
|
2
|
+
readonly [key: `data-${string}`]: string | number | boolean | undefined;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Keeps only `data-*` keys, so components can forward consumer data
|
|
6
|
+
* attributes to the DOM without also forwarding stray props from untyped
|
|
7
|
+
* callers.
|
|
8
|
+
*/
|
|
9
|
+
export declare function pickDataAttributes(props: object): DataAttributes;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region packages/components/src/utils/dataAttributes.ts
|
|
2
|
+
/**
|
|
3
|
+
* Keeps only `data-*` keys, so components can forward consumer data
|
|
4
|
+
* attributes to the DOM without also forwarding stray props from untyped
|
|
5
|
+
* callers.
|
|
6
|
+
*/
|
|
7
|
+
function pickDataAttributes(props) {
|
|
8
|
+
return Object.fromEntries(Object.entries(props).filter(([key]) => key.startsWith("data-")));
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { pickDataAttributes };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=dataAttributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataAttributes.js","names":[],"sources":["../../src/utils/dataAttributes.ts"],"sourcesContent":["export type DataAttributes = {\n readonly [key: `data-${string}`]: string | number | boolean | undefined;\n};\n\n/**\n * Keeps only `data-*` keys, so components can forward consumer data\n * attributes to the DOM without also forwarding stray props from untyped\n * callers.\n */\nexport function pickDataAttributes(props: object): DataAttributes {\n return Object.fromEntries(\n Object.entries(props).filter(([key]) => key.startsWith('data-'))\n );\n}\n"],"mappings":";;;;;;AASA,SAAgB,mBAAmB,OAA+B;CAChE,OAAO,OAAO,YACZ,OAAO,QAAQ,KAAK,CAAC,CAAC,QAAQ,CAAC,SAAS,IAAI,WAAW,OAAO,CAAC,CACjE;AACF"}
|
package/docs/DESIGN.md
CHANGED
|
@@ -67,6 +67,19 @@ Use existing components for their interaction contracts, not just their appearan
|
|
|
67
67
|
|
|
68
68
|
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.
|
|
69
69
|
|
|
70
|
+
## Nested modals
|
|
71
|
+
|
|
72
|
+
Wrap a related workflow in `ModalProvider` from `@langchain/macaw-components/Dialog`
|
|
73
|
+
to limit it to two visible modal layers. Dialog and modal Pane share the stack
|
|
74
|
+
across portals and sibling roots. A further dialog replaces the foreground layer;
|
|
75
|
+
dismissing it restores the editor with its mounted state. Popovers, tooltips,
|
|
76
|
+
and non-modal SplitViewPane panels do not consume a layer.
|
|
77
|
+
Popover collision handling uses its enclosing Dialog as the boundary by default;
|
|
78
|
+
pass an explicit `collisionBoundary` to override it.
|
|
79
|
+
|
|
80
|
+
The base backdrop uses 75% of the semantic overlay color. The foreground layer
|
|
81
|
+
adds 50% of that color, giving a visible increase in dimming in both themes.
|
|
82
|
+
|
|
70
83
|
## Code editors
|
|
71
84
|
|
|
72
85
|
Import `Code`, `CodeToolbar`, and `CodeLanguageSelect` from
|
|
@@ -107,7 +120,11 @@ Component code uses semantic tokens through Tailwind utilities. Do not use primi
|
|
|
107
120
|
Choose color by meaning:
|
|
108
121
|
|
|
109
122
|
- `bg-surface-level-1..4` expresses nesting. Use the lowest level that creates enough separation.
|
|
110
|
-
- `bg-
|
|
123
|
+
- `bg-sidebar` is reserved for app navigation, independent of fields and floating surfaces.
|
|
124
|
+
- `bg-elevated` is for raised cards and panes; `bg-elevated-hover` and `bg-elevated-selected` are interaction states within raised or floating surfaces.
|
|
125
|
+
- `bg-input` is for Input and Textarea fields, Select and Typeahead controls. Select and Typeahead own their field styles; Button does not infer appearance from ARIA attributes. Custom Button-based picker migration is deferred; prefer Select for standard pickers. Action-menu buttons retain their normal button styles. Embedded inputs can use `inputContainerClassName="border-0 bg-transparent"`; embedded Textarea uses `variant="plain"`. Plain button triggers remain transparent.
|
|
126
|
+
- `bg-input-disabled` is for disabled fields, paired with `border-muted` and disabled text/icon colors. Do not fade the entire field with opacity.
|
|
127
|
+
- `bg-popover` is for floating overlays: tooltips (including chart tooltips), popovers, select and typeahead menus, dropdowns, context menus, and command menus. It is independent of the field fill even when the colors match.
|
|
111
128
|
- Success, warning, and error tokens describe general feedback and validation.
|
|
112
129
|
- Status tokens describe run or system state, not generic validation.
|
|
113
130
|
- `text-*` is for copy; `text-icon-*` is for standalone icons.
|
|
@@ -148,6 +165,9 @@ Use the 4-point `space-*` scale through utilities such as `gap-space-4` and `px-
|
|
|
148
165
|
|
|
149
166
|
Use named `rounded-*`, `shadow-*`, and duration utilities instead of recreating their values. Motion should explain a state change and respect `prefers-reduced-motion`. Use named values from `packages/components/src/utils/zIndices.ts` or `useZIndex` instead of numeric z-indexes.
|
|
150
167
|
|
|
168
|
+
Decorative elevation shadows are light-mode only. In dark mode, use surface
|
|
169
|
+
contrast and borders; preserve focus, selection, and error indicators.
|
|
170
|
+
|
|
151
171
|
Component size names are family-specific. Use the tiers supported by the component; do not infer a universal size scale. `packages/components/src/utils/componentSizes.ts` is the source of truth for shared outer-size families.
|
|
152
172
|
|
|
153
173
|
## Quality bar
|
package/docs/STYLES.md
CHANGED
|
@@ -126,34 +126,37 @@ Use this table for new or meaningfully touched UI. Existing code still contains
|
|
|
126
126
|
deprecated aliases during migration; do not churn unrelated call sites just to
|
|
127
127
|
rename classes.
|
|
128
128
|
|
|
129
|
-
| Situation
|
|
130
|
-
|
|
|
131
|
-
| Page / app shell background
|
|
132
|
-
| Card, panel
|
|
133
|
-
|
|
|
134
|
-
|
|
|
135
|
-
|
|
|
136
|
-
|
|
|
137
|
-
|
|
|
138
|
-
|
|
|
139
|
-
|
|
|
140
|
-
|
|
|
141
|
-
|
|
|
142
|
-
|
|
|
143
|
-
|
|
|
144
|
-
|
|
|
145
|
-
|
|
|
146
|
-
|
|
|
147
|
-
|
|
|
148
|
-
|
|
|
149
|
-
|
|
|
150
|
-
|
|
|
151
|
-
|
|
|
152
|
-
|
|
|
153
|
-
|
|
|
154
|
-
|
|
|
155
|
-
|
|
|
156
|
-
|
|
|
129
|
+
| Situation | Class |
|
|
130
|
+
| --------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
|
|
131
|
+
| Page / app shell background | `bg-surface-level-1` |
|
|
132
|
+
| Card, panel | `bg-surface-level-2` |
|
|
133
|
+
| App navigation sidebar | `bg-sidebar` |
|
|
134
|
+
| Raised card, pane | `bg-elevated` |
|
|
135
|
+
| Input, textarea, select/typeahead control, filled popup trigger | `bg-input` |
|
|
136
|
+
| Tooltip, popover, select/typeahead menu, dropdown, context/command menu | `bg-popover` |
|
|
137
|
+
| Modal scrim / backdrop | `bg-overlay` for new overlays; some current overlays still use opacity classes |
|
|
138
|
+
| Non-Button brand fill | `bg-brand`; use `<Button />` for CTAs |
|
|
139
|
+
| Tinted brand surface | `bg-brand-subtle` |
|
|
140
|
+
| Tinted brand gradient surface | `bg-brand-subtle-gradient` |
|
|
141
|
+
| Branded illustration backdrop | `bg-brand-illustration` |
|
|
142
|
+
| Purple accent surface | `bg-purple` |
|
|
143
|
+
| Success / Error / Warning tint | `bg-success` / `bg-error` / `bg-warning` |
|
|
144
|
+
| Filled success / error / warning | `bg-success-strong` / `bg-error-strong` / `bg-warning-strong` |
|
|
145
|
+
| Control on-state | `bg-control-active` for new control internals |
|
|
146
|
+
| Selected list item | `bg-selected` for new selection states |
|
|
147
|
+
| Body text | `text-primary` |
|
|
148
|
+
| Secondary / label text | `text-secondary` |
|
|
149
|
+
| Placeholder text | `text-placeholder` |
|
|
150
|
+
| Disabled text | `text-disabled` |
|
|
151
|
+
| Standalone default icon | `text-icon-primary`; icons may inherit text color when paired with labels |
|
|
152
|
+
| Default structural/control border | `border-default`; older controls often still use `border-secondary` |
|
|
153
|
+
| Focus border token | `border-focus`; many current controls still use `border-brand` / `ring-brand` |
|
|
154
|
+
| Error state border | `border-error` |
|
|
155
|
+
| Disabled border | `border-disabled` |
|
|
156
|
+
| Run/system status text | `text-status-green` / `text-status-orange` / `text-status-yellow` / `text-status-red` |
|
|
157
|
+
| Low elevation for floating controls or interaction states | `shadow-sm` |
|
|
158
|
+
| Dropdown / popover shadow | `shadow-md` |
|
|
159
|
+
| Modal / dialog shadow | `shadow-lg` |
|
|
157
160
|
|
|
158
161
|
---
|
|
159
162
|
|
|
@@ -212,7 +215,7 @@ when a semantic row such as “Other” must stay last regardless of value.
|
|
|
212
215
|
|
|
213
216
|
When a chart needs hover or focus details, compose its content with
|
|
214
217
|
`ChartTooltip`, `ChartTooltipHeader`, `ChartTooltipBody`, and
|
|
215
|
-
`ChartTooltipRow` from `@langchain/macaw-components`. Do not recreate the
|
|
218
|
+
`ChartTooltipRow` from `@langchain/macaw-components`. Do not recreate the popover surface,
|
|
216
219
|
spacing, typography, markers, dividers, or numeric alignment in a feature-local
|
|
217
220
|
tooltip component.
|
|
218
221
|
|
|
@@ -245,19 +248,46 @@ Use for background fills of layout regions.
|
|
|
245
248
|
|
|
246
249
|
Use the lowest level that creates enough separation. Avoid skipping levels unless matching an existing nested table or grouping pattern.
|
|
247
250
|
|
|
248
|
-
| Class | When to use
|
|
249
|
-
| -------------------------- |
|
|
250
|
-
| `bg-surface-level-1` | Root page / app shell background
|
|
251
|
-
| `bg-surface-level-1-hover` | Hover state on level 1 surface
|
|
252
|
-
| `bg-surface-level-2` | Cards, panels,
|
|
253
|
-
| `bg-surface-level-2-hover` | Hover state on level 2 surface
|
|
254
|
-
| `bg-surface-level-3` | Nested table headers or grouped inner containers
|
|
255
|
-
| `bg-surface-level-4` | Deepest neutral fill for additional separation
|
|
256
|
-
| `bg-disabled` | Disabled input or control fill
|
|
257
|
-
| `bg-elevated` |
|
|
258
|
-
| `bg-
|
|
259
|
-
| `bg-
|
|
260
|
-
| `bg-
|
|
251
|
+
| Class | When to use |
|
|
252
|
+
| -------------------------- | ----------------------------------------------------------------- |
|
|
253
|
+
| `bg-surface-level-1` | Root page / app shell background |
|
|
254
|
+
| `bg-surface-level-1-hover` | Hover state on level 1 surface |
|
|
255
|
+
| `bg-surface-level-2` | Cards, panels, table header groups |
|
|
256
|
+
| `bg-surface-level-2-hover` | Hover state on level 2 surface |
|
|
257
|
+
| `bg-surface-level-3` | Nested table headers or grouped inner containers |
|
|
258
|
+
| `bg-surface-level-4` | Deepest neutral fill for additional separation |
|
|
259
|
+
| `bg-disabled` | Disabled input or control fill |
|
|
260
|
+
| `bg-elevated` | Raised cards and panes |
|
|
261
|
+
| `bg-input` | Input and textarea fields, picker controls, filled popup triggers |
|
|
262
|
+
| `bg-input-disabled` | Disabled field fill, independent of general disabled controls |
|
|
263
|
+
| `bg-elevated-hover` | Hover state inside a raised or floating surface |
|
|
264
|
+
| `bg-elevated-selected` | Selected item inside a raised or floating surface |
|
|
265
|
+
| `bg-popover` | Floating tooltips, popovers, and menu surfaces |
|
|
266
|
+
| `bg-sidebar` | App navigation sidebar surface |
|
|
267
|
+
| `bg-overlay` | Modal backdrop / scrim |
|
|
268
|
+
|
|
269
|
+
`bg-sidebar` is reserved for app navigation: `neutral-50` in light mode and
|
|
270
|
+
`neutral-35` in dark mode, independent of fields, popovers, and raised surfaces.
|
|
271
|
+
|
|
272
|
+
`bg-input` and `bg-popover` use `neutral-25` in light mode and `neutral-100` in
|
|
273
|
+
dark mode but remain independent semantic roles. Light-mode hover and selection
|
|
274
|
+
fills use `neutral-100`; raised `bg-elevated` surfaces stay white. Outlined fields
|
|
275
|
+
use `border-muted` at rest and `border-subtle` on hover in
|
|
276
|
+
both themes, with semantic focus and error indicators. Outlined fields use a
|
|
277
|
+
1px outer focus ring; native inputs stay unoutlined inside their containers.
|
|
278
|
+
Use `text-placeholder` for field hints. Plain fields remain borderless at rest.
|
|
279
|
+
This applies to Input, Textarea, Select, and Typeahead, including multi-value fields.
|
|
280
|
+
Select and Typeahead own their field treatment; Button does not infer appearance
|
|
281
|
+
from ARIA attributes. Custom Button-based picker migration is deferred: prefer
|
|
282
|
+
Select for standard pickers, and consider a shared field trigger for custom menus.
|
|
283
|
+
Custom picker and action-menu buttons keep their normal button fill and border.
|
|
284
|
+
Disabled fields use
|
|
285
|
+
`bg-input-disabled`, `border-muted`, and explicit disabled text/icon colors,
|
|
286
|
+
not opacity on the entire field. This keeps their appearance independent of the
|
|
287
|
+
parent surface. Keep native input/textarea elements transparent inside their
|
|
288
|
+
filled containers. For an embedded Input, use
|
|
289
|
+
`inputContainerClassName="border-0 bg-transparent"`; for an embedded Textarea,
|
|
290
|
+
use `variant="plain"`.
|
|
261
291
|
|
|
262
292
|
### Brand — `bg-brand-*`
|
|
263
293
|
|
|
@@ -327,6 +357,9 @@ Used internally by Checkbox, RadioButton, Switch, and Slider. Prefer those compo
|
|
|
327
357
|
| `border-success` | Success state border |
|
|
328
358
|
| `border-purple` | Purple-accented border |
|
|
329
359
|
|
|
360
|
+
Default outlines use `border-focus`: a subdued brand blue in light mode and a
|
|
361
|
+
slightly neutralized brand blue in dark mode, independent of brand fills.
|
|
362
|
+
|
|
330
363
|
### Status Borders — `border-status-*`
|
|
331
364
|
|
|
332
365
|
Use status border tokens for run-state and system-state accents. Do not use them for generic form validation; use intent tokens for that.
|
|
@@ -451,8 +484,15 @@ Source general-purpose icon glyphs from server-safe Phosphor leaf modules such a
|
|
|
451
484
|
| `shadow-md` | Dropdown, popover shadow |
|
|
452
485
|
| `shadow-lg` | Modal / dialog shadow |
|
|
453
486
|
|
|
454
|
-
|
|
455
|
-
shadow
|
|
487
|
+
Decorative shadows are light-mode only. All named shadow utilities (including
|
|
488
|
+
`shadow-xs`, `shadow`, `shadow-xl`, `shadow-2xl`, `shadow-inner`, and the slider
|
|
489
|
+
thumb) become transparent in dark mode. Use `var(--shadow-color-subtle)` only
|
|
490
|
+
when no named shadow can express the required layer; it also becomes transparent.
|
|
491
|
+
|
|
492
|
+
Use surface contrast and `border-subtle` to separate dark floating panels.
|
|
493
|
+
Preserve focus, selection, and error rings: these are indicators, not elevation.
|
|
494
|
+
Custom decorative box/drop shadows must also opt out in dark mode. Avoid chained
|
|
495
|
+
`drop-shadow()` outlines; subsequent filters blur earlier shadows into a glow.
|
|
456
496
|
|
|
457
497
|
---
|
|
458
498
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/macaw-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "React components and usage guidance for the Macaw Design System.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
"types": "./dist/index.d.ts",
|
|
29
29
|
"import": "./dist/index.js"
|
|
30
30
|
},
|
|
31
|
+
"./Accordion": {
|
|
32
|
+
"types": "./dist/components/Accordion/index.d.ts",
|
|
33
|
+
"import": "./dist/components/Accordion/index.js"
|
|
34
|
+
},
|
|
31
35
|
"./Attachment": {
|
|
32
36
|
"types": "./dist/components/Attachment/index.d.ts",
|
|
33
37
|
"import": "./dist/components/Attachment/index.js"
|
|
@@ -224,6 +228,10 @@
|
|
|
224
228
|
"types": "./dist/components/SplitViewPane/index.d.ts",
|
|
225
229
|
"import": "./dist/components/SplitViewPane/index.js"
|
|
226
230
|
},
|
|
231
|
+
"./StatusBadge": {
|
|
232
|
+
"types": "./dist/components/StatusBadge/index.d.ts",
|
|
233
|
+
"import": "./dist/components/StatusBadge/index.js"
|
|
234
|
+
},
|
|
227
235
|
"./Switch": {
|
|
228
236
|
"types": "./dist/components/Switch/index.d.ts",
|
|
229
237
|
"import": "./dist/components/Switch/index.js"
|
|
@@ -309,6 +317,10 @@
|
|
|
309
317
|
"types": "./dist/components/index.d.ts",
|
|
310
318
|
"import": "./dist/components/index.js"
|
|
311
319
|
},
|
|
320
|
+
"./components/Accordion": {
|
|
321
|
+
"types": "./dist/components/Accordion/index.d.ts",
|
|
322
|
+
"import": "./dist/components/Accordion/index.js"
|
|
323
|
+
},
|
|
312
324
|
"./components/Attachment": {
|
|
313
325
|
"types": "./dist/components/Attachment/index.d.ts",
|
|
314
326
|
"import": "./dist/components/Attachment/index.js"
|
|
@@ -505,6 +517,10 @@
|
|
|
505
517
|
"types": "./dist/components/SplitViewPane/index.d.ts",
|
|
506
518
|
"import": "./dist/components/SplitViewPane/index.js"
|
|
507
519
|
},
|
|
520
|
+
"./components/StatusBadge": {
|
|
521
|
+
"types": "./dist/components/StatusBadge/index.d.ts",
|
|
522
|
+
"import": "./dist/components/StatusBadge/index.js"
|
|
523
|
+
},
|
|
508
524
|
"./components/Switch": {
|
|
509
525
|
"types": "./dist/components/Switch/index.d.ts",
|
|
510
526
|
"import": "./dist/components/Switch/index.js"
|
|
@@ -566,7 +582,7 @@
|
|
|
566
582
|
"@fontsource/fira-code": "^5.2.7",
|
|
567
583
|
"@fontsource/inter": "^5.2.8",
|
|
568
584
|
"@headlessui/react": "^2.2.10",
|
|
569
|
-
"@langchain/macaw-tokens": "1.
|
|
585
|
+
"@langchain/macaw-tokens": "1.1.1",
|
|
570
586
|
"@lezer/common": "^1.2.1",
|
|
571
587
|
"@lezer/highlight": "^1.2.0",
|
|
572
588
|
"@lezer/yaml": "^1.0.4",
|
|
@@ -637,6 +653,7 @@
|
|
|
637
653
|
},
|
|
638
654
|
"scripts": {
|
|
639
655
|
"build": "node ../../scripts/build-components.mjs",
|
|
640
|
-
"storybook": "storybook dev -p 5264"
|
|
656
|
+
"storybook": "storybook dev -p 5264",
|
|
657
|
+
"test:a11y": "vitest run --config ../../vitest.storybook.config.ts"
|
|
641
658
|
}
|
|
642
659
|
}
|
package/tailwind.preset.cjs
CHANGED
|
@@ -118,13 +118,15 @@ module.exports = {
|
|
|
118
118
|
focus: 'var(--border-focus)',
|
|
119
119
|
},
|
|
120
120
|
boxShadow: {
|
|
121
|
-
|
|
122
|
-
'slider-thumb':
|
|
123
|
-
|
|
124
|
-
xs: '0 1px 1px 0 rgba(16, 24, 40, 0.02)',
|
|
121
|
+
DEFAULT: 'var(--shadow-default)',
|
|
122
|
+
'slider-thumb': 'var(--shadow-slider-thumb)',
|
|
123
|
+
xs: 'var(--shadow-xs)',
|
|
125
124
|
sm: 'var(--shadow-sm)',
|
|
126
125
|
md: 'var(--shadow-md)',
|
|
127
126
|
lg: 'var(--shadow-lg)',
|
|
127
|
+
xl: 'var(--shadow-xl)',
|
|
128
|
+
'2xl': 'var(--shadow-2xl)',
|
|
129
|
+
inner: 'var(--shadow-inner)',
|
|
128
130
|
},
|
|
129
131
|
transitionDuration: {
|
|
130
132
|
fast: 'var(--duration-fast)',
|
|
@@ -150,6 +152,8 @@ module.exports = {
|
|
|
150
152
|
elevated: 'var(--bg-elevated)',
|
|
151
153
|
},
|
|
152
154
|
backgroundColor: {
|
|
155
|
+
input: 'var(--bg-input)',
|
|
156
|
+
'input-disabled': 'var(--bg-input-disabled)',
|
|
153
157
|
'surface-level-1': 'var(--bg-surface-level-1)',
|
|
154
158
|
'surface-level-1-hover': 'var(--bg-surface-level-1-hover)',
|
|
155
159
|
'surface-level-2': 'var(--bg-surface-level-2)',
|
|
@@ -159,6 +163,7 @@ module.exports = {
|
|
|
159
163
|
elevated: 'var(--bg-elevated)',
|
|
160
164
|
'elevated-hover': 'var(--bg-elevated-hover)',
|
|
161
165
|
'elevated-selected': 'var(--bg-elevated-selected)',
|
|
166
|
+
sidebar: 'var(--bg-sidebar)',
|
|
162
167
|
'popover-urgent': 'var(--bg-popover-urgent)',
|
|
163
168
|
|
|
164
169
|
disabled: 'var(--bg-disabled)',
|
|
@@ -290,6 +295,7 @@ module.exports = {
|
|
|
290
295
|
// for the same semantic tokens through stroke.
|
|
291
296
|
stroke: {
|
|
292
297
|
focus: 'var(--border-focus)',
|
|
298
|
+
subtle: 'var(--border-subtle)',
|
|
293
299
|
},
|
|
294
300
|
textColor: {
|
|
295
301
|
primary: 'var(--text-primary)',
|
|
@@ -344,7 +350,7 @@ module.exports = {
|
|
|
344
350
|
'surface-level-2': 'var(--bg-surface-level-2)',
|
|
345
351
|
elevated: 'var(--bg-elevated)',
|
|
346
352
|
popover: {
|
|
347
|
-
DEFAULT: 'var(--bg-
|
|
353
|
+
DEFAULT: 'var(--bg-popover)',
|
|
348
354
|
},
|
|
349
355
|
background: {
|
|
350
356
|
DEFAULT: 'var(--bg-elevated)',
|