@stackone/malachite 2.123.0 → 2.124.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPONENTS.md +4 -3
- package/dist/ShadowRootWrapper.js +22 -22
- package/dist/ShadowRootWrapper.js.map +1 -1
- package/dist/components/ActionMenu.js +4 -3
- package/dist/components/ActionMenu.js.map +1 -1
- package/dist/components/Card.js +88 -78
- package/dist/components/Card.js.map +1 -1
- package/dist/components/Flex.js +10 -8
- package/dist/components/Flex.js.map +1 -1
- package/dist/components/FrameHeader.js +26 -19
- package/dist/components/FrameHeader.js.map +1 -1
- package/dist/components/PageLayout/index.js +8 -7
- package/dist/components/PageLayout/index.js.map +1 -1
- package/dist/components/PageLayout/pageColumns.js +23 -0
- package/dist/components/PageLayout/pageColumns.js.map +1 -0
- package/dist/components/Table/Table.js +491 -472
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/ToastProvider.js +32 -42
- package/dist/components/ToastProvider.js.map +1 -1
- package/dist/components/Typography/PathText.js +48 -55
- package/dist/components/Typography/PathText.js.map +1 -1
- package/dist/components/VisuallyHidden.js +8 -0
- package/dist/components/VisuallyHidden.js.map +1 -0
- package/dist/components/actionMenuStyles.js +33 -42
- package/dist/components/actionMenuStyles.js.map +1 -1
- package/dist/components/flexTypes.js +1 -1
- package/dist/components/flexTypes.js.map +1 -1
- package/dist/components/visuallyHiddenStyle.js +16 -0
- package/dist/components/visuallyHiddenStyle.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +394 -392
- package/dist/index.js.map +1 -1
- package/dist/tailwind.css.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionMenuStyles.js","sources":["../../src/components/actionMenuStyles.ts"],"sourcesContent":["import type React from 'react';\nimport type { ActionMenuIntent, ActionMenuItem } from './actionMenuTypes';\nimport { MENU_SPECS, type MenuGeometry } from './floatingMenuGeometry';\nimport { injectStyleSheet } from './injectStyleSheet';\nimport { SELECTED_OPTION_BACKGROUND } from './optionRowStyles';\nimport { ensureOverlayStyles } from './portalOverlay';\nimport { SELECTED_ROW_BACKGROUND, SELECTED_ROW_FOREGROUND } from './selectedRow';\n\nexport const TRIGGER_SIZES: Record<'small' | 'xsmall', { icon: number; iconBox: string }> = {\n small: { icon: 16, iconBox: 'text-[16px] [&_svg]:size-[16px]!' },\n xsmall: { icon: 11, iconBox: 'text-[11px] [&_svg]:size-[11px]!' },\n};\n\nexport const LABEL_STYLE: React.CSSProperties = {\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n};\n\n// Not `sr-only`: the menu portals outside the shadow root's stylesheet.\nexport const VISUALLY_HIDDEN_STYLE: React.CSSProperties = {\n position: 'absolute',\n width: 1,\n height: 1,\n margin: -1,\n overflow: 'hidden',\n clipPath: 'inset(50%)',\n whiteSpace: 'nowrap',\n};\n\n// Every row keeps its height: the menu scrolls once it reaches its max height, rather than\n// squeezing its rows until they overlap.\nexport const EMPTY_ITEM_STYLE: React.CSSProperties = {\n flexShrink: 0,\n padding: '6px 10px',\n fontSize: 'var(--malachite-font-size-small, 13px)',\n color: 'var(--malachite-text-dimmed, rgb(161, 161, 161))',\n userSelect: 'none',\n};\n\nexport const TEXT_ITEM_STYLE: React.CSSProperties = {\n ...EMPTY_ITEM_STYLE,\n color: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n};\n\n// A text row naming the choices under it sits a notch smaller, so it reads as their heading.\nexport const HEADING_ITEM_STYLE: React.CSSProperties = {\n ...TEXT_ITEM_STYLE,\n fontSize: 'calc(var(--malachite-font-size-small, 13px) - 1px)',\n};\n\nexport const TEXT_ITEM_LABEL_STYLE: React.CSSProperties = { color: 'inherit', fontSize: 'inherit' };\n\nexport const ITEM_TEXT_STYLE: React.CSSProperties = {\n ...LABEL_STYLE,\n display: 'flex',\n flexDirection: 'column',\n gap: 2,\n};\n\nconst DESCRIPTION_BASE: React.CSSProperties = {\n ...LABEL_STYLE,\n whiteSpace: 'normal',\n fontSize: 'var(--malachite-font-size-xsmall, 11px)',\n};\n\nconst DESCRIPTION_STYLE: React.CSSProperties = {\n ...DESCRIPTION_BASE,\n color: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n};\n\nconst ROW_DESCRIPTION_STYLE: React.CSSProperties = { ...DESCRIPTION_BASE, color: 'inherit' };\n\nexport const DESCRIPTION_CLASS = 'malachite-actionmenu-item-description';\n\nexport const descriptionStyle = (item: ActionItem): React.CSSProperties => {\n if (item.danger === 'hover') {\n return DESCRIPTION_BASE;\n }\n return item.danger || item.current ? ROW_DESCRIPTION_STYLE : DESCRIPTION_STYLE;\n};\n\nconst CHECK_SLOT_STYLE: React.CSSProperties = {\n display: 'inline-flex',\n flexShrink: 0,\n width: 14,\n marginLeft: 'auto',\n};\n\nconst ACCENT_FOREGROUND = 'var(--malachite-accent-foreground, rgb(2, 122, 66))';\n\nconst CHOSEN_SLOT_STYLE: React.CSSProperties = {\n ...CHECK_SLOT_STYLE,\n color: ACCENT_FOREGROUND,\n};\n\nconst INTENT_TEXT: Record<ActionMenuIntent, string> = {\n warning: 'var(--malachite-warning-foreground, rgb(150, 88, 10))',\n accent: ACCENT_FOREGROUND,\n};\n\n// A row with a paint of its own (danger, disabled, current) takes neither an intent nor the chosen tint.\nconst ownPaint = (item: ActionItem): boolean =>\n Boolean(item.danger) || Boolean(item.disabled) || Boolean(item.current);\n\nconst activeIntent = (item: ActionItem): ActionMenuIntent | undefined =>\n ownPaint(item) ? undefined : item.intent;\n\n// In a highlighted menu, the picked choice of a named set takes the green, unless the row has a\n// paint of its own or an intent.\nexport const isChosen = (item: ActionItem, highlight: boolean): boolean =>\n highlight && item.checked === true && Boolean(item.group) && !ownPaint(item) && !item.intent;\n\nexport const checkSlotStyle = (item: ActionItem, highlight: boolean): React.CSSProperties =>\n isChosen(item, highlight) ? CHOSEN_SLOT_STYLE : CHECK_SLOT_STYLE;\n\nconst ITEM_ICON_LAYOUT: React.CSSProperties = { display: 'inline-flex', flexShrink: 0 };\n\nconst ITEM_ICON_STYLE: React.CSSProperties = {\n ...ITEM_ICON_LAYOUT,\n color: 'var(--malachite-text-dimmed, rgb(161, 161, 161))',\n};\n\nexport const itemIconStyle = (item: ActionItem): React.CSSProperties =>\n item.danger === 'hover' || activeIntent(item) ? ITEM_ICON_LAYOUT : ITEM_ICON_STYLE;\n\nexport const ITEM_ICON_CLASS = 'malachite-actionmenu-item-icon';\n\nexport const ITEM_CLASS = 'malachite-actionmenu-item';\n\nexport const TAG_HOST_ATTR = 'data-malachite-actionmenu-tag' as const;\n\nexport const TAG_HOST_STYLE: React.CSSProperties = { display: 'inline-flex', flexShrink: 0 };\n\nexport const TAG_HOST_PROPS = { [TAG_HOST_ATTR]: '' };\n\nexport const CHOSEN_ATTR = 'data-chosen' as const;\n\nconst ITEM_RULES = [\n `.${ITEM_CLASS} { background: transparent; }`,\n `.${ITEM_CLASS}:not(:disabled):hover { background: var(--malachite-card-dimmed-background, rgb(247, 247, 247)); }`,\n // As a Dropdown's selected option, keeping its ground on hover.\n `.${ITEM_CLASS}[${CHOSEN_ATTR}], .${ITEM_CLASS}[${CHOSEN_ATTR}]:not(:disabled):hover { background: ${SELECTED_OPTION_BACKGROUND}; }`,\n `.${ITEM_CLASS}:focus-visible { outline: 2px solid var(--malachite-text-primary, rgb(10, 10, 10)); outline-offset: -2px; }`,\n];\n\nconst DANGER_ON_HOVER = `.${ITEM_CLASS}[data-danger=\"hover\"]`;\nconst DANGER_ON_HOVER_ACTIVE = `${DANGER_ON_HOVER}:not(:disabled):is(:hover, :focus-visible)`;\n\nconst DANGER_ON_HOVER_RULES = [\n `${DANGER_ON_HOVER} { color: var(--malachite-text-primary, rgb(10, 10, 10)); }`,\n `${DANGER_ON_HOVER}[data-tone=\"muted\"] { color: var(--malachite-text-secondary, rgb(123, 123, 123)); }`,\n `${DANGER_ON_HOVER} > .${ITEM_ICON_CLASS} { color: var(--malachite-text-dimmed, rgb(161, 161, 161)); }`,\n `${DANGER_ON_HOVER}[aria-current] { color: ${SELECTED_ROW_FOREGROUND}; background: ${SELECTED_ROW_BACKGROUND}; }`,\n `${DANGER_ON_HOVER_ACTIVE} { color: var(--malachite-text-destructive, rgb(237, 53, 54)); background: var(--malachite-error-background-glass, rgba(197, 63, 63, 0.08)); }`,\n `${DANGER_ON_HOVER_ACTIVE} > .${ITEM_ICON_CLASS} { color: inherit; }`,\n `${DANGER_ON_HOVER}:not([aria-current]) .${DESCRIPTION_CLASS} { color: var(--malachite-text-secondary, rgb(123, 123, 123)); }`,\n `${DANGER_ON_HOVER_ACTIVE} .${DESCRIPTION_CLASS} { color: inherit; }`,\n];\n\nexport const ensureDangerOnHoverStyles = (): CSSStyleSheet | null =>\n injectStyleSheet('malachite-actionmenu-danger-hover-styles', DANGER_ON_HOVER_RULES);\n\nexport const ensureActionMenuStyles = (): CSSStyleSheet | null => {\n ensureOverlayStyles();\n ensureDangerOnHoverStyles();\n // New id: a sheet an older malachite copy cached under the old one lacks the chosen rules.\n return injectStyleSheet('malachite-actionmenu-item-styles-v2', ITEM_RULES);\n};\n\nexport type ActionMenuTone = 'default' | 'muted';\n\nconst ITEM_TEXT: Record<ActionMenuTone, string> = {\n default: 'var(--malachite-text-primary, rgb(10, 10, 10))',\n muted: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n};\n\ntype ActionItem = Exclude<ActionMenuItem, { type: 'text' } | { type: 'divider' }>;\n\nconst actionItemColor = (item: ActionItem, tone: ActionMenuTone): string | undefined => {\n if (item.danger === true) {\n return 'var(--malachite-text-destructive, rgb(237, 53, 54))';\n }\n if (item.danger === 'hover') {\n return undefined;\n }\n if (item.current) {\n return SELECTED_ROW_FOREGROUND;\n }\n const intent = activeIntent(item);\n return intent ? INTENT_TEXT[intent] : ITEM_TEXT[tone];\n};\n\nexport const itemStyle = (\n item: ActionMenuItem,\n tone: ActionMenuTone = 'default',\n): React.CSSProperties => {\n if (item.type === 'text') {\n return TEXT_ITEM_STYLE;\n }\n if (item.type === 'divider') {\n return {\n height: 1,\n flexShrink: 0,\n background: 'var(--malachite-card-border, rgb(232, 232, 232))',\n margin: '4px 0',\n };\n }\n return {\n display: 'flex',\n flexShrink: 0,\n alignItems: 'center',\n gap: 8,\n padding: '6px 10px',\n borderRadius: 8,\n fontSize: 'var(--malachite-font-size-small, 13px)',\n fontWeight: 400,\n color: actionItemColor(item, tone),\n background: item.current && item.danger !== 'hover' ? SELECTED_ROW_BACKGROUND : undefined,\n cursor: item.disabled ? 'not-allowed' : 'pointer',\n opacity: item.disabled ? 0.5 : 1,\n userSelect: 'none',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n border: 'none',\n textAlign: 'left',\n textDecoration: 'none',\n boxSizing: 'border-box',\n width: '100%',\n // The rule beside an indented row sits in its margin, so the row lets it show; the label keeps its own ellipsis.\n ...(item.indent\n ? {\n position: 'relative',\n overflow: 'visible',\n marginLeft: INDENT_PX,\n width: `calc(100% - ${INDENT_PX}px)`,\n }\n : {}),\n };\n};\n\nconst INDENT_PX = 18;\n\n// Runs the full height of the row and over the gap to the next, so a run of indented rows reads as one rule.\nexport const INDENT_RULE_STYLE: React.CSSProperties = {\n position: 'absolute',\n left: -(INDENT_PX / 2) - 1,\n top: -1,\n bottom: -1,\n width: 1,\n background: 'var(--malachite-card-border, rgb(232, 232, 232))',\n};\n\n// The menu's rows, and a set of choices among them, stack the same way.\nexport const MENU_COLUMN_STYLE: React.CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexShrink: 0,\n gap: 2,\n};\n\nexport const menuStyle = (position: MenuGeometry | null): React.CSSProperties => ({\n position: 'fixed',\n top: position?.top ?? 0,\n left: position?.left ?? 0,\n width: position?.width,\n maxHeight: position?.maxHeight,\n overflowY: 'auto',\n background: MENU_SPECS.options.background,\n border: MENU_SPECS.options.border,\n borderRadius: MENU_SPECS.options.radius,\n boxShadow: MENU_SPECS.options.shadow,\n padding: MENU_SPECS.options.padding,\n ...MENU_COLUMN_STYLE,\n visibility: position ? 'visible' : 'hidden',\n opacity: position ? 1 : 0,\n});\n"],"names":["TRIGGER_SIZES","LABEL_STYLE","VISUALLY_HIDDEN_STYLE","EMPTY_ITEM_STYLE","TEXT_ITEM_STYLE","HEADING_ITEM_STYLE","TEXT_ITEM_LABEL_STYLE","ITEM_TEXT_STYLE","DESCRIPTION_BASE","DESCRIPTION_STYLE","ROW_DESCRIPTION_STYLE","DESCRIPTION_CLASS","descriptionStyle","item","CHECK_SLOT_STYLE","ACCENT_FOREGROUND","CHOSEN_SLOT_STYLE","INTENT_TEXT","ownPaint","activeIntent","isChosen","highlight","checkSlotStyle","ITEM_ICON_LAYOUT","ITEM_ICON_STYLE","itemIconStyle","ITEM_ICON_CLASS","ITEM_CLASS","TAG_HOST_ATTR","TAG_HOST_STYLE","TAG_HOST_PROPS","CHOSEN_ATTR","ITEM_RULES","SELECTED_OPTION_BACKGROUND","DANGER_ON_HOVER","DANGER_ON_HOVER_ACTIVE","DANGER_ON_HOVER_RULES","SELECTED_ROW_FOREGROUND","SELECTED_ROW_BACKGROUND","ensureDangerOnHoverStyles","injectStyleSheet","ensureActionMenuStyles","ensureOverlayStyles","ITEM_TEXT","actionItemColor","tone","intent","itemStyle","INDENT_PX","INDENT_RULE_STYLE","MENU_COLUMN_STYLE","menuStyle","position","MENU_SPECS"],"mappings":";;;;;AAQO,MAAMA,IAA+E;AAAA,EACxF,OAAO,EAAE,MAAM,IAAI,SAAS,mCAAA;AAAA,EAC5B,QAAQ,EAAE,MAAM,IAAI,SAAS,mCAAA;AACjC,GAEaC,IAAmC;AAAA,EAC5C,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAClB,GAGaC,IAA6C;AAAA,EACtD,UAAU;AAAA,EACV,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAChB,G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EAAU,SAAQ;AAAA,EACxB,OAAOA,KAAA,gBAAAA,EAAU;AAAA,EACjB,WAAWA,KAAA,gBAAAA,EAAU;AAAA,EACrB,WAAW;AAAA,EACX,YAAYC,EAAW,QAAQ;AAAA,EAC/B,QAAQA,EAAW,QAAQ;AAAA,EAC3B,cAAcA,EAAW,QAAQ;AAAA,EACjC,WAAWA,EAAW,QAAQ;AAAA,EAC9B,SAASA,EAAW,QAAQ;AAAA,EAC5B,GAAGH;AAAA,EACH,YAAYE,IAAW,YAAY;AAAA,EACnC,SAASA,IAAW,IAAI;AAC5B;"}
|
|
1
|
+
{"version":3,"file":"actionMenuStyles.js","sources":["../../src/components/actionMenuStyles.ts"],"sourcesContent":["import type React from 'react';\nimport type { ActionMenuIntent, ActionMenuItem } from './actionMenuTypes';\nimport { MENU_SPECS, type MenuGeometry } from './floatingMenuGeometry';\nimport { injectStyleSheet } from './injectStyleSheet';\nimport { SELECTED_OPTION_BACKGROUND } from './optionRowStyles';\nimport { ensureOverlayStyles } from './portalOverlay';\nimport { SELECTED_ROW_BACKGROUND, SELECTED_ROW_FOREGROUND } from './selectedRow';\n\nexport const TRIGGER_SIZES: Record<'small' | 'xsmall', { icon: number; iconBox: string }> = {\n small: { icon: 16, iconBox: 'text-[16px] [&_svg]:size-[16px]!' },\n xsmall: { icon: 11, iconBox: 'text-[11px] [&_svg]:size-[11px]!' },\n};\n\nexport const LABEL_STYLE: React.CSSProperties = {\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n};\n\n// Every row keeps its height: the menu scrolls once it reaches its max height, rather than\n// squeezing its rows until they overlap.\nexport const EMPTY_ITEM_STYLE: React.CSSProperties = {\n flexShrink: 0,\n padding: '6px 10px',\n fontSize: 'var(--malachite-font-size-small, 13px)',\n color: 'var(--malachite-text-dimmed, rgb(161, 161, 161))',\n userSelect: 'none',\n};\n\nexport const TEXT_ITEM_STYLE: React.CSSProperties = {\n ...EMPTY_ITEM_STYLE,\n color: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n};\n\n// A text row naming the choices under it sits a notch smaller, so it reads as their heading.\nexport const HEADING_ITEM_STYLE: React.CSSProperties = {\n ...TEXT_ITEM_STYLE,\n fontSize: 'calc(var(--malachite-font-size-small, 13px) - 1px)',\n};\n\nexport const TEXT_ITEM_LABEL_STYLE: React.CSSProperties = { color: 'inherit', fontSize: 'inherit' };\n\nexport const ITEM_TEXT_STYLE: React.CSSProperties = {\n ...LABEL_STYLE,\n display: 'flex',\n flexDirection: 'column',\n gap: 2,\n};\n\nconst DESCRIPTION_BASE: React.CSSProperties = {\n ...LABEL_STYLE,\n whiteSpace: 'normal',\n fontSize: 'var(--malachite-font-size-xsmall, 11px)',\n};\n\nconst DESCRIPTION_STYLE: React.CSSProperties = {\n ...DESCRIPTION_BASE,\n color: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n};\n\nconst ROW_DESCRIPTION_STYLE: React.CSSProperties = { ...DESCRIPTION_BASE, color: 'inherit' };\n\nexport const DESCRIPTION_CLASS = 'malachite-actionmenu-item-description';\n\nexport const descriptionStyle = (item: ActionItem): React.CSSProperties => {\n if (item.danger === 'hover') {\n return DESCRIPTION_BASE;\n }\n return item.danger || item.current ? ROW_DESCRIPTION_STYLE : DESCRIPTION_STYLE;\n};\n\nconst CHECK_SLOT_STYLE: React.CSSProperties = {\n display: 'inline-flex',\n flexShrink: 0,\n width: 14,\n marginLeft: 'auto',\n};\n\nconst ACCENT_FOREGROUND = 'var(--malachite-accent-foreground, rgb(2, 122, 66))';\n\nconst CHOSEN_SLOT_STYLE: React.CSSProperties = {\n ...CHECK_SLOT_STYLE,\n color: ACCENT_FOREGROUND,\n};\n\nconst INTENT_TEXT: Record<ActionMenuIntent, string> = {\n warning: 'var(--malachite-warning-foreground, rgb(150, 88, 10))',\n accent: ACCENT_FOREGROUND,\n};\n\n// A row with a paint of its own (danger, disabled, current) takes neither an intent nor the chosen tint.\nconst ownPaint = (item: ActionItem): boolean =>\n Boolean(item.danger) || Boolean(item.disabled) || Boolean(item.current);\n\nconst activeIntent = (item: ActionItem): ActionMenuIntent | undefined =>\n ownPaint(item) ? undefined : item.intent;\n\n// In a highlighted menu, the picked choice of a named set takes the green, unless the row has a\n// paint of its own or an intent.\nexport const isChosen = (item: ActionItem, highlight: boolean): boolean =>\n highlight && item.checked === true && Boolean(item.group) && !ownPaint(item) && !item.intent;\n\nexport const checkSlotStyle = (item: ActionItem, highlight: boolean): React.CSSProperties =>\n isChosen(item, highlight) ? CHOSEN_SLOT_STYLE : CHECK_SLOT_STYLE;\n\nconst ITEM_ICON_LAYOUT: React.CSSProperties = { display: 'inline-flex', flexShrink: 0 };\n\nconst ITEM_ICON_STYLE: React.CSSProperties = {\n ...ITEM_ICON_LAYOUT,\n color: 'var(--malachite-text-dimmed, rgb(161, 161, 161))',\n};\n\nexport const itemIconStyle = (item: ActionItem): React.CSSProperties =>\n item.danger === 'hover' || activeIntent(item) ? ITEM_ICON_LAYOUT : ITEM_ICON_STYLE;\n\nexport const ITEM_ICON_CLASS = 'malachite-actionmenu-item-icon';\n\nexport const ITEM_CLASS = 'malachite-actionmenu-item';\n\nexport const TAG_HOST_ATTR = 'data-malachite-actionmenu-tag' as const;\n\nexport const TAG_HOST_STYLE: React.CSSProperties = { display: 'inline-flex', flexShrink: 0 };\n\nexport const TAG_HOST_PROPS = { [TAG_HOST_ATTR]: '' };\n\nexport const CHOSEN_ATTR = 'data-chosen' as const;\n\nconst ITEM_RULES = [\n `.${ITEM_CLASS} { background: transparent; }`,\n `.${ITEM_CLASS}:not(:disabled):hover { background: var(--malachite-card-dimmed-background, rgb(247, 247, 247)); }`,\n // As a Dropdown's selected option, keeping its ground on hover.\n `.${ITEM_CLASS}[${CHOSEN_ATTR}], .${ITEM_CLASS}[${CHOSEN_ATTR}]:not(:disabled):hover { background: ${SELECTED_OPTION_BACKGROUND}; }`,\n `.${ITEM_CLASS}:focus-visible { outline: 2px solid var(--malachite-text-primary, rgb(10, 10, 10)); outline-offset: -2px; }`,\n];\n\nconst DANGER_ON_HOVER = `.${ITEM_CLASS}[data-danger=\"hover\"]`;\nconst DANGER_ON_HOVER_ACTIVE = `${DANGER_ON_HOVER}:not(:disabled):is(:hover, :focus-visible)`;\n\nconst DANGER_ON_HOVER_RULES = [\n `${DANGER_ON_HOVER} { color: var(--malachite-text-primary, rgb(10, 10, 10)); }`,\n `${DANGER_ON_HOVER}[data-tone=\"muted\"] { color: var(--malachite-text-secondary, rgb(123, 123, 123)); }`,\n `${DANGER_ON_HOVER} > .${ITEM_ICON_CLASS} { color: var(--malachite-text-dimmed, rgb(161, 161, 161)); }`,\n `${DANGER_ON_HOVER}[aria-current] { color: ${SELECTED_ROW_FOREGROUND}; background: ${SELECTED_ROW_BACKGROUND}; }`,\n `${DANGER_ON_HOVER_ACTIVE} { color: var(--malachite-text-destructive, rgb(237, 53, 54)); background: var(--malachite-error-background-glass, rgba(197, 63, 63, 0.08)); }`,\n `${DANGER_ON_HOVER_ACTIVE} > .${ITEM_ICON_CLASS} { color: inherit; }`,\n `${DANGER_ON_HOVER}:not([aria-current]) .${DESCRIPTION_CLASS} { color: var(--malachite-text-secondary, rgb(123, 123, 123)); }`,\n `${DANGER_ON_HOVER_ACTIVE} .${DESCRIPTION_CLASS} { color: inherit; }`,\n];\n\nexport const ensureDangerOnHoverStyles = (): CSSStyleSheet | null =>\n injectStyleSheet('malachite-actionmenu-danger-hover-styles', DANGER_ON_HOVER_RULES);\n\nexport const ensureActionMenuStyles = (): CSSStyleSheet | null => {\n ensureOverlayStyles();\n ensureDangerOnHoverStyles();\n // New id: a sheet an older malachite copy cached under the old one lacks the chosen rules.\n return injectStyleSheet('malachite-actionmenu-item-styles-v2', ITEM_RULES);\n};\n\nexport type ActionMenuTone = 'default' | 'muted';\n\nconst ITEM_TEXT: Record<ActionMenuTone, string> = {\n default: 'var(--malachite-text-primary, rgb(10, 10, 10))',\n muted: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n};\n\ntype ActionItem = Exclude<ActionMenuItem, { type: 'text' } | { type: 'divider' }>;\n\nconst actionItemColor = (item: ActionItem, tone: ActionMenuTone): string | undefined => {\n if (item.danger === true) {\n return 'var(--malachite-text-destructive, rgb(237, 53, 54))';\n }\n if (item.danger === 'hover') {\n return undefined;\n }\n if (item.current) {\n return SELECTED_ROW_FOREGROUND;\n }\n const intent = activeIntent(item);\n return intent ? INTENT_TEXT[intent] : ITEM_TEXT[tone];\n};\n\nexport const itemStyle = (\n item: ActionMenuItem,\n tone: ActionMenuTone = 'default',\n): React.CSSProperties => {\n if (item.type === 'text') {\n return TEXT_ITEM_STYLE;\n }\n if (item.type === 'divider') {\n return {\n height: 1,\n flexShrink: 0,\n background: 'var(--malachite-card-border, rgb(232, 232, 232))',\n margin: '4px 0',\n };\n }\n return {\n display: 'flex',\n flexShrink: 0,\n alignItems: 'center',\n gap: 8,\n padding: '6px 10px',\n borderRadius: 8,\n fontSize: 'var(--malachite-font-size-small, 13px)',\n fontWeight: 400,\n color: actionItemColor(item, tone),\n background: item.current && item.danger !== 'hover' ? SELECTED_ROW_BACKGROUND : undefined,\n cursor: item.disabled ? 'not-allowed' : 'pointer',\n opacity: item.disabled ? 0.5 : 1,\n userSelect: 'none',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n border: 'none',\n textAlign: 'left',\n textDecoration: 'none',\n boxSizing: 'border-box',\n width: '100%',\n // The rule beside an indented row sits in its margin, so the row lets it show; the label keeps its own ellipsis.\n ...(item.indent\n ? {\n position: 'relative',\n overflow: 'visible',\n marginLeft: INDENT_PX,\n width: `calc(100% - ${INDENT_PX}px)`,\n }\n : {}),\n };\n};\n\nconst INDENT_PX = 18;\n\n// Runs the full height of the row and over the gap to the next, so a run of indented rows reads as one rule.\nexport const INDENT_RULE_STYLE: React.CSSProperties = {\n position: 'absolute',\n left: -(INDENT_PX / 2) - 1,\n top: -1,\n bottom: -1,\n width: 1,\n background: 'var(--malachite-card-border, rgb(232, 232, 232))',\n};\n\n// The menu's rows, and a set of choices among them, stack the same way.\nexport const MENU_COLUMN_STYLE: React.CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n flexShrink: 0,\n gap: 2,\n};\n\nexport const menuStyle = (position: MenuGeometry | null): React.CSSProperties => ({\n position: 'fixed',\n top: position?.top ?? 0,\n left: position?.left ?? 0,\n width: position?.width,\n maxHeight: position?.maxHeight,\n overflowY: 'auto',\n background: MENU_SPECS.options.background,\n border: MENU_SPECS.options.border,\n borderRadius: MENU_SPECS.options.radius,\n boxShadow: MENU_SPECS.options.shadow,\n padding: MENU_SPECS.options.padding,\n ...MENU_COLUMN_STYLE,\n visibility: position ? 'visible' : 'hidden',\n opacity: position ? 1 : 0,\n});\n"],"names":["TRIGGER_SIZES","LABEL_STYLE","EMPTY_ITEM_STYLE","TEXT_ITEM_STYLE","HEADING_ITEM_STYLE","TEXT_ITEM_LABEL_STYLE","ITEM_TEXT_STYLE","DESCRIPTION_BASE","DESCRIPTION_STYLE","ROW_DESCRIPTION_STYLE","DESCRIPTION_CLASS","descriptionStyle","item","CHECK_SLOT_STYLE","ACCENT_FOREGROUND","CHOSEN_SLOT_STYLE","INTENT_TEXT","ownPaint","activeIntent","isChosen","highlight","checkSlotStyle","ITEM_ICON_LAYOUT","ITEM_ICON_STYLE","itemIconStyle","ITEM_ICON_CLASS","ITEM_CLASS","TAG_HOST_ATTR","TAG_HOST_STYLE","TAG_HOST_PROPS","CHOSEN_ATTR","ITEM_RULES","SELECTED_OPTION_BACKGROUND","DANGER_ON_HOVER","DANGER_ON_HOVER_ACTIVE","DANGER_ON_HOVER_RULES","SELECTED_ROW_FOREGROUND","SELECTED_ROW_BACKGROUND","ensureDangerOnHoverStyles","injectStyleSheet","ensureActionMenuStyles","ensureOverlayStyles","ITEM_TEXT","actionItemColor","tone","intent","itemStyle","INDENT_PX","INDENT_RULE_STYLE","MENU_COLUMN_STYLE","menuStyle","position","MENU_SPECS"],"mapp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aC,IAAyC;AAAA,EAClD,SAAS;AAAA,EACT,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,KAAK;AACT,GAEaC,KAAY,CAACC,OAAwD;AAAA,EAC9E,UAAU;AAAA,EACV,MAAKA,KAAA,gBAAAA,EAAU,QAAO;AAAA,EACtB,OAAMA,KAAA,gBAAAA,EAAU,SAAQ;AAAA,EACxB,OAAOA,KAAA,gBAAAA,EAAU;AAAA,EACjB,WAAWA,KAAA,gBAAAA,EAAU;AAAA,EACrB,WAAW;AAAA,EACX,YAAYC,EAAW,QAAQ;AAAA,EAC/B,QAAQA,EAAW,QAAQ;AAAA,EAC3B,cAAcA,EAAW,QAAQ;AAAA,EACjC,WAAWA,EAAW,QAAQ;AAAA,EAC9B,SAASA,EAAW,QAAQ;AAAA,EAC5B,GAAGH;AAAA,EACH,YAAYE,IAAW,YAAY;AAAA,EACnC,SAASA,IAAW,IAAI;AAC5B;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var e = /* @__PURE__ */ ((r) => (r.XSmall = "xsmall", r.Small = "small", r.Medium = "medium", r.Large = "large", r))(e || {}), a = /* @__PURE__ */ ((r) => (r.Left = "flex-start", r.Right = "flex-end", r.Center = "center", r.SpaceBetween = "space-between", r.SpaceAround = "space-around", r.SpaceEvenly = "space-evenly", r))(a || {}), t = /* @__PURE__ */ ((r) => (r.Top = "flex-start", r.Bottom = "flex-end", r.Center = "center", r.Normal = "normal", r.Stretch = "stretch", r))(t || {}), n = /* @__PURE__ */ ((r) => (r.Horizontal = "horizontal", r.Vertical = "vertical", r))(n || {});
|
|
1
|
+
var e = /* @__PURE__ */ ((r) => (r.XXSmall = "xxsmall", r.XSmall = "xsmall", r.Small = "small", r.Medium = "medium", r.Large = "large", r))(e || {}), a = /* @__PURE__ */ ((r) => (r.Left = "flex-start", r.Right = "flex-end", r.Center = "center", r.SpaceBetween = "space-between", r.SpaceAround = "space-around", r.SpaceEvenly = "space-evenly", r))(a || {}), t = /* @__PURE__ */ ((r) => (r.Top = "flex-start", r.Bottom = "flex-end", r.Center = "center", r.Normal = "normal", r.Stretch = "stretch", r))(t || {}), n = /* @__PURE__ */ ((r) => (r.Horizontal = "horizontal", r.Vertical = "vertical", r))(n || {});
|
|
2
2
|
export {
|
|
3
3
|
t as FlexAlign,
|
|
4
4
|
n as FlexDirection,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flexTypes.js","sources":["../../src/components/flexTypes.ts"],"sourcesContent":["export enum FlexGapSize {\n XSmall = 'xsmall',\n Small = 'small',\n Medium = 'medium',\n Large = 'large',\n}\n\nexport enum FlexJustify {\n Left = 'flex-start',\n Right = 'flex-end',\n Center = 'center',\n SpaceBetween = 'space-between',\n SpaceAround = 'space-around',\n SpaceEvenly = 'space-evenly',\n}\n\nexport enum FlexAlign {\n Top = 'flex-start',\n Bottom = 'flex-end',\n Center = 'center',\n Normal = 'normal',\n Stretch = 'stretch',\n}\n\nexport enum FlexDirection {\n Horizontal = 'horizontal',\n Vertical = 'vertical',\n}\n"],"names":["FlexGapSize","FlexJustify","FlexAlign","FlexDirection"],"mappings":"AAAO,IAAKA,sBAAAA,OACRA,EAAA,SAAS,UACTA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,QAAQ,
|
|
1
|
+
{"version":3,"file":"flexTypes.js","sources":["../../src/components/flexTypes.ts"],"sourcesContent":["export enum FlexGapSize {\n XXSmall = 'xxsmall',\n XSmall = 'xsmall',\n Small = 'small',\n Medium = 'medium',\n Large = 'large',\n}\n\nexport enum FlexJustify {\n Left = 'flex-start',\n Right = 'flex-end',\n Center = 'center',\n SpaceBetween = 'space-between',\n SpaceAround = 'space-around',\n SpaceEvenly = 'space-evenly',\n}\n\nexport enum FlexAlign {\n Top = 'flex-start',\n Bottom = 'flex-end',\n Center = 'center',\n Normal = 'normal',\n Stretch = 'stretch',\n}\n\nexport enum FlexDirection {\n Horizontal = 'horizontal',\n Vertical = 'vertical',\n}\n"],"names":["FlexGapSize","FlexJustify","FlexAlign","FlexDirection"],"mappings":"AAAO,IAAKA,sBAAAA,OACRA,EAAA,UAAU,WACVA,EAAA,SAAS,UACTA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,QAAQ,SALAA,IAAAA,KAAA,CAAA,CAAA,GAQAC,sBAAAA,OACRA,EAAA,OAAO,cACPA,EAAA,QAAQ,YACRA,EAAA,SAAS,UACTA,EAAA,eAAe,iBACfA,EAAA,cAAc,gBACdA,EAAA,cAAc,gBANNA,IAAAA,KAAA,CAAA,CAAA,GASAC,sBAAAA,OACRA,EAAA,MAAM,cACNA,EAAA,SAAS,YACTA,EAAA,SAAS,UACTA,EAAA,SAAS,UACTA,EAAA,UAAU,WALFA,IAAAA,KAAA,CAAA,CAAA,GAQAC,sBAAAA,OACRA,EAAA,aAAa,cACbA,EAAA,WAAW,YAFHA,IAAAA,KAAA,CAAA,CAAA;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const i = {
|
|
2
|
+
position: "absolute",
|
|
3
|
+
width: 1,
|
|
4
|
+
height: 1,
|
|
5
|
+
margin: -1,
|
|
6
|
+
padding: 0,
|
|
7
|
+
border: 0,
|
|
8
|
+
overflow: "hidden",
|
|
9
|
+
clip: "rect(0, 0, 0, 0)",
|
|
10
|
+
clipPath: "inset(50%)",
|
|
11
|
+
whiteSpace: "nowrap"
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
i as VISUALLY_HIDDEN_STYLE
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=visuallyHiddenStyle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visuallyHiddenStyle.js","sources":["../../src/components/visuallyHiddenStyle.ts"],"sourcesContent":["import type React from 'react';\n\n// Inline rather than Tailwind's `sr-only`, which exists only inside malachite's shadow roots.\nexport const VISUALLY_HIDDEN_STYLE: React.CSSProperties = {\n position: 'absolute',\n width: 1,\n height: 1,\n margin: -1,\n padding: 0,\n border: 0,\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n clipPath: 'inset(50%)',\n whiteSpace: 'nowrap',\n};\n"],"names":["VISUALLY_HIDDEN_STYLE"],"mappings":"AAGO,MAAMA,IAA6C;AAAA,EACtD,UAAU;AAAA,EACV,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,MAAM;AAAA,EACN,UAAU;AAAA,EACV,YAAY;AAChB;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -585,6 +585,15 @@ export declare interface CardProps {
|
|
|
585
585
|
subtitle?: default_2.ReactNode;
|
|
586
586
|
/** Actions at the right of the title row. */
|
|
587
587
|
extra?: default_2.ReactNode;
|
|
588
|
+
/**
|
|
589
|
+
* Move `extra` onto a line of its own, under the title and still at the right, when the title
|
|
590
|
+
* and subtitle do not fit on one line beside it, rather than shrinking the title to fit, which
|
|
591
|
+
* on a framed card cuts it short. The header grows by that line, so leave room for it in a card
|
|
592
|
+
* of fixed height. On a framed card it also adds 6px above and below the title row, so an
|
|
593
|
+
* `extra` taller than 32px makes the header taller than 44px; use a small or medium control.
|
|
594
|
+
* Keep text that changes width, such as a live save status, out of a wrapping `extra`.
|
|
595
|
+
*/
|
|
596
|
+
wrapExtra?: boolean;
|
|
588
597
|
padding?: string;
|
|
589
598
|
children?: default_2.ReactNode;
|
|
590
599
|
size?: 'default' | 'small';
|
|
@@ -2264,6 +2273,7 @@ export declare enum FlexDirection {
|
|
|
2264
2273
|
}
|
|
2265
2274
|
|
|
2266
2275
|
export declare enum FlexGapSize {
|
|
2276
|
+
XXSmall = "xxsmall",
|
|
2267
2277
|
XSmall = "xsmall",
|
|
2268
2278
|
Small = "small",
|
|
2269
2279
|
Medium = "medium",
|
|
@@ -4652,6 +4662,14 @@ export declare interface PageColumnProps {
|
|
|
4652
4662
|
className?: string;
|
|
4653
4663
|
}
|
|
4654
4664
|
|
|
4665
|
+
export declare interface PageColumnsProps {
|
|
4666
|
+
/** Space between the columns, and between them once stacked. Defaults to `xlarge`. */
|
|
4667
|
+
gap?: PageContentGap;
|
|
4668
|
+
/** Exactly two children, one per column; a third wraps onto a new row. */
|
|
4669
|
+
children: default_2.ReactNode;
|
|
4670
|
+
className?: string;
|
|
4671
|
+
}
|
|
4672
|
+
|
|
4655
4673
|
export declare type PageContentGap = 'small' | 'medium' | 'large' | 'xlarge';
|
|
4656
4674
|
|
|
4657
4675
|
export declare type PageContentWidth = 'narrow';
|
|
@@ -4660,6 +4678,7 @@ export declare const PageLayout: {
|
|
|
4660
4678
|
Regular: FC<RegularLayoutProps>;
|
|
4661
4679
|
Empty: FC<EmptyLayoutProps>;
|
|
4662
4680
|
Column: FC<PageColumnProps>;
|
|
4681
|
+
Columns: FC<PageColumnsProps>;
|
|
4663
4682
|
};
|
|
4664
4683
|
|
|
4665
4684
|
declare interface PageTitleProps {
|
|
@@ -6290,6 +6309,8 @@ declare type TableProps<T = Record<string, unknown>> = {
|
|
|
6290
6309
|
* page-level scroll container with other sticky elements (e.g. tabs + toolbar)
|
|
6291
6310
|
* stacked above. */
|
|
6292
6311
|
stickyHeaderTop?: number;
|
|
6312
|
+
/** Scrolls sideways instead of squeezing columns. Default header, fixed layout with only px
|
|
6313
|
+
* or unset widths: unset ones get the largest unset `minWidth`; auto layout: each its own. */
|
|
6293
6314
|
scrollX?: boolean;
|
|
6294
6315
|
rowSection?: (record: T) => string;
|
|
6295
6316
|
renderSectionDivider?: (sectionKey: string, records: T[]) => default_2.ReactNode;
|
|
@@ -6900,6 +6921,17 @@ export declare const useSidebarCollapsed: () => boolean;
|
|
|
6900
6921
|
/** Shows a toast from anywhere under a `ToastProvider`. Throws outside one. */
|
|
6901
6922
|
export declare const useToast: () => ToastApi;
|
|
6902
6923
|
|
|
6924
|
+
/**
|
|
6925
|
+
* Text for assistive technology only: painted nowhere, in the light DOM or a shadow root, and
|
|
6926
|
+
* still read as ordinary content. Prefer it to `aria-label` on a plain span, whose generic role
|
|
6927
|
+
* prohibits an accessible name.
|
|
6928
|
+
*/
|
|
6929
|
+
export declare const VisuallyHidden: default_2.FC<VisuallyHiddenProps>;
|
|
6930
|
+
|
|
6931
|
+
export declare interface VisuallyHiddenProps {
|
|
6932
|
+
children: default_2.ReactNode;
|
|
6933
|
+
}
|
|
6934
|
+
|
|
6903
6935
|
export declare const WarningCircleFilled: React.FC<IconProps_123>;
|
|
6904
6936
|
|
|
6905
6937
|
export declare const WarningTriangleIcon: React.FC<IconProps_124>;
|