@mechane-ai/elements 0.17.2 → 0.19.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/dist/ai.js +208 -166
- package/dist/{categorical-values-l5YTG9G3.js → categorical-values-D-sSI9JB.js} +2 -2
- package/dist/{chart-frame-Bf1l_7-R.js → chart-frame-vwS7YVgv.js} +9 -3
- package/dist/{chart-input-fBuRm0Lc.js → chart-input-D6Fw2UGV.js} +1 -1
- package/dist/charts/cartesian.js +331 -228
- package/dist/charts/distribution.js +2 -2
- package/dist/charts/graph.js +2 -2
- package/dist/charts/hierarchy.js +3 -3
- package/dist/charts/matrix.js +2 -2
- package/dist/charts/timeline.js +1 -1
- package/dist/charts.js +1 -1
- package/dist/collections.js +1 -1
- package/dist/content/markdown.js +134 -132
- package/dist/content/tree.js +1 -1
- package/dist/elements.css +111 -0
- package/dist/forms.js +1 -1
- package/dist/navigation/commands.js +1 -1
- package/dist/packages/ai/src/index.d.ts +2 -0
- package/dist/packages/ai/src/message.d.ts +2 -1
- package/dist/packages/ai/src/reply-indicator.d.ts +6 -0
- package/dist/packages/charts/src/cartesian/bar-chart.d.ts +4 -8
- package/dist/packages/charts/src/cartesian/bar-data.d.ts +31 -0
- package/dist/packages/charts/src/cartesian/composition-bars.d.ts +14 -0
- package/dist/packages/charts/src/cartesian/index.d.ts +1 -1
- package/dist/packages/charts/src/chart-frame.d.ts +2 -1
- package/dist/packages/content/src/markdown/markdown.d.ts +1 -1
- package/dist/packages/forms/src/field-styles.d.ts +6 -0
- package/dist/packages/forms/src/forms.d.ts +2 -1
- package/dist/packages/foundations/src/visible-motion.d.ts +4 -0
- package/dist/{pierre-tree-BaIVTNmG.js → pierre-tree-BQBbAhmI.js} +1 -1
- package/dist/{src-R0kgHFPZ.js → src-Dven_9lR.js} +19 -12
- package/dist/visible-motion-1GcUaEi4.js +23 -0
- package/package.json +1 -1
|
@@ -10,5 +10,7 @@ export type { MessageBoundaryProps } from './message-boundary.tsx';
|
|
|
10
10
|
export { MessageBoundary } from './message-boundary.tsx';
|
|
11
11
|
export type { PromptInputProps, PromptInputPlaceholderProps } from './prompt-input.tsx';
|
|
12
12
|
export { PromptInput, PromptInputPlaceholder } from './prompt-input.tsx';
|
|
13
|
+
export { ReplyIndicator } from './reply-indicator.tsx';
|
|
14
|
+
export type { ReplyIndicatorProps } from './reply-indicator.tsx';
|
|
13
15
|
export type { Source, SourcesProps, InlineCitationProps } from './sources.tsx';
|
|
14
16
|
export { Sources, InlineCitation } from './sources.tsx';
|
|
@@ -9,6 +9,7 @@ export type MessageProps = {
|
|
|
9
9
|
readonly avatar?: ReactNode;
|
|
10
10
|
readonly actions?: ReactNode;
|
|
11
11
|
readonly attachments?: ReactNode;
|
|
12
|
+
readonly variant?: 'default' | 'chat';
|
|
12
13
|
};
|
|
13
14
|
export type MessageAttachmentProps = {
|
|
14
15
|
readonly name: string;
|
|
@@ -16,5 +17,5 @@ export type MessageAttachmentProps = {
|
|
|
16
17
|
readonly href?: string;
|
|
17
18
|
readonly actions?: ReactNode;
|
|
18
19
|
};
|
|
19
|
-
export declare function Message({ author, children, id, kind, meta, avatar, actions, attachments, }: MessageProps): ReactNode;
|
|
20
|
+
export declare function Message({ author, children, id, kind, meta, avatar, actions, attachments, variant, }: MessageProps): ReactNode;
|
|
20
21
|
export declare function MessageAttachment({ name, description, href, actions }: MessageAttachmentProps): ReactNode;
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ChartSelection } from '../chart-frame.tsx';
|
|
3
|
-
import type {
|
|
4
|
-
export type BarSeries
|
|
5
|
-
readonly id: string;
|
|
6
|
-
readonly label: string;
|
|
7
|
-
readonly values: ReadonlyArray<number | null>;
|
|
8
|
-
readonly tone?: ChartTone | undefined;
|
|
9
|
-
};
|
|
3
|
+
import type { BarComposition, BarSeries } from './bar-data.ts';
|
|
4
|
+
export type { BarSeries, BarBucket, BarComposition } from './bar-data.ts';
|
|
10
5
|
export type BarChartProps = {
|
|
11
6
|
readonly title: string;
|
|
12
7
|
readonly description?: string | undefined;
|
|
@@ -18,6 +13,7 @@ export type BarChartProps = {
|
|
|
18
13
|
readonly series: ReadonlyArray<BarSeries>;
|
|
19
14
|
readonly domain: readonly [number, number];
|
|
20
15
|
readonly mode?: 'grouped' | 'stacked' | undefined;
|
|
16
|
+
readonly composition?: BarComposition | undefined;
|
|
21
17
|
readonly formatValue: (value: number) => string;
|
|
22
18
|
readonly selection?: ChartSelection | undefined;
|
|
23
19
|
readonly height?: number | undefined;
|
|
@@ -27,4 +23,4 @@ export type BarChartPlaceholderProps = Pick<BarChartProps, 'description' | 'heig
|
|
|
27
23
|
readonly series?: ReadonlyArray<Pick<BarSeries, 'id' | 'label' | 'tone'>> | undefined;
|
|
28
24
|
};
|
|
29
25
|
export declare function BarChartPlaceholder({ title, description, series, height, }: BarChartPlaceholderProps): ReactNode;
|
|
30
|
-
export declare function BarChart({ title, description, categories, series, domain, mode, formatValue, selection, height, }: BarChartProps): ReactNode;
|
|
26
|
+
export declare function BarChart({ title, description, categories, series, domain, mode, formatValue, selection, height, composition, }: BarChartProps): ReactNode;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ChartTone } from '../chart-theme.ts';
|
|
2
|
+
export type BarSeries = {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly label: string;
|
|
5
|
+
readonly values: ReadonlyArray<number | null>;
|
|
6
|
+
readonly tone?: ChartTone | undefined;
|
|
7
|
+
};
|
|
8
|
+
export type BarBucket = {
|
|
9
|
+
readonly kind: 'parts' | 'total';
|
|
10
|
+
readonly total: number;
|
|
11
|
+
} | {
|
|
12
|
+
readonly kind: 'gap';
|
|
13
|
+
};
|
|
14
|
+
export type BarComposition = {
|
|
15
|
+
readonly buckets: ReadonlyArray<BarBucket>;
|
|
16
|
+
readonly contextLabel: string;
|
|
17
|
+
readonly focusedSeries?: BarSeries | undefined;
|
|
18
|
+
readonly annotation?: {
|
|
19
|
+
readonly categoryId: string;
|
|
20
|
+
readonly value: number;
|
|
21
|
+
readonly label: string;
|
|
22
|
+
} | undefined;
|
|
23
|
+
};
|
|
24
|
+
type CompositionInput = {
|
|
25
|
+
readonly composition: BarComposition | undefined;
|
|
26
|
+
readonly series: ReadonlyArray<BarSeries>;
|
|
27
|
+
readonly categoryIds: ReadonlyArray<string>;
|
|
28
|
+
readonly domain: readonly [number, number];
|
|
29
|
+
};
|
|
30
|
+
export declare function validateComposition({ composition, series, categoryIds, domain, }: CompositionInput): string | undefined;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { BarBucket, BarSeries } from './bar-data.ts';
|
|
3
|
+
type CompositionBarsProps = {
|
|
4
|
+
readonly bucket: BarBucket;
|
|
5
|
+
readonly series: ReadonlyArray<BarSeries>;
|
|
6
|
+
readonly focusedSeries: BarSeries | undefined;
|
|
7
|
+
readonly index: number;
|
|
8
|
+
readonly x: number;
|
|
9
|
+
readonly width: number;
|
|
10
|
+
readonly y: (value: number) => number;
|
|
11
|
+
readonly isHighlighted: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare function CompositionBars({ bucket, series, focusedSeries, index, x, width, y, isHighlighted, }: CompositionBarsProps): ReactNode;
|
|
14
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { BarSeries, BarChartProps, BarChartPlaceholderProps } from './bar-chart.tsx';
|
|
1
|
+
export type { BarSeries, BarBucket, BarComposition, BarChartProps, BarChartPlaceholderProps } from './bar-chart.tsx';
|
|
2
2
|
export { BarChart, BarChartPlaceholder } from './bar-chart.tsx';
|
|
3
3
|
export type { BreakdownBarProps } from './breakdown-bar.tsx';
|
|
4
4
|
export { BreakdownBar } from './breakdown-bar.tsx';
|
|
@@ -19,9 +19,10 @@ export type ChartLegendItem = {
|
|
|
19
19
|
export type ChartLegendProps = {
|
|
20
20
|
readonly items: ReadonlyArray<ChartLegendItem>;
|
|
21
21
|
readonly label?: string | undefined;
|
|
22
|
+
readonly isScrollable?: boolean | undefined;
|
|
22
23
|
};
|
|
23
24
|
export declare function ChartFrame({ title, description, children, actions, footer }: ChartFrameProps): ReactNode;
|
|
24
|
-
export declare function ChartLegend({ items, label }: ChartLegendProps): ReactNode;
|
|
25
|
+
export declare function ChartLegend({ items, label, isScrollable }: ChartLegendProps): ReactNode;
|
|
25
26
|
export declare function ChartDatumButton({ label, isSelected, onSelect, children, }: {
|
|
26
27
|
readonly label: string;
|
|
27
28
|
readonly isSelected?: boolean | undefined;
|
|
@@ -8,5 +8,5 @@ export type MarkdownProps = {
|
|
|
8
8
|
readonly tone?: 'default' | 'muted';
|
|
9
9
|
readonly weight?: 'regular' | 'strong';
|
|
10
10
|
};
|
|
11
|
-
export declare
|
|
11
|
+
export declare const Markdown: import("react").MemoExoticComponent<({ children, isStreaming, label, headingLevel, tone, weight, }: MarkdownProps) => ReactNode>;
|
|
12
12
|
export {};
|
|
@@ -29,6 +29,12 @@ export declare const fieldStyles: Readonly<{
|
|
|
29
29
|
readonly minHeight: stylex.StyleXClassNameFor<"minHeight", 80>;
|
|
30
30
|
readonly maxHeight: stylex.StyleXClassNameFor<"maxHeight", "30dvh">;
|
|
31
31
|
}>;
|
|
32
|
+
readonly growingTextarea: Readonly<{
|
|
33
|
+
readonly minHeight: stylex.StyleXClassNameFor<"minHeight", 0>;
|
|
34
|
+
readonly maxHeight: stylex.StyleXClassNameFor<"maxHeight", "16lh">;
|
|
35
|
+
readonly fieldSizing: stylex.StyleXClassNameFor<"fieldSizing", "content">;
|
|
36
|
+
readonly resize: stylex.StyleXClassNameFor<"resize", "none">;
|
|
37
|
+
}>;
|
|
32
38
|
}>;
|
|
33
39
|
export type TextareaAppearance = 'field' | 'plain';
|
|
34
40
|
export declare const textareaAppearanceStyles: Readonly<Record<TextareaAppearance, stylex.StyleXStyles>>;
|
|
@@ -18,6 +18,7 @@ type NativeTextareaProps = ComponentProps<'textarea'>;
|
|
|
18
18
|
type TextareaProps = Omit<NativeTextareaProps, 'value' | 'defaultValue' | 'onChange' | 'readOnly'> & TextValueProperties<NonNullable<NativeTextareaProps['value']>, NonNullable<NativeTextareaProps['onChange']>, NonNullable<BaseInputProps['onValueChange']>> & {
|
|
19
19
|
readonly xstyle?: PlacementStyle;
|
|
20
20
|
readonly isCompact?: boolean;
|
|
21
|
+
readonly shouldGrow?: boolean;
|
|
21
22
|
readonly appearance?: TextareaAppearance;
|
|
22
23
|
};
|
|
23
24
|
declare function FieldRoot({ className, style, xstyle, ...props }: FieldRootProps): ReactNode;
|
|
@@ -31,5 +32,5 @@ export declare const Field: {
|
|
|
31
32
|
Error: typeof FieldError;
|
|
32
33
|
};
|
|
33
34
|
export declare function Input({ className, style, xstyle, ...props }: InputProps): ReactNode;
|
|
34
|
-
export declare function Textarea({ isCompact, appearance, value, defaultValue, onValueChange, name, disabled, readOnly, required, className, style, xstyle, ...props }: TextareaProps): ReactNode;
|
|
35
|
+
export declare function Textarea({ isCompact, shouldGrow, appearance, value, defaultValue, onValueChange, name, disabled, readOnly, required, className, style, xstyle, ...props }: TextareaProps): ReactNode;
|
|
35
36
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as e } from "./src-BXh4g2VY.js";
|
|
2
|
-
import { l as t } from "./src-
|
|
2
|
+
import { l as t } from "./src-Dven_9lR.js";
|
|
3
3
|
import { t as n } from "./constants.stylex-bbdiv1fD.js";
|
|
4
4
|
import { r } from "./pierre-theme-BUeJim8s.js";
|
|
5
5
|
import * as i from "@stylexjs/stylex";
|
|
@@ -43,6 +43,13 @@ var E = {
|
|
|
43
43
|
kAzted: "xseoqlg",
|
|
44
44
|
kskxy: "x1y3glee",
|
|
45
45
|
$$css: !0
|
|
46
|
+
},
|
|
47
|
+
growingTextarea: {
|
|
48
|
+
kAzted: "x2lwn1j",
|
|
49
|
+
kskxy: "xp8lc2p",
|
|
50
|
+
kOwNse: "x5f5z56",
|
|
51
|
+
kHenm0: "xtt52l0",
|
|
52
|
+
$$css: !0
|
|
46
53
|
}
|
|
47
54
|
}, D = {
|
|
48
55
|
field: { field: { $$css: !0 } }.field,
|
|
@@ -808,20 +815,20 @@ function je({ className: t, style: n, xstyle: r, ...i }) {
|
|
|
808
815
|
})
|
|
809
816
|
});
|
|
810
817
|
}
|
|
811
|
-
function Me({ isCompact: t = !1,
|
|
818
|
+
function Me({ isCompact: t = !1, shouldGrow: n = !1, appearance: r = "field", value: i, defaultValue: a, onValueChange: s, name: l, disabled: d, readOnly: f, required: p, className: m, style: h, xstyle: g, ..._ }) {
|
|
812
819
|
return /* @__PURE__ */ u(S.Control, {
|
|
813
|
-
value:
|
|
814
|
-
defaultValue:
|
|
815
|
-
onValueChange:
|
|
816
|
-
name:
|
|
817
|
-
disabled:
|
|
818
|
-
readOnly:
|
|
819
|
-
required:
|
|
820
|
-
render: /* @__PURE__ */ u("textarea", { ...
|
|
820
|
+
value: i,
|
|
821
|
+
defaultValue: a,
|
|
822
|
+
onValueChange: s,
|
|
823
|
+
name: l,
|
|
824
|
+
disabled: d,
|
|
825
|
+
readOnly: f,
|
|
826
|
+
required: p,
|
|
827
|
+
render: /* @__PURE__ */ u("textarea", { ..._ }),
|
|
821
828
|
...o({
|
|
822
|
-
className:
|
|
823
|
-
style:
|
|
824
|
-
styles: c.props(e.base, e.field, E.input, e.textarea, t && E.compactTextarea, D[
|
|
829
|
+
className: m,
|
|
830
|
+
style: h,
|
|
831
|
+
styles: c.props(e.base, e.field, E.input, e.textarea, t && E.compactTextarea, n && E.growingTextarea, D[r], g)
|
|
825
832
|
})
|
|
826
833
|
});
|
|
827
834
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useEffect as e, useRef as t, useState as n } from "react";
|
|
2
|
+
// packages/foundations/src/visible-motion.ts
|
|
3
|
+
function r(r) {
|
|
4
|
+
let i = t(null), [a, o] = n(!1);
|
|
5
|
+
return e(() => {
|
|
6
|
+
let e = i.current;
|
|
7
|
+
if (!r || e === null) return;
|
|
8
|
+
let t = matchMedia("(prefers-reduced-motion: reduce)"), n = !1;
|
|
9
|
+
function a() {
|
|
10
|
+
o(n && !document.hidden && !t.matches);
|
|
11
|
+
}
|
|
12
|
+
let s = new IntersectionObserver((e) => {
|
|
13
|
+
n = e.some((e) => e.isIntersecting), a();
|
|
14
|
+
});
|
|
15
|
+
return s.observe(e), t.addEventListener("change", a), document.addEventListener("visibilitychange", a), () => {
|
|
16
|
+
s.disconnect(), t.removeEventListener("change", a), document.removeEventListener("visibilitychange", a);
|
|
17
|
+
};
|
|
18
|
+
}, [r]), {
|
|
19
|
+
ref: i,
|
|
20
|
+
isActive: r && a
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export { r as t };
|
package/package.json
CHANGED