@stackone/malachite 2.96.0 → 2.98.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 +2 -1
- package/dist/components/CodeBlock.js +161 -109
- package/dist/components/CodeBlock.js.map +1 -1
- package/dist/components/Timeline.js +103 -0
- package/dist/components/Timeline.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +354 -352
- package/dist/index.js.map +1 -1
- package/dist/tailwind.css.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx as e, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { Tag as x } from "./Tag.js";
|
|
3
|
+
import c from "./Typography/Text.js";
|
|
4
|
+
const p = {
|
|
5
|
+
neutral: "var(--malachite-text-secondary, rgb(123, 123, 123))",
|
|
6
|
+
info: "var(--malachite-text-info, rgb(12, 88, 174))",
|
|
7
|
+
success: "var(--malachite-text-success, rgb(2, 122, 66))",
|
|
8
|
+
warning: "var(--malachite-text-warning, rgb(150, 88, 10))",
|
|
9
|
+
error: "var(--malachite-text-error, rgb(237, 53, 54))"
|
|
10
|
+
}, f = ({
|
|
11
|
+
title: t,
|
|
12
|
+
time: a,
|
|
13
|
+
tone: n,
|
|
14
|
+
marker: r,
|
|
15
|
+
stopped: i = !1,
|
|
16
|
+
stoppedLabel: s,
|
|
17
|
+
children: m,
|
|
18
|
+
className: d = ""
|
|
19
|
+
}) => {
|
|
20
|
+
const o = n ?? (i ? "error" : "neutral");
|
|
21
|
+
return /* @__PURE__ */ l(
|
|
22
|
+
"li",
|
|
23
|
+
{
|
|
24
|
+
className: `relative m-0 flex gap-[14px] pb-[40px] last:pb-0 [&:last-child>[data-timeline-line]]:hidden ${d}`,
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ e(
|
|
27
|
+
"span",
|
|
28
|
+
{
|
|
29
|
+
"data-timeline-line": "",
|
|
30
|
+
"aria-hidden": "true",
|
|
31
|
+
className: "absolute start-[11px] top-[26px] bottom-[2px] w-[2px] bg-[var(--malachite-card-border,rgb(232,232,232))]"
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
/* @__PURE__ */ e(
|
|
35
|
+
"span",
|
|
36
|
+
{
|
|
37
|
+
"aria-hidden": "true",
|
|
38
|
+
className: `flex h-[24px] w-[24px] flex-none items-center justify-center overflow-hidden rounded-full ${r ? "" : "border border-solid border-[var(--malachite-card-border,rgb(232,232,232))]"}`,
|
|
39
|
+
children: r || /* @__PURE__ */ e(
|
|
40
|
+
"span",
|
|
41
|
+
{
|
|
42
|
+
"data-timeline-dot": o,
|
|
43
|
+
className: "h-[8px] w-[8px] rounded-full",
|
|
44
|
+
style: { backgroundColor: p[o] }
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
/* @__PURE__ */ l("div", { className: "flex min-w-0 flex-1 flex-col gap-[8px] pt-[2px]", children: [
|
|
50
|
+
/* @__PURE__ */ l("div", { className: "flex items-start justify-between gap-[12px]", children: [
|
|
51
|
+
/* @__PURE__ */ l("div", { className: "flex min-w-0 flex-wrap items-center gap-x-[8px] gap-y-[4px] [overflow-wrap:anywhere]", children: [
|
|
52
|
+
/* @__PURE__ */ e(c, { size: "small", fontWeight: "semi-bold", className: "min-w-0", children: t }),
|
|
53
|
+
i && /* @__PURE__ */ e("span", { className: "sr-only", children: ", " }),
|
|
54
|
+
i && /* @__PURE__ */ e(
|
|
55
|
+
x,
|
|
56
|
+
{
|
|
57
|
+
value: (s == null ? void 0 : s.trim()) || "Stopped here",
|
|
58
|
+
type: "error",
|
|
59
|
+
fontSize: "xsmall",
|
|
60
|
+
textTransform: "none",
|
|
61
|
+
paddingSize: "compact"
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
] }),
|
|
65
|
+
(a || a === 0) && /* @__PURE__ */ e("span", { className: "sr-only", children: ", " }),
|
|
66
|
+
(a || a === 0) && /* @__PURE__ */ e(
|
|
67
|
+
c,
|
|
68
|
+
{
|
|
69
|
+
size: "xsmall",
|
|
70
|
+
color: "secondary",
|
|
71
|
+
font: "mono",
|
|
72
|
+
wrap: !1,
|
|
73
|
+
className: "pt-[2px]",
|
|
74
|
+
children: a
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
] }),
|
|
78
|
+
m
|
|
79
|
+
] })
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}, h = ({
|
|
84
|
+
children: t,
|
|
85
|
+
className: a = "",
|
|
86
|
+
"aria-label": n,
|
|
87
|
+
"aria-labelledby": r
|
|
88
|
+
}) => /* @__PURE__ */ e(
|
|
89
|
+
"ol",
|
|
90
|
+
{
|
|
91
|
+
role: "list",
|
|
92
|
+
"aria-label": n,
|
|
93
|
+
"aria-labelledby": r,
|
|
94
|
+
className: `m-0 list-none p-0 ${a}`,
|
|
95
|
+
children: t
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
h.Item = f;
|
|
99
|
+
export {
|
|
100
|
+
h as Timeline,
|
|
101
|
+
h as default
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=Timeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Timeline.js","sources":["../../src/components/Timeline.tsx"],"sourcesContent":["import React from 'react';\nimport Tag from './Tag';\nimport Text from './Typography/Text';\n\nexport type TimelineTone = 'neutral' | 'info' | 'success' | 'warning' | 'error';\n\nexport interface TimelineProps {\n children: React.ReactNode;\n className?: string;\n 'aria-label'?: string;\n 'aria-labelledby'?: string;\n}\n\nexport interface TimelineItemProps {\n title: React.ReactNode;\n /** When the step happened, shown at the right of the title, e.g. `+6 ms`. */\n time?: React.ReactNode;\n /**\n * Paints the dot: `error` on a `stopped` step, else `neutral`, unless set. Colour alone, so the\n * title has to say what happened. Ignored when `marker` is set.\n */\n tone?: TimelineTone;\n /** Replaces the ringed dot with a 24px circle of its own, e.g. the caller's logo at size 24. Decorative: hidden from assistive tech. */\n marker?: React.ReactNode;\n /** Marks the step the flow ended on, with a badge after the title. */\n stopped?: boolean;\n /** The badge's text when `stopped`. Empty falls back to \"Stopped here\". */\n stoppedLabel?: string;\n /**\n * The step's detail, below the title: tags, copy, payloads. Each child is a row of its own, 8px\n * apart, and unstyled, so wrap copy in `Typography.Text`.\n */\n children?: React.ReactNode;\n className?: string;\n}\n\n// The light theme's values as fallbacks: the dot paints before the theme reaches `:host`.\nconst DOT_COLOR: Record<TimelineTone, string> = {\n neutral: 'var(--malachite-text-secondary, rgb(123, 123, 123))',\n info: 'var(--malachite-text-info, rgb(12, 88, 174))',\n success: 'var(--malachite-text-success, rgb(2, 122, 66))',\n warning: 'var(--malachite-text-warning, rgb(150, 88, 10))',\n error: 'var(--malachite-text-error, rgb(237, 53, 54))',\n};\n\nconst Item: React.FC<TimelineItemProps> = ({\n title,\n time,\n tone,\n marker,\n stopped = false,\n stoppedLabel,\n children,\n className = '',\n}) => {\n const dotTone = tone ?? (stopped ? 'error' : 'neutral');\n return (\n <li\n className={`relative m-0 flex gap-[14px] pb-[40px] last:pb-0 [&:last-child>[data-timeline-line]]:hidden ${className}`}\n >\n <span\n data-timeline-line=\"\"\n aria-hidden=\"true\"\n className=\"absolute start-[11px] top-[26px] bottom-[2px] w-[2px] bg-[var(--malachite-card-border,rgb(232,232,232))]\"\n />\n <span\n aria-hidden=\"true\"\n // The ring's border would cut into a marker, so a marker gets the full 24px circle instead.\n className={`flex h-[24px] w-[24px] flex-none items-center justify-center overflow-hidden rounded-full ${marker ? '' : 'border border-solid border-[var(--malachite-card-border,rgb(232,232,232))]'}`}\n >\n {marker || (\n <span\n data-timeline-dot={dotTone}\n className=\"h-[8px] w-[8px] rounded-full\"\n style={{ backgroundColor: DOT_COLOR[dotTone] }}\n />\n )}\n </span>\n <div className=\"flex min-w-0 flex-1 flex-col gap-[8px] pt-[2px]\">\n <div className=\"flex items-start justify-between gap-[12px]\">\n <div className=\"flex min-w-0 flex-wrap items-center gap-x-[8px] gap-y-[4px] [overflow-wrap:anywhere]\">\n <Text size=\"small\" fontWeight=\"semi-bold\" className=\"min-w-0\">\n {title}\n </Text>\n {stopped && <span className=\"sr-only\">, </span>}\n {stopped && (\n <Tag\n value={stoppedLabel?.trim() || 'Stopped here'}\n type=\"error\"\n fontSize=\"xsmall\"\n textTransform=\"none\"\n paddingSize=\"compact\"\n />\n )}\n </div>\n {(time || time === 0) && <span className=\"sr-only\">, </span>}\n {(time || time === 0) && (\n <Text\n size=\"xsmall\"\n color=\"secondary\"\n font=\"mono\"\n wrap={false}\n className=\"pt-[2px]\"\n >\n {time}\n </Text>\n )}\n </div>\n {children}\n </div>\n </li>\n );\n};\n\n/** A vertical sequence of steps, each with a dot on a connecting line, a title, its timing and a body. */\nconst Timeline: React.FC<TimelineProps> & { Item: typeof Item } = ({\n children,\n className = '',\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n}) => (\n <ol\n // list-style: none strips list semantics in WebKit, so VoiceOver would not announce the steps.\n role=\"list\"\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className={`m-0 list-none p-0 ${className}`}\n >\n {children}\n </ol>\n);\n\nTimeline.Item = Item;\n\nexport default Timeline;\nexport { Timeline };\n"],"names":["DOT_COLOR","Item","title","time","tone","marker","stopped","stoppedLabel","children","className","dotTone","jsxs","jsx","Text","Tag","Timeline","ariaLabel","ariaLabelledBy"],"mappings":";;;AAqCA,MAAMA,IAA0C;AAAA,EAC5C,SAAS;AAAA,EACT,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACX,GAEMC,IAAoC,CAAC;AAAA,EACvC,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AAChB,MAAM;AACF,QAAMC,IA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AA,gBACG,MAAK;AAAA,gBACL,OAAM;AAAA,gBACN,MAAK;AAAA,gBACL,MAAM;AAAA,gBACN,WAAU;AAAA,gBAET,UAAAV;AAAA,cAAA;AAAA,YAAA;AAAA,UACL,GAER;AAAA,UACCK;AAAA,QAAA,EAAA,CACL;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGZ,GAGMO,IAA4D,CAAC;AAAA,EAC/D,UAAAP;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,cAAcO;AAAA,EACd,mBAAmBC;AACvB,MACI,gBAAAL;AAAA,EAAC;AAAA,EAAA;AAAA,IAEG,MAAK;AAAA,IACL,cAAYI;AAAA,IACZ,mBAAiBC;AAAA,IACjB,WAAW,qBAAqBR,CAAS;AAAA,IAExC,UAAAD;AAAA,EAAA;AACL;AAGJO,EAAS,OAAOd;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1140,6 +1140,11 @@ declare interface CodeBlockProps {
|
|
|
1140
1140
|
language?: 'yaml' | 'cedar';
|
|
1141
1141
|
/** How much of a `json` tree starts collapsed: `true` all of it, a number below that depth. */
|
|
1142
1142
|
collapsed?: boolean | number;
|
|
1143
|
+
/**
|
|
1144
|
+
* Starts any nested node with more entries than this collapsed, at any depth, behind a keyboard
|
|
1145
|
+
* toggle naming its path and size; nodes within the limit keep the library's arrow. 0 or more.
|
|
1146
|
+
*/
|
|
1147
|
+
collapseLargerThan?: number;
|
|
1143
1148
|
/**
|
|
1144
1149
|
* Renders the change between two texts rather than one text, and takes precedence over
|
|
1145
1150
|
* `code` and `json`. Only the changed lines are shown, with `context` unchanged ones either
|
|
@@ -3160,6 +3165,8 @@ declare type InputVariant = 'default' | 'ghost';
|
|
|
3160
3165
|
|
|
3161
3166
|
export declare const IntegrationsIcon: React.FC<IconProps_65>;
|
|
3162
3167
|
|
|
3168
|
+
declare const Item: default_2.FC<TimelineItemProps>;
|
|
3169
|
+
|
|
3163
3170
|
export declare const Keycap: default_2.FC<KeycapProps>;
|
|
3164
3171
|
|
|
3165
3172
|
export declare interface KeycapProps {
|
|
@@ -5935,6 +5942,43 @@ export declare type TimeBarChartUnit = 'minute' | 'hour' | 'day' | 'week' | 'mon
|
|
|
5935
5942
|
|
|
5936
5943
|
declare type TimeInput = string | number | Date;
|
|
5937
5944
|
|
|
5945
|
+
/** A vertical sequence of steps, each with a dot on a connecting line, a title, its timing and a body. */
|
|
5946
|
+
export declare const Timeline: default_2.FC<TimelineProps> & {
|
|
5947
|
+
Item: typeof Item;
|
|
5948
|
+
};
|
|
5949
|
+
|
|
5950
|
+
export declare interface TimelineItemProps {
|
|
5951
|
+
title: default_2.ReactNode;
|
|
5952
|
+
/** When the step happened, shown at the right of the title, e.g. `+6 ms`. */
|
|
5953
|
+
time?: default_2.ReactNode;
|
|
5954
|
+
/**
|
|
5955
|
+
* Paints the dot: `error` on a `stopped` step, else `neutral`, unless set. Colour alone, so the
|
|
5956
|
+
* title has to say what happened. Ignored when `marker` is set.
|
|
5957
|
+
*/
|
|
5958
|
+
tone?: TimelineTone;
|
|
5959
|
+
/** Replaces the ringed dot with a 24px circle of its own, e.g. the caller's logo at size 24. Decorative: hidden from assistive tech. */
|
|
5960
|
+
marker?: default_2.ReactNode;
|
|
5961
|
+
/** Marks the step the flow ended on, with a badge after the title. */
|
|
5962
|
+
stopped?: boolean;
|
|
5963
|
+
/** The badge's text when `stopped`. Empty falls back to "Stopped here". */
|
|
5964
|
+
stoppedLabel?: string;
|
|
5965
|
+
/**
|
|
5966
|
+
* The step's detail, below the title: tags, copy, payloads. Each child is a row of its own, 8px
|
|
5967
|
+
* apart, and unstyled, so wrap copy in `Typography.Text`.
|
|
5968
|
+
*/
|
|
5969
|
+
children?: default_2.ReactNode;
|
|
5970
|
+
className?: string;
|
|
5971
|
+
}
|
|
5972
|
+
|
|
5973
|
+
export declare interface TimelineProps {
|
|
5974
|
+
children: default_2.ReactNode;
|
|
5975
|
+
className?: string;
|
|
5976
|
+
'aria-label'?: string;
|
|
5977
|
+
'aria-labelledby'?: string;
|
|
5978
|
+
}
|
|
5979
|
+
|
|
5980
|
+
export declare type TimelineTone = 'neutral' | 'info' | 'success' | 'warning' | 'error';
|
|
5981
|
+
|
|
5938
5982
|
export declare interface ToastApi {
|
|
5939
5983
|
show: (options: ToastOptions) => void;
|
|
5940
5984
|
}
|