@stackone/malachite 2.123.1 → 2.125.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 +9 -7
- package/dist/components/ActionMenu.js +4 -3
- package/dist/components/ActionMenu.js.map +1 -1
- package/dist/components/Card.js +85 -75
- 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/HexagonScale.js +25 -10
- package/dist/components/HexagonScale.js.map +1 -1
- package/dist/components/KeyValueStrip.js +57 -41
- package/dist/components/KeyValueStrip.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/PillButton.js +68 -45
- package/dist/components/PillButton.js.map +1 -1
- package/dist/components/ScoreMeter.js +79 -0
- package/dist/components/ScoreMeter.js.map +1 -0
- package/dist/components/Table/Table.js +491 -472
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Timeline.js +88 -77
- package/dist/components/Timeline.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 +63 -2
- package/dist/index.js +396 -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":"Card.js","sources":["../../src/components/Card.tsx"],"sourcesContent":["import React, { useRef, useEffect, useState } from 'react';\nimport FrameHeader, { HeaderRow } from './FrameHeader';\nimport { FRAME_CLASS, FRAME_SECTION_STYLE, frameToneBackground } from './frameStyles';\nimport { GLASS_SURFACE_STYLE } from './glassSurface';\nimport { hasHeaderContent } from './headerContent';\nimport type { ModalTrayTone } from './modalTray';\nimport { FOREGROUND_RESET } from './selectedRow';\n\n/**\n * `framed` draws the detached Table's frame: the title row sits on a grey frame and the children\n * in a bordered section inside it, so a card above a table reads as part of the same set.\n * `dimmed`, `border`, `size`, `glassFooter` and `headerConfig` do not apply to it.\n */\nexport type CardVariant = 'default' | 'framed';\nexport type CardTone = ModalTrayTone;\n\nexport interface CardProps {\n variant?: CardVariant;\n /** Only a framed card takes a tone; see `FramedCardProps`. */\n tone?: never;\n title?: string | React.ReactNode;\n /** Dimmed text beside the title, such as a count or a unit. */\n subtitle?: React.ReactNode;\n /** Actions at the right of the title row. */\n extra?: React.ReactNode;\n padding?: string;\n children?: React.ReactNode;\n size?: 'default' | 'small';\n width?: string;\n minWidth?: string;\n direction?: 'row' | 'column';\n align?: 'center';\n dimmed?: boolean;\n fullHeight?: boolean;\n border?: 'base' | 'rounded';\n alignSelf?: 'center';\n height?: string;\n footer?: React.ReactNode;\n glassFooter?: boolean;\n className?: string;\n style?: React.CSSProperties;\n headerConfig?: {\n padding?: string;\n };\n}\n\n/** A framed card, which alone takes a `tone`. A second interface so `CardProps` keeps its shape. */\nexport interface FramedCardProps extends Omit<CardProps, 'variant' | 'tone'> {\n variant: Extract<CardVariant, 'framed'>;\n /**\n * Paints the frame in the tray colour of the outcome it reports, as `Modal`'s `tray` does.\n * `neutral` keeps the default grey frame, so it still matches a detached Table.\n */\n tone?: CardTone;\n}\n\nexport type AnyCardProps = CardProps | FramedCardProps;\n\nconst PLAIN_LENGTH = /^\\d*\\.?\\d+(px|rem|em)$/;\n\n// Only plain positive lengths are copied: calc() and var() can't be split from a shorthand, and a\n// zero inset would put the title against the border, so those keep the header's own 12px.\nconst horizontalInset = (padding: string): React.CSSProperties | undefined => {\n const parts = padding.trim().split(/\\s+/);\n if (parts.length > 4 || !parts.every((part) => PLAIN_LENGTH.test(part))) {\n return undefined;\n }\n const [top, right = top, , left = right] = parts;\n return parseFloat(left) > 0 && parseFloat(right) > 0\n ? { paddingLeft: left, paddingRight: right }\n : undefined;\n};\n\nconst Card: React.FC<AnyCardProps> = ({\n variant = 'default',\n tone = 'neutral',\n title,\n subtitle,\n extra,\n children,\n padding = '20px',\n size = 'default',\n width,\n minWidth,\n dimmed = false,\n direction,\n align,\n fullHeight = false,\n border = 'base',\n alignSelf,\n height,\n footer,\n glassFooter = false,\n className = '',\n style = {},\n headerConfig = {},\n}) => {\n const footerRef = useRef<HTMLDivElement>(null);\n const [footerHeight, setFooterHeight] = useState(0);\n\n useEffect(() => {\n if (glassFooter && footer && footerRef.current) {\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n setFooterHeight(entry.contentRect.height);\n }\n });\n\n observer.observe(footerRef.current);\n setFooterHeight(footerRef.current.offsetHeight);\n\n return () => observer.disconnect();\n }\n }, [glassFooter, footer]);\n\n // Size-specific padding\n const sizeClasses = size === 'small' ? 'text-sm' : '';\n\n // Dynamic classes based on props\n const cardClasses = [\n 'card-base',\n dimmed ? 'card-dimmed' : '',\n border === 'rounded' ? 'card-rounded' : '',\n fullHeight ? 'h-full' : '',\n height ? 'flex flex-col' : '',\n sizeClasses,\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n const headerInset = headerConfig?.padding ? undefined : horizontalInset(padding);\n\n // Content styles\n const paddingValue = parseInt(padding) || 20;\n const extraPadding = 10;\n const contentStyles: React.CSSProperties = {\n padding,\n // The card clips overflow, so a long token in flowing text breaks rather than vanishing.\n // Flex and grid items keep their min-content width; those need their own wrapping.\n overflowWrap: 'break-word',\n display: direction ? 'flex' : undefined,\n flexDirection: direction,\n alignItems: align,\n ...(height && { overflow: 'auto', height: '100%' }),\n ...(glassFooter &&\n footer &&\n footerHeight > 0 && {\n paddingBottom: `${paddingValue + footerHeight + extraPadding}px`,\n }),\n };\n\n if (variant === 'framed') {\n return (\n <div\n className={`${FRAME_CLASS} flex flex-col ${className}`}\n style={{\n // The frame drops `card-base`, which carried the text colour.\n ...FOREGROUND_RESET,\n backgroundColor: frameToneBackground(tone),\n width,\n minWidth,\n alignSelf,\n ...(fullHeight && { height: '100%' }),\n ...(height && { height }),\n ...style,\n }}\n >\n {hasHeaderContent({ title, subtitle, extra }) && (\n <FrameHeader title={title} subtitle={subtitle} extra={extra} />\n )}\n <div\n className=\"min-h-0 flex-1\"\n style={{\n ...FRAME_SECTION_STYLE,\n padding,\n overflowWrap: 'break-word',\n display: direction ? 'flex' : undefined,\n flexDirection: direction,\n alignItems: align,\n ...(height && { overflow: 'auto' }),\n }}\n >\n {children}\n </div>\n {footer && <div className=\"px-4 py-3\">{footer}</div>}\n </div>\n );\n }\n\n // Card container styles\n const cardContainerStyles: React.CSSProperties = {\n width,\n minWidth,\n alignSelf,\n ...(fullHeight && { height: '100%' }),\n ...(height && { height, display: 'flex', flexDirection: 'column' }),\n ...(glassFooter && footer && { position: 'relative' }),\n overflow: 'hidden',\n ...style,\n };\n\n return (\n <div className={cardClasses} style={cardContainerStyles}>\n {/* Header */}\n {hasHeaderContent({ title, subtitle, extra }) && (\n <div\n className={headerInset ? 'card-header py-2' : 'card-header px-3 py-2'}\n style={{\n marginBottom: '1px',\n fontSize: size === 'small' ? '12px' : '13px',\n fontWeight: 'normal',\n ...(headerConfig?.padding\n ? { padding: headerConfig.padding }\n : headerInset),\n }}\n >\n <HeaderRow\n title={title}\n subtitle={subtitle}\n extra={extra}\n titleClassName=\"font-normal overflow-visible\"\n />\n </div>\n )}\n\n {/* Body */}\n <div\n className=\"flex-1\"\n style={{\n ...contentStyles,\n ...(glassFooter && footer && { position: 'relative' }),\n }}\n >\n {children}\n </div>\n\n {/* Footer */}\n {footer && (\n <div\n ref={glassFooter ? footerRef : undefined}\n className=\"card-footer px-4 py-3\"\n style={\n glassFooter\n ? {\n ...GLASS_SURFACE_STYLE,\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n borderBottomLeftRadius: border === 'rounded' ? '20px' : '12px',\n borderBottomRightRadius: border === 'rounded' ? '20px' : '12px',\n }\n : undefined\n }\n >\n {footer}\n </div>\n )}\n </div>\n );\n};\n\nexport default Card;\nexport { Card };\n"],"names":["PLAIN_LENGTH","horizontalInset","padding","parts","part","top","right","left","Card","variant","tone","title","subtitle","extra","children","size","width","minWidth","dimmed","direction","align","fullHeight","border","alignSelf","height","footer","glassFooter","className","style","headerConfig","footerRef","useRef","footerHeight","setFooterHeight","useState","useEffect","observer","entries","entry","cardClasses","headerInset","paddingValue","contentStyles","jsxs","FRAME_CLASS","FOREGROUND_RESET","frameToneBackground","hasHeaderContent","jsx","FrameHeader","FRAME_SECTION_STYLE","cardContainerStyles","HeaderRow","GLASS_SURFACE_STYLE"],"mappings":";;;;;;;AA0DA,MAAMA,IAAe,0BAIfC,IAAkB,CAACC,MAAqD;AAC1E,QAAMC,IAAQD,EAAQ,KAAA,EAAO,MAAM,KAAK;AACxC,MAAIC,EAAM,SAAS,KAAK,CAACA,EAAM,MAAM,CAACC,MAASJ,EAAa,KAAKI,CAAI,CAAC;AAClE;AAEJ,QAAM,CAACC,GAAKC,IAAQD,KAAOE,IAAOD,CAAK,IAAIH;AAC3C,SAAO,WAAWI,CAAI,IAAI,KAAK,WAAWD,CAAK,IAAI,IAC7C,EAAE,aAAaC,GAAM,cAAcD,MACnC;AACV,GAEME,KAA+B,CAAC;AAAA,EAClC,SAAAC,IAAU;AAAA,EACV,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAZ,IAAU;AAAA,EACV,MAAAa,IAAO;AAAA,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Y,SAAS;AAAA,QAAA,IAE7D;AAAA,QAGT,UAAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EACL,GAER;AAER;"}
|
|
1
|
+
{"version":3,"file":"Card.js","sources":["../../src/components/Card.tsx"],"sourcesContent":["import React, { useRef, useEffect, useState } from 'react';\nimport FrameHeader, { HeaderRow } from './FrameHeader';\nimport { FRAME_CLASS, FRAME_SECTION_STYLE, frameToneBackground } from './frameStyles';\nimport { GLASS_SURFACE_STYLE } from './glassSurface';\nimport { hasHeaderContent } from './headerContent';\nimport type { ModalTrayTone } from './modalTray';\nimport { FOREGROUND_RESET } from './selectedRow';\n\n/**\n * `framed` draws the detached Table's frame: the title row sits on a grey frame and the children\n * in a bordered section inside it, so a card above a table reads as part of the same set.\n * `dimmed`, `border`, `size`, `glassFooter` and `headerConfig` do not apply to it.\n */\nexport type CardVariant = 'default' | 'framed';\nexport type CardTone = ModalTrayTone;\n\nexport interface CardProps {\n variant?: CardVariant;\n /** Only a framed card takes a tone; see `FramedCardProps`. */\n tone?: never;\n title?: string | React.ReactNode;\n /** Dimmed text beside the title, such as a count or a unit. */\n subtitle?: React.ReactNode;\n /** Actions at the right of the title row. */\n extra?: React.ReactNode;\n /**\n * Move `extra` onto a line of its own, under the title and still at the right, when the title\n * and subtitle do not fit on one line beside it, rather than shrinking the title to fit, which\n * on a framed card cuts it short. The header grows by that line, so leave room for it in a card\n * of fixed height. On a framed card it also adds 6px above and below the title row, so an\n * `extra` taller than 32px makes the header taller than 44px; use a small or medium control.\n * Keep text that changes width, such as a live save status, out of a wrapping `extra`.\n */\n wrapExtra?: boolean;\n padding?: string;\n children?: React.ReactNode;\n size?: 'default' | 'small';\n width?: string;\n minWidth?: string;\n direction?: 'row' | 'column';\n align?: 'center';\n dimmed?: boolean;\n fullHeight?: boolean;\n border?: 'base' | 'rounded';\n alignSelf?: 'center';\n height?: string;\n footer?: React.ReactNode;\n glassFooter?: boolean;\n className?: string;\n style?: React.CSSProperties;\n headerConfig?: {\n padding?: string;\n };\n}\n\n/** A framed card, which alone takes a `tone`. A second interface so `CardProps` keeps its shape. */\nexport interface FramedCardProps extends Omit<CardProps, 'variant' | 'tone'> {\n variant: Extract<CardVariant, 'framed'>;\n /**\n * Paints the frame in the tray colour of the outcome it reports, as `Modal`'s `tray` does.\n * `neutral` keeps the default grey frame, so it still matches a detached Table.\n */\n tone?: CardTone;\n}\n\nexport type AnyCardProps = CardProps | FramedCardProps;\n\nconst PLAIN_LENGTH = /^\\d*\\.?\\d+(px|rem|em)$/;\n\n// Only plain positive lengths are copied: calc() and var() can't be split from a shorthand, and a\n// zero inset would put the title against the border, so those keep the header's own 12px.\nconst horizontalInset = (padding: string): React.CSSProperties | undefined => {\n const parts = padding.trim().split(/\\s+/);\n if (parts.length > 4 || !parts.every((part) => PLAIN_LENGTH.test(part))) {\n return undefined;\n }\n const [top, right = top, , left = right] = parts;\n return parseFloat(left) > 0 && parseFloat(right) > 0\n ? { paddingLeft: left, paddingRight: right }\n : undefined;\n};\n\nconst Card: React.FC<AnyCardProps> = ({\n variant = 'default',\n tone = 'neutral',\n title,\n subtitle,\n extra,\n wrapExtra = false,\n children,\n padding = '20px',\n size = 'default',\n width,\n minWidth,\n dimmed = false,\n direction,\n align,\n fullHeight = false,\n border = 'base',\n alignSelf,\n height,\n footer,\n glassFooter = false,\n className = '',\n style = {},\n headerConfig = {},\n}) => {\n const footerRef = useRef<HTMLDivElement>(null);\n const [footerHeight, setFooterHeight] = useState(0);\n\n useEffect(() => {\n if (glassFooter && footer && footerRef.current) {\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n setFooterHeight(entry.contentRect.height);\n }\n });\n\n observer.observe(footerRef.current);\n setFooterHeight(footerRef.current.offsetHeight);\n\n return () => observer.disconnect();\n }\n }, [glassFooter, footer]);\n\n // Size-specific padding\n const sizeClasses = size === 'small' ? 'text-sm' : '';\n\n // Dynamic classes based on props\n const cardClasses = [\n 'card-base',\n dimmed ? 'card-dimmed' : '',\n border === 'rounded' ? 'card-rounded' : '',\n fullHeight ? 'h-full' : '',\n height ? 'flex flex-col' : '',\n sizeClasses,\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n const headerInset = headerConfig?.padding ? undefined : horizontalInset(padding);\n\n // Content styles\n const paddingValue = parseInt(padding) || 20;\n const extraPadding = 10;\n const contentStyles: React.CSSProperties = {\n padding,\n // The card clips overflow, so a long token in flowing text breaks rather than vanishing.\n // Flex and grid items keep their min-content width; those need their own wrapping.\n overflowWrap: 'break-word',\n display: direction ? 'flex' : undefined,\n flexDirection: direction,\n alignItems: align,\n ...(height && { overflow: 'auto', height: '100%' }),\n ...(glassFooter &&\n footer &&\n footerHeight > 0 && {\n paddingBottom: `${paddingValue + footerHeight + extraPadding}px`,\n }),\n };\n\n if (variant === 'framed') {\n return (\n <div\n className={`${FRAME_CLASS} flex flex-col ${className}`}\n style={{\n // The frame drops `card-base`, which carried the text colour.\n ...FOREGROUND_RESET,\n backgroundColor: frameToneBackground(tone),\n width,\n minWidth,\n alignSelf,\n ...(fullHeight && { height: '100%' }),\n ...(height && { height }),\n ...style,\n }}\n >\n {hasHeaderContent({ title, subtitle, extra }) && (\n <FrameHeader\n title={title}\n subtitle={subtitle}\n extra={extra}\n wrapExtra={wrapExtra}\n />\n )}\n {children !== undefined && (\n <div\n className=\"min-h-0 flex-1\"\n style={{\n ...FRAME_SECTION_STYLE,\n padding,\n overflowWrap: 'break-word',\n display: direction ? 'flex' : undefined,\n flexDirection: direction,\n alignItems: align,\n ...(height && { overflow: 'auto' }),\n }}\n >\n {children}\n </div>\n )}\n {footer && <div className=\"px-4 py-3\">{footer}</div>}\n </div>\n );\n }\n\n // Card container styles\n const cardContainerStyles: React.CSSProperties = {\n width,\n minWidth,\n alignSelf,\n ...(fullHeight && { height: '100%' }),\n ...(height && { height, display: 'flex', flexDirection: 'column' }),\n ...(glassFooter && footer && { position: 'relative' }),\n overflow: 'hidden',\n ...style,\n };\n\n return (\n <div className={cardClasses} style={cardContainerStyles}>\n {/* Header */}\n {hasHeaderContent({ title, subtitle, extra }) && (\n <div\n className={headerInset ? 'card-header py-2' : 'card-header px-3 py-2'}\n style={{\n marginBottom: '1px',\n fontSize: size === 'small' ? '12px' : '13px',\n fontWeight: 'normal',\n ...(headerConfig?.padding\n ? { padding: headerConfig.padding }\n : headerInset),\n }}\n >\n <HeaderRow\n title={title}\n subtitle={subtitle}\n extra={extra}\n wrapExtra={wrapExtra}\n titleClassName=\"font-normal overflow-visible\"\n />\n </div>\n )}\n\n {/* Body */}\n <div\n className=\"flex-1\"\n style={{\n ...contentStyles,\n ...(glassFooter && footer && { position: 'relative' }),\n }}\n >\n {children}\n </div>\n\n {/* Footer */}\n {footer && (\n <div\n ref={glassFooter ? footerRef : undefined}\n className=\"card-footer px-4 py-3\"\n style={\n glassFooter\n ? {\n ...GLASS_SURFACE_STYLE,\n position: 'absolute',\n bottom: 0,\n left: 0,\n right: 0,\n borderBottomLeftRadius: border === 'rounded' ? '20px' : '12px',\n borderBottomRightRadius: border === 'rounded' ? '20px' : '12px',\n }\n : undefined\n }\n >\n {footer}\n </div>\n )}\n </div>\n );\n};\n\nexport default Card;\nexport { Card };\n"],"names":["PLAIN_LENGTH","horizontalInset","padding","parts","part","top","right","left","Card","variant","tone","title","subtitle","extra","wrapExtra","children","size","width","minWidth","dimmed","direction","align","fullHeight","border","alignSelf","height","footer","glassFooter","className","style","headerConfig","footerRef","useRef","footerHeight","setFooterHeight","useState","useEffect","observer","entries","entry","cardClasses","headerInset","paddingValue","contentStyles","jsxs","FRAME_CLASS","FOREGROUND_RESET","frameToneBackground","hasHeaderContent","jsx","FrameHeader","FRAME_SECTION_STYLE","cardContainerStyles","HeaderRow","GLASS_SURFACE_STYLE"],"mappings":";;;;;;;AAmEA,MAAMA,IAAe,0BAIfC,IAAkB,CAACC,MAAqD;AAC1E,QAAMC,IAAQD,EAAQ,KAAA,EAAO,MAAM,KAAK;AACxC,MAAIC,EAAM,SAAS,KAAK,CAACA,EAAM,MAAM,C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AA,MACnB;AAAA,IAAA;AAAA,IAKR,gBAAAmC;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,WAAU;AAAA,QACV,OAAO;AAAA,UACH,GAAGN;AAAA,UACH,GAAIhB,KAAeD,KAAU,EAAE,UAAU,WAAA;AAAA,QAAW;AAAA,QAGvD,UAAAX;AAAA,MAAA;AAAA,IAAA;AAAA,IAIJW,KACG,gBAAAuB;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,KAAKtB,IAAcI,IAAY;AAAA,QAC/B,WAAU;AAAA,QACV,OACIJ,IACM;AAAA,UACI,GAAG2B;AAAA,UACH,UAAU;AAAA,UACV,QAAQ;AAAA,UACR,MAAM;AAAA,UACN,OAAO;AAAA,UACP,wBAAwB/B,MAAW,YAAY,SAAS;AAAA,UACxD,yBAAyBA,MAAW,YAAY,SAAS;AAAA,QAAA,IAE7D;AAAA,QAGT,UAAAG;AAAA,MAAA;AAAA,IAAA;AAAA,EACL,GAER;AAER;"}
|
package/dist/components/Flex.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx as v } from "react/jsx-runtime";
|
|
2
|
-
import { FlexDirection as a, FlexAlign as
|
|
3
|
-
const
|
|
2
|
+
import { FlexDirection as a, FlexAlign as S, FlexJustify as h, FlexGapSize as e } from "./flexTypes.js";
|
|
3
|
+
const y = (t) => {
|
|
4
4
|
switch (t) {
|
|
5
|
+
case e.XXSmall:
|
|
6
|
+
return 4;
|
|
5
7
|
case e.XSmall:
|
|
6
8
|
return 8;
|
|
7
9
|
case e.Small:
|
|
@@ -12,10 +14,10 @@ const F = (t) => {
|
|
|
12
14
|
return 36;
|
|
13
15
|
}
|
|
14
16
|
}, D = ({
|
|
15
|
-
justify: t =
|
|
16
|
-
align:
|
|
17
|
+
justify: t = h.Center,
|
|
18
|
+
align: r = S.Center,
|
|
17
19
|
gapSize: i,
|
|
18
|
-
direction:
|
|
20
|
+
direction: o = a.Horizontal,
|
|
19
21
|
fullHeight: n = !1,
|
|
20
22
|
grow: s = !1,
|
|
21
23
|
shrink: c = !1,
|
|
@@ -26,12 +28,12 @@ const F = (t) => {
|
|
|
26
28
|
children: m,
|
|
27
29
|
className: p = ""
|
|
28
30
|
}) => {
|
|
29
|
-
const l = i ?
|
|
31
|
+
const l = i ? y(i) : void 0, g = {
|
|
30
32
|
display: "flex",
|
|
31
|
-
flexDirection:
|
|
33
|
+
flexDirection: o === a.Vertical ? "column" : "row",
|
|
32
34
|
flexWrap: f ? "wrap" : void 0,
|
|
33
35
|
justifyContent: t,
|
|
34
|
-
alignItems:
|
|
36
|
+
alignItems: r,
|
|
35
37
|
gap: l ? `${l}px` : void 0,
|
|
36
38
|
height: n ? "100%" : void 0,
|
|
37
39
|
flex: s ? 1 : void 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flex.js","sources":["../../src/components/Flex.tsx"],"sourcesContent":["import React from 'react';\nimport { FlexAlign, FlexDirection, FlexGapSize, FlexJustify } from './flexTypes';\n\ninterface FlexProps {\n justify?: FlexJustify;\n align?: FlexAlign;\n gapSize?: FlexGapSize;\n direction?: FlexDirection;\n fullHeight?: boolean;\n grow?: boolean;\n shrink?: boolean;\n wrap?: boolean;\n width?: string;\n id?: string;\n /** `span` for content inside a button, such as a clickable `Surface.Row`. */\n as?: 'div' | 'span';\n children?: React.ReactNode;\n className?: string;\n}\n\nconst getGapSize = (size: FlexGapSize): number => {\n switch (size) {\n case FlexGapSize.XSmall:\n return 8;\n case FlexGapSize.Small:\n return 12;\n case FlexGapSize.Medium:\n return 24;\n case FlexGapSize.Large:\n return 36;\n }\n};\n\nconst Flex: React.FC<FlexProps> = ({\n justify = FlexJustify.Center,\n align = FlexAlign.Center,\n gapSize,\n direction = FlexDirection.Horizontal,\n fullHeight = false,\n grow = false,\n shrink = false,\n wrap = false,\n width,\n as = 'div',\n id,\n children,\n className = '',\n}) => {\n const gapSizeValue = gapSize ? getGapSize(gapSize) : undefined;\n\n // Convert direction to CSS flex-direction\n const flexDirection = direction === FlexDirection.Vertical ? 'column' : 'row';\n\n const baseStyle: React.CSSProperties = {\n display: 'flex',\n flexDirection,\n flexWrap: wrap ? 'wrap' : undefined,\n justifyContent: justify,\n alignItems: align,\n gap: gapSizeValue ? `${gapSizeValue}px` : undefined,\n height: fullHeight ? '100%' : undefined,\n flex: grow ? 1 : undefined,\n minWidth: shrink ? 0 : undefined,\n width: width || undefined,\n };\n\n const Tag = as;\n return (\n <Tag id={id} className={className} style={baseStyle}>\n {children}\n </Tag>\n );\n};\n\nexport default Flex;\n"],"names":["getGapSize","size","FlexGapSize","Flex","justify","FlexJustify","align","FlexAlign","gapSize","direction","FlexDirection","fullHeight","grow","shrink","wrap","width","as","id","children","className","gapSizeValue","baseStyle"],"mappings":";;AAoBA,MAAMA,IAAa,CAACC,MAA8B;AAC9C,UAAQA,GAAA;AAAA,IACJ,KAAKC,EAAY;AACb,aAAO;AAAA,IACX,KAAKA,EAAY;AACb,aAAO;AAAA,IACX,KAAKA,EAAY;AACb,aAAO;AAAA,IACX,KAAKA,EAAY;AACb,aAAO;AAAA,EAAA;AAEnB,GAEMC,IAA4B,CAAC;AAAA,EAC/B,SAAAC,IAAUC,EAAY;AAAA,EACtB,OAAAC,IAAQC,EAAU;AAAA,EAClB,SAAAC;AAAA,EACA,WAAAC,IAAYC,EAAc;AAAA,EAC1B,YAAAC,IAAa;AAAA,EACb,MAAAC,IAAO;AAAA,EACP,QAAAC,IAAS;AAAA,EACT,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,IAAAC,IAAK;AAAA,EACL,IAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AAChB,MAAM;AACF,QAAMC,IAAeZ,IAAUR,EAAWQ,CAAO,IAAI,QAK/Ca,IAAiC;AAAA,IACnC,SAAS;AAAA,IACT,eAJkBZ,MAAcC,EAAc,WAAW,WAAW;AAAA,IAKpE,UAAUI,IAAO,SAAS;AAAA,IAC1B,gBAAgBV;AAAA,IAChB,YAAYE;AAAA,IACZ,KAAKc,IAAe,GAAGA,CAAY,OAAO;AAAA,IAC1C,QAAQT,IAAa,SAAS;AAAA,IAC9B,MAAMC,IAAO,IAAI;AAAA,IACjB,UAAUC,IAAS,IAAI;AAAA,IACvB,OAAOE,KAAS;AAAA,EAAA;AAIpB,2BADYC,GAEP,EAAI,IAAAC,GAAQ,WAAAE,GAAsB,OAAOE,GACrC,UAAAH,GACL;AAER;"}
|
|
1
|
+
{"version":3,"file":"Flex.js","sources":["../../src/components/Flex.tsx"],"sourcesContent":["import React from 'react';\nimport { FlexAlign, FlexDirection, FlexGapSize, FlexJustify } from './flexTypes';\n\ninterface FlexProps {\n justify?: FlexJustify;\n align?: FlexAlign;\n gapSize?: FlexGapSize;\n direction?: FlexDirection;\n fullHeight?: boolean;\n grow?: boolean;\n shrink?: boolean;\n wrap?: boolean;\n width?: string;\n id?: string;\n /** `span` for content inside a button, such as a clickable `Surface.Row`. */\n as?: 'div' | 'span';\n children?: React.ReactNode;\n className?: string;\n}\n\nconst getGapSize = (size: FlexGapSize): number => {\n switch (size) {\n case FlexGapSize.XXSmall:\n return 4;\n case FlexGapSize.XSmall:\n return 8;\n case FlexGapSize.Small:\n return 12;\n case FlexGapSize.Medium:\n return 24;\n case FlexGapSize.Large:\n return 36;\n }\n};\n\nconst Flex: React.FC<FlexProps> = ({\n justify = FlexJustify.Center,\n align = FlexAlign.Center,\n gapSize,\n direction = FlexDirection.Horizontal,\n fullHeight = false,\n grow = false,\n shrink = false,\n wrap = false,\n width,\n as = 'div',\n id,\n children,\n className = '',\n}) => {\n const gapSizeValue = gapSize ? getGapSize(gapSize) : undefined;\n\n // Convert direction to CSS flex-direction\n const flexDirection = direction === FlexDirection.Vertical ? 'column' : 'row';\n\n const baseStyle: React.CSSProperties = {\n display: 'flex',\n flexDirection,\n flexWrap: wrap ? 'wrap' : undefined,\n justifyContent: justify,\n alignItems: align,\n gap: gapSizeValue ? `${gapSizeValue}px` : undefined,\n height: fullHeight ? '100%' : undefined,\n flex: grow ? 1 : undefined,\n minWidth: shrink ? 0 : undefined,\n width: width || undefined,\n };\n\n const Tag = as;\n return (\n <Tag id={id} className={className} style={baseStyle}>\n {children}\n </Tag>\n );\n};\n\nexport default Flex;\n"],"names":["getGapSize","size","FlexGapSize","Flex","justify","FlexJustify","align","FlexAlign","gapSize","direction","FlexDirection","fullHeight","grow","shrink","wrap","width","as","id","children","className","gapSizeValue","baseStyle"],"mappings":";;AAoBA,MAAMA,IAAa,CAACC,MAA8B;AAC9C,UAAQA,GAAA;AAAA,IACJ,KAAKC,EAAY;AACb,aAAO;AAAA,IACX,KAAKA,EAAY;AACb,aAAO;AAAA,IACX,KAAKA,EAAY;AACb,aAAO;AAAA,IACX,KAAKA,EAAY;AACb,aAAO;AAAA,IACX,KAAKA,EAAY;AACb,aAAO;AAAA,EAAA;AAEnB,GAEMC,IAA4B,CAAC;AAAA,EAC/B,SAAAC,IAAUC,EAAY;AAAA,EACtB,OAAAC,IAAQC,EAAU;AAAA,EAClB,SAAAC;AAAA,EACA,WAAAC,IAAYC,EAAc;AAAA,EAC1B,YAAAC,IAAa;AAAA,EACb,MAAAC,IAAO;AAAA,EACP,QAAAC,IAAS;AAAA,EACT,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,IAAAC,IAAK;AAAA,EACL,IAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AAChB,MAAM;AACF,QAAMC,IAAeZ,IAAUR,EAAWQ,CAAO,IAAI,QAK/Ca,IAAiC;AAAA,IACnC,SAAS;AAAA,IACT,eAJkBZ,MAAcC,EAAc,WAAW,WAAW;AAAA,IAKpE,UAAUI,IAAO,SAAS;AAAA,IAC1B,gBAAgBV;AAAA,IAChB,YAAYE;AAAA,IACZ,KAAKc,IAAe,GAAGA,CAAY,OAAO;AAAA,IAC1C,QAAQT,IAAa,SAAS;AAAA,IAC9B,MAAMC,IAAO,IAAI;AAAA,IACjB,UAAUC,IAAS,IAAI;AAAA,IACvB,OAAOE,KAAS;AAAA,EAAA;AAIpB,2BADYC,GAEP,EAAI,IAAAC,GAAQ,WAAAE,GAAsB,OAAOE,GACrC,UAAAH,GACL;AAER;"}
|
|
@@ -1,36 +1,43 @@
|
|
|
1
1
|
import { jsx as m, jsxs as t } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import f from "./TruncatedTooltip.js";
|
|
3
3
|
import { isShown as i } from "./headerContent.js";
|
|
4
|
-
const
|
|
4
|
+
const c = (e, a) => a ? /* @__PURE__ */ m(f, { text: e, describesTrigger: !1, children: e }) : e, x = ({
|
|
5
5
|
title: e,
|
|
6
6
|
subtitle: a,
|
|
7
7
|
extra: r,
|
|
8
|
-
truncate:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
truncate: l = !1,
|
|
9
|
+
wrapExtra: s = !1,
|
|
10
|
+
titleClassName: n = "",
|
|
11
|
+
className: d = ""
|
|
12
|
+
}) => /* @__PURE__ */ t("div", { className: `flex items-center gap-2 ${s ? "flex-wrap" : ""} ${d}`, children: [
|
|
13
|
+
(i(e) || i(a)) && /* @__PURE__ */ t(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
className: `flex min-w-0 items-baseline gap-2 ${s ? "flex-auto" : "flex-1"}`,
|
|
17
|
+
children: [
|
|
18
|
+
i(e) && /* @__PURE__ */ m(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
className: `min-w-0 ${i(a) ? "" : "flex-1"} ${n}`,
|
|
22
|
+
children: c(e, l)
|
|
23
|
+
}
|
|
24
|
+
),
|
|
25
|
+
i(a) && /* @__PURE__ */ m("div", { className: "min-w-0 text-[var(--malachite-text-dimmed,#a1a1a1)]", children: c(a, l) })
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
),
|
|
22
29
|
i(r) && /* @__PURE__ */ m("div", { className: "ml-auto flex shrink-0 items-center gap-1", children: r })
|
|
23
|
-
] }),
|
|
30
|
+
] }), v = (e) => /* @__PURE__ */ m(
|
|
24
31
|
x,
|
|
25
32
|
{
|
|
26
33
|
...e,
|
|
27
34
|
truncate: !0,
|
|
28
|
-
className:
|
|
35
|
+
className: `min-h-11 w-full pl-4 pr-2 text-[13px] ${e.wrapExtra ? "py-1.5" : ""}`,
|
|
29
36
|
titleClassName: "font-medium tracking-[0.13px] text-[var(--malachite-text-primary,#0a0a0a)]"
|
|
30
37
|
}
|
|
31
38
|
);
|
|
32
39
|
export {
|
|
33
40
|
x as HeaderRow,
|
|
34
|
-
|
|
41
|
+
v as default
|
|
35
42
|
};
|
|
36
43
|
//# sourceMappingURL=FrameHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrameHeader.js","sources":["../../src/components/FrameHeader.tsx"],"sourcesContent":["import type React from 'react';\nimport TruncatedTooltip from './TruncatedTooltip';\nimport { isShown } from './headerContent';\n\ninterface HeaderRowProps {\n title?: React.ReactNode;\n subtitle?: React.ReactNode;\n extra?: React.ReactNode;\n /** Cut a long title or subtitle short, with the full text in a tooltip, rather than wrap it. */\n truncate?: boolean;\n titleClassName?: string;\n className?: string;\n}\n\nconst fitted = (node: React.ReactNode, truncate: boolean) =>\n truncate ? (\n <TruncatedTooltip text={node} describesTrigger={false}>\n {node}\n </TruncatedTooltip>\n ) : (\n node\n );\n\n/**\n * A title, a dimmed subtitle beside it and `extra` at the right edge: the header of a Card and\n * of the frame a framed Card and the detached Table share. Without a subtitle the title cell\n * takes the row's width, so a title node laid out across the header keeps doing so.\n */\nexport const HeaderRow: React.FC<HeaderRowProps> = ({\n title,\n subtitle,\n extra,\n truncate = false,\n titleClassName = '',\n className = '',\n}) => (\n <div className={`flex items-center gap-2 ${className}`}>\n {(isShown(title) || isShown(subtitle)) && (\n <div
|
|
1
|
+
{"version":3,"file":"FrameHeader.js","sources":["../../src/components/FrameHeader.tsx"],"sourcesContent":["import type React from 'react';\nimport TruncatedTooltip from './TruncatedTooltip';\nimport { isShown } from './headerContent';\n\ninterface HeaderRowProps {\n title?: React.ReactNode;\n subtitle?: React.ReactNode;\n extra?: React.ReactNode;\n /** Cut a long title or subtitle short, with the full text in a tooltip, rather than wrap it. */\n truncate?: boolean;\n /** Move `extra` onto a line of its own, under the title, when the two do not fit on one. */\n wrapExtra?: boolean;\n titleClassName?: string;\n className?: string;\n}\n\nconst fitted = (node: React.ReactNode, truncate: boolean) =>\n truncate ? (\n <TruncatedTooltip text={node} describesTrigger={false}>\n {node}\n </TruncatedTooltip>\n ) : (\n node\n );\n\n/**\n * A title, a dimmed subtitle beside it and `extra` at the right edge: the header of a Card and\n * of the frame a framed Card and the detached Table share. Without a subtitle the title cell\n * takes the row's width, so a title node laid out across the header keeps doing so. With\n * `wrapExtra`, a title and subtitle that together do not fit on one line beside `extra` keep the\n * row to themselves and `extra` wraps under them, still at the right edge; without it they share\n * the row and the title cell shrinks to whatever `extra` leaves.\n */\nexport const HeaderRow: React.FC<HeaderRowProps> = ({\n title,\n subtitle,\n extra,\n truncate = false,\n wrapExtra = false,\n titleClassName = '',\n className = '',\n}) => (\n <div className={`flex items-center gap-2 ${wrapExtra ? 'flex-wrap' : ''} ${className}`}>\n {(isShown(title) || isShown(subtitle)) && (\n <div\n className={`flex min-w-0 items-baseline gap-2 ${wrapExtra ? 'flex-auto' : 'flex-1'}`}\n >\n {isShown(title) && (\n <div\n className={`min-w-0 ${isShown(subtitle) ? '' : 'flex-1'} ${titleClassName}`}\n >\n {fitted(title, truncate)}\n </div>\n )}\n {isShown(subtitle) && (\n <div className=\"min-w-0 text-[var(--malachite-text-dimmed,#a1a1a1)]\">\n {fitted(subtitle, truncate)}\n </div>\n )}\n </div>\n )}\n {isShown(extra) && <div className=\"ml-auto flex shrink-0 items-center gap-1\">{extra}</div>}\n </div>\n);\n\n/**\n * The title row on a frame, above its section, with the title in the detached Table's\n * column-header type. A title or subtitle too long for the row is cut short, with the full text\n * in a tooltip; with `wrapExtra`, `extra` wraps under them first, so only one wider than the\n * whole row is.\n */\nconst FrameHeader: React.FC<Omit<HeaderRowProps, 'truncate' | 'titleClassName' | 'className'>> = (\n props,\n) => (\n <HeaderRow\n {...props}\n truncate\n className={`min-h-11 w-full pl-4 pr-2 text-[13px] ${props.wrapExtra ? 'py-1.5' : ''}`}\n titleClassName=\"font-medium tracking-[0.13px] text-[var(--malachite-text-primary,#0a0a0a)]\"\n />\n);\n\nexport default FrameHeader;\n"],"names":["fitted","node","truncate","jsx","TruncatedTooltip","HeaderRow","title","subtitle","extra","wrapExtra","titleClassName","className","jsxs","isShown","FrameHeader","props"],"mappings":";;;AAgBA,MAAMA,IAAS,CAACC,GAAuBC,MACnCA,IACI,gBAAAC,EAACC,GAAA,EAAiB,MAAMH,GAAM,kBAAkB,IAC3C,UAAAA,EAAA,CACL,IAEAA,GAWKI,IAAsC,CAAC;AAAA,EAChD,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAN,IAAW;AAAA,EACX,WAAAO,IAAY;AAAA,EACZ,gBAAAC,IAAiB;AAAA,EACjB,WAAAC,IAAY;AAChB,MACI,gBAAAC,EAAC,SAAI,WAAW,2BAA2BH,IAAY,cAAc,EAAE,IAAIE,CAAS,IAC9E,UAAA;AAAA,GAAAE,EAAQP,CAAK,KAAKO,EAAQN,CAAQ,MAChC,gBAAAK;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAW,qCAAqCH,IAAY,cAAc,QAAQ;AAAA,MAEjF,UAAA;AAAA,QAAAI,EAAQP,CAAK,KACV,gBAAAH;AAAA,UAAC;AAAA,UAAA;AAAA,YACG,WAAW,WAAWU,EAAQN,CAAQ,IAAI,KAAK,QAAQ,IAAIG,CAAc;AAAA,YAExE,UAAAV,EAAOM,GAAOJ,CAAQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAG9BW,EAAQN,CAAQ,KACb,gBAAAJ,EAAC,OAAA,EAAI,WAAU,uDACV,UAAAH,EAAOO,GAAUL,CAAQ,EAAA,CAC9B;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAAA,EAIXW,EAAQL,CAAK,uBAAM,OAAA,EAAI,WAAU,4CAA4C,UAAAA,EAAA,CAAM;AAAA,EAAA,CACxF,GASEM,IAA2F,CAC7FC,MAEA,gBAAAZ;AAAA,EAACE;AAAA,EAAA;AAAA,IACI,GAAGU;AAAA,IACJ,UAAQ;AAAA,IACR,WAAW,yCAAyCA,EAAM,YAAY,WAAW,EAAE;AAAA,IACnF,gBAAe;AAAA,EAAA;AACnB;"}
|
|
@@ -1,18 +1,33 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Hexagon as
|
|
3
|
-
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { Hexagon as l } from "./Hexagon.js";
|
|
3
|
+
import f from "./Tooltip.js";
|
|
4
|
+
const p = (t, o) => {
|
|
5
|
+
const r = t == null ? void 0 : t.trim(), i = o == null ? void 0 : o.trim();
|
|
6
|
+
if (r)
|
|
7
|
+
return i ? `${r} · ${i}` : r;
|
|
8
|
+
}, v = ({
|
|
9
|
+
steps: t,
|
|
10
|
+
current: o,
|
|
11
|
+
label: r,
|
|
12
|
+
stepLabels: i,
|
|
13
|
+
currentNote: m,
|
|
14
|
+
className: d
|
|
15
|
+
}) => /* @__PURE__ */ n(
|
|
4
16
|
"span",
|
|
5
17
|
{
|
|
6
|
-
role:
|
|
7
|
-
"aria-label":
|
|
8
|
-
"aria-hidden":
|
|
9
|
-
className:
|
|
18
|
+
role: r ? "img" : void 0,
|
|
19
|
+
"aria-label": r,
|
|
20
|
+
"aria-hidden": r ? void 0 : !0,
|
|
21
|
+
className: d,
|
|
10
22
|
style: { display: "inline-flex", flexShrink: 0, alignItems: "center", gap: 2 },
|
|
11
|
-
children:
|
|
23
|
+
children: t.map((g, e) => {
|
|
24
|
+
const s = e === o, a = /* @__PURE__ */ n(l, { tone: g, size: "small", dimmed: !s }, e), c = p(i == null ? void 0 : i[e], s ? m : void 0);
|
|
25
|
+
return c ? /* @__PURE__ */ n(f, { text: c, triggerAs: "span", inline: !0, describesTrigger: !1, children: a }, e) : a;
|
|
26
|
+
})
|
|
12
27
|
}
|
|
13
28
|
);
|
|
14
29
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
30
|
+
v as HexagonScale,
|
|
31
|
+
v as default
|
|
17
32
|
};
|
|
18
33
|
//# sourceMappingURL=HexagonScale.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HexagonScale.js","sources":["../../src/components/HexagonScale.tsx"],"sourcesContent":["import type React from 'react';\nimport Hexagon, { type HexagonTone } from './Hexagon';\n\nexport interface HexagonScaleProps {\n /** One hexagon per step, in order. */\n steps: readonly HexagonTone[];\n /** Index of the step drawn at full strength; the rest are dimmed. Omit to dim them all. */\n current?: number;\n /** Only when it stands alone; beside text naming the step it is decorative. */\n label?: string;\n className?: string;\n}\n\n// Inline, not Tailwind: menus portal outside the shadow root's stylesheet.\nexport const HexagonScale: React.FC<HexagonScaleProps> = ({
|
|
1
|
+
{"version":3,"file":"HexagonScale.js","sources":["../../src/components/HexagonScale.tsx"],"sourcesContent":["import type React from 'react';\nimport Hexagon, { type HexagonTone } from './Hexagon';\nimport Tooltip from './Tooltip';\n\nexport interface HexagonScaleProps {\n /** One hexagon per step, in order. */\n steps: readonly HexagonTone[];\n /** Index of the step drawn at full strength; the rest are dimmed. Omit to dim them all. */\n current?: number;\n /** Only when it stands alone; beside text naming the step it is decorative. */\n label?: string;\n stepLabels?: readonly string[];\n currentNote?: string;\n className?: string;\n}\n\nconst stepName = (name: string | undefined, note: string | undefined): string | undefined => {\n const base = name?.trim();\n const extra = note?.trim();\n if (!base) {\n return undefined;\n }\n return extra ? `${base} · ${extra}` : base;\n};\n\n// Inline, not Tailwind: menus portal outside the shadow root's stylesheet.\nexport const HexagonScale: React.FC<HexagonScaleProps> = ({\n steps,\n current,\n label,\n stepLabels,\n currentNote,\n className,\n}) => (\n <span\n role={label ? 'img' : undefined}\n aria-label={label}\n aria-hidden={label ? undefined : true}\n className={className}\n style={{ display: 'inline-flex', flexShrink: 0, alignItems: 'center', gap: 2 }}\n >\n {steps.map((tone, index) => {\n const isCurrent = index === current;\n const hexagon = <Hexagon key={index} tone={tone} size=\"small\" dimmed={!isCurrent} />;\n const name = stepName(stepLabels?.[index], isCurrent ? currentNote : undefined);\n return name ? (\n <Tooltip key={index} text={name} triggerAs=\"span\" inline describesTrigger={false}>\n {hexagon}\n </Tooltip>\n ) : (\n hexagon\n );\n })}\n </span>\n);\n\nexport default HexagonScale;\n"],"names":["stepName","name","note","base","extra","HexagonScale","steps","current","label","stepLabels","currentNote","className","jsx","tone","index","isCurrent","hexagon","Hexagon","Tooltip"],"mappings":";;;AAgBA,MAAMA,IAAW,CAACC,GAA0BC,MAAiD;AACzF,QAAMC,IAAOF,KAAA,gBAAAA,EAAM,QACbG,IAAQF,KAAA,gBAAAA,EAAM;AACpB,MAAKC;AAGL,WAAOC,IAAQ,GAAGD,CAAI,MAAMC,CAAK,KAAKD;AAC1C,GAGaE,IAA4C,CAAC;AAAA,EACtD,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AACJ,MACI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,MAAMJ,IAAQ,QAAQ;AAAA,IACtB,cAAYA;AAAA,IACZ,eAAaA,IAAQ,SAAY;AAAA,IACjC,WAAAG;AAAA,IACA,OAAO,EAAE,SAAS,eAAe,YAAY,GAAG,YAAY,UAAU,KAAK,EAAA;AAAA,IAE1E,UAAAL,EAAM,IAAI,CAACO,GAAMC,MAAU;AACxB,YAAMC,IAAYD,MAAUP,GACtBS,sBAAWC,GAAA,EAAoB,MAAAJ,GAAY,MAAK,SAAQ,QAAQ,CAACE,EAAA,GAAzCD,CAAoD,GAC5Eb,IAAOD,EAASS,KAAA,gBAAAA,EAAaK,IAAQC,IAAYL,IAAc,MAAS;AAC9E,aAAOT,IACH,gBAAAW,EAACM,GAAA,EAAoB,MAAMjB,GAAM,WAAU,QAAO,QAAM,IAAC,kBAAkB,IACtE,UAAAe,EAAA,GADSF,CAEd,IAEAE;AAAA,IAER,CAAC;AAAA,EAAA;AACL;"}
|
|
@@ -1,66 +1,82 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as e, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
import b from "./Typography/EllipsisText.js";
|
|
3
3
|
import f from "./Typography/Text.js";
|
|
4
|
-
import { textOf as
|
|
5
|
-
import { isRenderableNode as
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
import { textOf as h } from "./childrenText.js";
|
|
5
|
+
import { isRenderableNode as m } from "./renderableNode.js";
|
|
6
|
+
const g = {
|
|
7
|
+
neutral: "bg-[var(--malachite-text-dimmed,rgb(161,161,161))]",
|
|
8
|
+
success: "bg-[var(--malachite-text-success,rgb(2,122,66))]",
|
|
9
|
+
warning: "bg-[var(--malachite-text-warning,rgb(150,88,10))]",
|
|
10
|
+
error: "bg-[var(--malachite-text-error,rgb(237,53,54))]"
|
|
11
|
+
}, u = 0.2, v = ({
|
|
12
|
+
label: s,
|
|
13
|
+
tone: a,
|
|
14
|
+
className: t = "",
|
|
15
|
+
children: r,
|
|
16
|
+
truncate: l = !1,
|
|
17
|
+
tooltip: i,
|
|
18
|
+
prefix: n,
|
|
19
|
+
suffix: c
|
|
14
20
|
}) => {
|
|
15
|
-
const
|
|
16
|
-
return /* @__PURE__ */
|
|
21
|
+
const d = i !== void 0, x = m(i) ? i : null, p = h(r);
|
|
22
|
+
return /* @__PURE__ */ o(
|
|
17
23
|
"div",
|
|
18
24
|
{
|
|
19
|
-
className: `flex min-w-0 flex-1 basis-0 flex-col gap-[3px] border-0 border-s border-solid border-[var(--malachite-card-border,#e8e8e8)] px-[18px] first:border-s-0 ${
|
|
25
|
+
className: `flex min-w-0 flex-1 basis-0 flex-col gap-[3px] border-0 border-s border-solid border-[var(--malachite-card-border,#e8e8e8)] px-[18px] first:border-s-0 ${t}`,
|
|
20
26
|
children: [
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
/* @__PURE__ */ o("dt", { className: `m-0 min-w-0 break-words ${a ? "flex items-start gap-[6px]" : ""}`, children: [
|
|
28
|
+
a && /* @__PURE__ */ e(
|
|
29
|
+
"span",
|
|
30
|
+
{
|
|
31
|
+
"aria-hidden": "true",
|
|
32
|
+
"data-tone": a,
|
|
33
|
+
className: `mt-[6px] h-[6px] w-[6px] shrink-0 rounded-full ${g[a]}`
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ e(f, { size: "xsmall", color: "secondary", className: "min-w-0", children: s })
|
|
37
|
+
] }),
|
|
38
|
+
/* @__PURE__ */ o("dd", { className: "m-0 flex min-w-0 items-center text-[length:var(--malachite-font-size-small,13px)] leading-[1.5] font-medium text-[var(--malachite-text-primary,#0a0a0a)] [overflow-wrap:anywhere]", children: [
|
|
39
|
+
m(n) && /* @__PURE__ */ e("span", { className: "me-[8px] flex shrink-0 items-center", children: n }),
|
|
40
|
+
l ? /* @__PURE__ */ e(
|
|
41
|
+
b,
|
|
26
42
|
{
|
|
27
43
|
color: "inherit",
|
|
28
|
-
tooltip:
|
|
29
|
-
tooltipWhenTruncated: !
|
|
30
|
-
tooltipDelay:
|
|
31
|
-
focusableTrigger:
|
|
32
|
-
children:
|
|
44
|
+
tooltip: d ? x : p,
|
|
45
|
+
tooltipWhenTruncated: !d,
|
|
46
|
+
tooltipDelay: u,
|
|
47
|
+
focusableTrigger: x !== null && !!p,
|
|
48
|
+
children: r
|
|
33
49
|
}
|
|
34
|
-
) : /* @__PURE__ */ e("span", { className: "min-w-0", children:
|
|
35
|
-
|
|
50
|
+
) : /* @__PURE__ */ e("span", { className: "min-w-0", children: r }),
|
|
51
|
+
m(c) && /* @__PURE__ */ e("span", { className: "ms-[4px] flex shrink-0 items-center", children: c })
|
|
36
52
|
] })
|
|
37
53
|
]
|
|
38
54
|
}
|
|
39
55
|
);
|
|
40
|
-
},
|
|
41
|
-
className:
|
|
42
|
-
children:
|
|
43
|
-
"aria-label":
|
|
44
|
-
"aria-labelledby":
|
|
56
|
+
}, w = ({
|
|
57
|
+
className: s = "",
|
|
58
|
+
children: a,
|
|
59
|
+
"aria-label": t,
|
|
60
|
+
"aria-labelledby": r
|
|
45
61
|
}) => {
|
|
46
|
-
const
|
|
62
|
+
const l = !!(t || r);
|
|
47
63
|
return (
|
|
48
64
|
// A role on the dl would drop its term/definition semantics.
|
|
49
65
|
/* @__PURE__ */ e(
|
|
50
66
|
"div",
|
|
51
67
|
{
|
|
52
|
-
role:
|
|
53
|
-
"aria-label":
|
|
54
|
-
"aria-labelledby":
|
|
55
|
-
className: `w-full ${
|
|
56
|
-
children: /* @__PURE__ */ e("dl", { className: "m-0 flex w-full rounded-[10px] bg-[var(--malachite-table-background,#f7f7f7)] py-[11px]", children:
|
|
68
|
+
role: l ? "group" : void 0,
|
|
69
|
+
"aria-label": l && t || void 0,
|
|
70
|
+
"aria-labelledby": l && r || void 0,
|
|
71
|
+
className: `w-full ${s}`,
|
|
72
|
+
children: /* @__PURE__ */ e("dl", { className: "m-0 flex w-full rounded-[10px] bg-[var(--malachite-table-background,#f7f7f7)] py-[11px]", children: a })
|
|
57
73
|
}
|
|
58
74
|
)
|
|
59
75
|
);
|
|
60
76
|
};
|
|
61
|
-
|
|
77
|
+
w.Item = v;
|
|
62
78
|
export {
|
|
63
|
-
|
|
64
|
-
|
|
79
|
+
w as KeyValueStrip,
|
|
80
|
+
w as default
|
|
65
81
|
};
|
|
66
82
|
//# sourceMappingURL=KeyValueStrip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyValueStrip.js","sources":["../../src/components/KeyValueStrip.tsx"],"sourcesContent":["import type React from 'react';\nimport EllipsisText from './Typography/EllipsisText';\nimport Text from './Typography/Text';\nimport { textOf } from './childrenText';\nimport { isRenderableNode } from './renderableNode';\n\nexport interface KeyValueStripProps {\n className?: string;\n children: React.ReactNode;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n}\n\nexport interface KeyValueStripItemProps {\n label: React.ReactNode;\n className?: string;\n children: React.ReactNode;\n /** One line with an ellipsis. Block/flex children clip without one, so use their own truncate. */\n truncate?: boolean;\n /**\n * Needs `truncate`. By default a text value shows in full when cut off; a given tooltip always\n * shows and makes a text value a tab stop. `null` turns it off.\n */\n tooltip?: React.ReactNode;\n /** Before the value, never truncated, e.g. an icon. */\n prefix?: React.ReactNode;\n /** After the value, never truncated, e.g. a copy button. */\n suffix?: React.ReactNode;\n}\n\n// Faster than Tooltip's 1s: a strip is read by hovering along it.\nconst TOOLTIP_DELAY_S = 0.2;\n\nconst Item: React.FC<KeyValueStripItemProps> = ({\n label,\n className = '',\n children,\n truncate = false,\n tooltip,\n prefix,\n suffix,\n}) => {\n const ownTooltip = tooltip !== undefined;\n const given = isRenderableNode(tooltip) ? tooltip : null;\n const text = textOf(children);\n return (\n <div\n className={`flex min-w-0 flex-1 basis-0 flex-col gap-[3px] border-0 border-s border-solid border-[var(--malachite-card-border,#e8e8e8)] px-[18px] first:border-s-0 ${className}`}\n >\n <dt className
|
|
1
|
+
{"version":3,"file":"KeyValueStrip.js","sources":["../../src/components/KeyValueStrip.tsx"],"sourcesContent":["import type React from 'react';\nimport EllipsisText from './Typography/EllipsisText';\nimport Text from './Typography/Text';\nimport { textOf } from './childrenText';\nimport { isRenderableNode } from './renderableNode';\n\nexport interface KeyValueStripProps {\n className?: string;\n children: React.ReactNode;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n}\n\nexport type KeyValueStripTone = 'neutral' | 'success' | 'warning' | 'error';\n\nexport interface KeyValueStripItemProps {\n label: React.ReactNode;\n tone?: KeyValueStripTone;\n className?: string;\n children: React.ReactNode;\n /** One line with an ellipsis. Block/flex children clip without one, so use their own truncate. */\n truncate?: boolean;\n /**\n * Needs `truncate`. By default a text value shows in full when cut off; a given tooltip always\n * shows and makes a text value a tab stop. `null` turns it off.\n */\n tooltip?: React.ReactNode;\n /** Before the value, never truncated, e.g. an icon. */\n prefix?: React.ReactNode;\n /** After the value, never truncated, e.g. a copy button. */\n suffix?: React.ReactNode;\n}\n\nconst TONE_DOT: Record<KeyValueStripTone, string> = {\n neutral: 'bg-[var(--malachite-text-dimmed,rgb(161,161,161))]',\n success: 'bg-[var(--malachite-text-success,rgb(2,122,66))]',\n warning: 'bg-[var(--malachite-text-warning,rgb(150,88,10))]',\n error: 'bg-[var(--malachite-text-error,rgb(237,53,54))]',\n};\n\n// Faster than Tooltip's 1s: a strip is read by hovering along it.\nconst TOOLTIP_DELAY_S = 0.2;\n\nconst Item: React.FC<KeyValueStripItemProps> = ({\n label,\n tone,\n className = '',\n children,\n truncate = false,\n tooltip,\n prefix,\n suffix,\n}) => {\n const ownTooltip = tooltip !== undefined;\n const given = isRenderableNode(tooltip) ? tooltip : null;\n const text = textOf(children);\n return (\n <div\n className={`flex min-w-0 flex-1 basis-0 flex-col gap-[3px] border-0 border-s border-solid border-[var(--malachite-card-border,#e8e8e8)] px-[18px] first:border-s-0 ${className}`}\n >\n <dt className={`m-0 min-w-0 break-words ${tone ? 'flex items-start gap-[6px]' : ''}`}>\n {tone && (\n <span\n aria-hidden=\"true\"\n data-tone={tone}\n className={`mt-[6px] h-[6px] w-[6px] shrink-0 rounded-full ${TONE_DOT[tone]}`}\n />\n )}\n <Text size=\"xsmall\" color=\"secondary\" className=\"min-w-0\">\n {label}\n </Text>\n </dt>\n <dd className=\"m-0 flex min-w-0 items-center text-[length:var(--malachite-font-size-small,13px)] leading-[1.5] font-medium text-[var(--malachite-text-primary,#0a0a0a)] [overflow-wrap:anywhere]\">\n {isRenderableNode(prefix) && (\n <span className=\"me-[8px] flex shrink-0 items-center\">{prefix}</span>\n )}\n {truncate ? (\n <EllipsisText\n color=\"inherit\"\n tooltip={ownTooltip ? given : text}\n tooltipWhenTruncated={!ownTooltip}\n tooltipDelay={TOOLTIP_DELAY_S}\n focusableTrigger={given !== null && !!text}\n >\n {children}\n </EllipsisText>\n ) : (\n <span className=\"min-w-0\">{children}</span>\n )}\n {isRenderableNode(suffix) && (\n <span className=\"ms-[4px] flex shrink-0 items-center\">{suffix}</span>\n )}\n </dd>\n </div>\n );\n};\n\n/**\n * Label/value cells in one sunken band, e.g. the facts under a side panel header. Not for table\n * rows: a given tooltip mounts up front.\n */\nconst KeyValueStrip: React.FC<KeyValueStripProps> & { Item: typeof Item } = ({\n className = '',\n children,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n}) => {\n const named = !!(ariaLabel || ariaLabelledBy);\n return (\n // A role on the dl would drop its term/definition semantics.\n <div\n role={named ? 'group' : undefined}\n aria-label={named ? ariaLabel || undefined : undefined}\n aria-labelledby={named ? ariaLabelledBy || undefined : undefined}\n className={`w-full ${className}`}\n >\n <dl className=\"m-0 flex w-full rounded-[10px] bg-[var(--malachite-table-background,#f7f7f7)] py-[11px]\">\n {children}\n </dl>\n </div>\n );\n};\n\nKeyValueStrip.Item = Item;\n\nexport default KeyValueStrip;\nexport { KeyValueStrip };\n"],"names":["TONE_DOT","TOOLTIP_DELAY_S","Item","label","tone","className","children","truncate","tooltip","prefix","suffix","ownTooltip","given","isRenderableNode","text","textOf","jsxs","jsx","Text","EllipsisText","KeyValueStrip","ariaLabel","ariaLabelledBy","named"],"mappings":";;;;;AAiCA,MAAMA,IAA8C;AAAA,EAChD,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACX,GAGM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AK,WAAU,uCAAuC,UAAAA,EAAA,CAAO;AAAA,QAAA,EAAA,CAEtE;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGZ,GAMMU,IAAsE,CAAC;AAAA,EACzE,WAAAf,IAAY;AAAA,EACZ,UAAAC;AAAA,EACA,cAAce;AAAA,EACd,mBAAmBC;AACvB,MAAM;AACF,QAAMC,IAAQ,CAAC,EAAEF,KAAaC;AAC9B;AAAA;AAAA,IAEI,gBAAAL;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,MAAMM,IAAQ,UAAU;AAAA,QACxB,cAAYA,KAAQF,KAAa;AAAA,QACjC,mBAAiBE,KAAQD,KAAkB;AAAA,QAC3C,WAAW,UAAUjB,CAAS;AAAA,QAE9B,UAAA,gBAAAY,EAAC,MAAA,EAAG,WAAU,2FACT,UAAAX,EAAA,CACL;AAAA,MAAA;AAAA,IAAA;AAAA;AAGZ;AAEAc,EAAc,OAAOlB;"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { EmptyLayout as o } from "./emptyLayout.js";
|
|
2
|
-
import { PageColumn as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { PageColumn as m } from "./pageColumn.js";
|
|
3
|
+
import { PageColumns as t } from "./pageColumns.js";
|
|
4
|
+
import { RegularLayout as r } from "./regularLayout.js";
|
|
5
|
+
import { PageActions as n } from "./regularLayout.js";
|
|
6
|
+
const l = { Regular: r, Empty: o, Column: m, Columns: t };
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
n as PageActions,
|
|
9
|
+
l as PageLayout,
|
|
10
|
+
l as default
|
|
10
11
|
};
|
|
11
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/PageLayout/index.tsx"],"sourcesContent":["import Empty from './emptyLayout';\nimport Column from './pageColumn';\nimport Regular from './regularLayout';\n\nexport const PageLayout = { Regular, Empty, Column };\n\nexport default PageLayout;\nexport type { BreadcrumbLink, PageAction, RenderLink } from './types';\nexport { PageActions } from './regularLayout';\nexport type { PageContentGap, PageContentWidth, RegularLayoutProps } from './regularLayout';\nexport type { EmptyLayoutProps } from './emptyLayout';\nexport type { PageColumnProps } from './pageColumn';\n"],"names":["PageLayout","Regular","Empty","Column"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/PageLayout/index.tsx"],"sourcesContent":["import Empty from './emptyLayout';\nimport Column from './pageColumn';\nimport Columns from './pageColumns';\nimport Regular from './regularLayout';\n\nexport const PageLayout = { Regular, Empty, Column, Columns };\n\nexport default PageLayout;\nexport type { BreadcrumbLink, PageAction, RenderLink } from './types';\nexport { PageActions } from './regularLayout';\nexport type { PageContentGap, PageContentWidth, RegularLayoutProps } from './regularLayout';\nexport type { EmptyLayoutProps } from './emptyLayout';\nexport type { PageColumnProps } from './pageColumn';\nexport type { PageColumnsProps } from './pageColumns';\n"],"names":["PageLayout","Regular","Empty","Column","Columns"],"mappings":";;;;;AAKO,MAAMA,IAAa,EAAA,SAAEC,UAASC,GAAA,QAAOC,YAAQC,EAAA;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { CONTENT_INSET_VAR as t } from "./constants.js";
|
|
3
|
+
import { CONTENT_GAPS as a } from "./pageColumn.js";
|
|
4
|
+
const c = ({ gap: s = "xlarge", children: l, className: o = "" }) => /* @__PURE__ */ r(
|
|
5
|
+
"div",
|
|
6
|
+
{
|
|
7
|
+
className: `@container w-full ${o}`,
|
|
8
|
+
style: { [t]: "0px" },
|
|
9
|
+
children: /* @__PURE__ */ r(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
12
|
+
className: "grid grid-cols-1 items-start @[768px]:grid-cols-2",
|
|
13
|
+
style: { gap: a[s] },
|
|
14
|
+
children: l
|
|
15
|
+
}
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
export {
|
|
20
|
+
c as PageColumns,
|
|
21
|
+
c as default
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=pageColumns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pageColumns.js","sources":["../../../src/components/PageLayout/pageColumns.tsx"],"sourcesContent":["import React from 'react';\nimport { CONTENT_INSET_VAR } from './constants';\nimport { CONTENT_GAPS, type PageContentGap } from './pageColumn';\n\nexport interface PageColumnsProps {\n /** Space between the columns, and between them once stacked. Defaults to `xlarge`. */\n gap?: PageContentGap;\n /** Exactly two children, one per column; a third wraps onto a new row. */\n children: React.ReactNode;\n className?: string;\n}\n\n/**\n * Two equal columns that stack into one when the content area, not the viewport, is narrower\n * than 768px, so a page beside the app sidebar stacks at the width it actually has. Needs a\n * parent with a definite width, such as a page body: it measures its container, so inside a\n * box that sizes to its content it collapses. Inside `contentWidth=\"narrow\"` it always stacks.\n */\nconst PageColumns: React.FC<PageColumnsProps> = ({ gap = 'xlarge', children, className = '' }) => (\n <div\n className={`@container w-full ${className}`}\n style={{ [CONTENT_INSET_VAR]: '0px' } as React.CSSProperties}\n >\n <div\n className=\"grid grid-cols-1 items-start @[768px]:grid-cols-2\"\n style={{ gap: CONTENT_GAPS[gap] }}\n >\n {children}\n </div>\n </div>\n);\n\nexport default PageColumns;\nexport { PageColumns };\n"],"names":["PageColumns","gap","children","className","jsx","CONTENT_INSET_VAR","CONTENT_GAPS"],"mappings":";;;AAkBA,MAAMA,IAA0C,CAAC,EAAE,KAAAC,IAAM,UAAU,UAAAC,GAAU,WAAAC,IAAY,SACrF,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,WAAW,qBAAqBD,CAAS;AAAA,IACzC,OAAO,EAAE,CAACE,CAAiB,GAAG,MAAA;AAAA,IAE9B,UAAA,gBAAAD;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,WAAU;AAAA,QACV,OAAO,EAAE,KAAKE,EAAaL,CAAG,EAAA;AAAA,QAE7B,UAAAC;AAAA,MAAA;AAAA,IAAA;AAAA,EACL;AACJ;"}
|