@stealthscale/component-collections 0.1.2 → 0.1.3
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/cyclonedx/bom.json +1 -1
- package/dist/index.js +1 -5700
- package/dist/pages/data-list/data-list.js +351 -0
- package/dist/pages/data-list/data-list.props.js +3 -0
- package/dist/pages/listbox/listbox.js +1277 -0
- package/dist/pages/listbox/listbox.props.js +3 -0
- package/dist/pages/pages.json +105 -0
- package/dist/pages/sortable/sortable.js +576 -0
- package/dist/pages/sortable/sortable.props.js +3 -0
- package/dist/pages/status-matrix/status-matrix.js +1403 -0
- package/dist/pages/status-matrix/status-matrix.props.js +3 -0
- package/dist/pages/swipe-actions/swipe-actions.js +212 -0
- package/dist/pages/swipe-actions/swipe-actions.props.js +3 -0
- package/dist/pages/table/table.js +1701 -0
- package/dist/pages/table/table.props.js +3 -0
- package/dist/pages/timeline/timeline.js +380 -0
- package/dist/pages/timeline/timeline.props.js +3 -0
- package/dist/pages/transfer/transfer.js +465 -0
- package/dist/pages/transfer/transfer.props.js +3 -0
- package/dist/pages/tree-view/tree-view.js +1059 -0
- package/dist/pages/tree-view/tree-view.props.js +3 -0
- package/dist/shared-DVn824MJ.js +5701 -0
- package/dist/theme.js +1 -1
- package/locales/en/specimen/data-list.json +64 -0
- package/locales/en/specimen/listbox.json +98 -0
- package/locales/en/specimen/sortable.json +65 -0
- package/locales/en/specimen/status-matrix.json +47 -0
- package/locales/en/specimen/swipe-actions.json +32 -0
- package/locales/en/specimen/table.json +94 -0
- package/locales/en/specimen/timeline.json +72 -0
- package/locales/en/specimen/transfer.json +34 -0
- package/locales/en/specimen/tree-view.json +107 -0
- package/package.json +9 -8
- /package/dist/{recipe-C1oaF8pO.js → recipes-C1oaF8pO.js} +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export const dropped = {"BodyProps": {"conditions": 284, "foreign": 1041}, "CaptionProps": {"conditions": 284, "foreign": 1041}, "CellProps": {"conditions": 284, "foreign": 1048}, "ColumnGroupProps": {"conditions": 284, "foreign": 1042}, "ColumnHeaderProps": {"conditions": 284, "foreign": 1047}, "ColumnProps": {"conditions": 284, "foreign": 1042}, "FooterProps": {"conditions": 284, "foreign": 1041}, "HeaderProps": {"conditions": 284, "foreign": 1041}, "RootProps": {"conditions": 284, "foreign": 1048}, "RowHeaderProps": {"conditions": 284, "foreign": 1047}, "RowProps": {"conditions": 284, "foreign": 1041}, "ScrollerProps": {"conditions": 284, "foreign": 1041}, "SorterProps": {"conditions": 284, "foreign": 1051}, "SimpleProps": {"conditions": 284, "foreign": 1040}};
|
|
2
|
+
export const parts = {"BodyProps": [], "CaptionProps": [], "CellProps": [], "ColumnGroupProps": [], "ColumnHeaderProps": [], "ColumnProps": [], "FooterProps": [], "HeaderProps": [], "RootProps": [], "RowHeaderProps": [], "RowProps": [], "ScrollerProps": [{"accepts": "\"center\" | \"end\" | \"start\"", "fallback": "", "kind": "variant", "name": "align", "refers": [], "required": false, "says": "Vertical alignment of a cell's content in a row taller than one line."}, {"accepts": "boolean", "fallback": "", "kind": "variant", "name": "banded", "refers": [], "required": false, "says": "Whether the column names render on `bg.subtle`, in capitals, tracked out."}, {"accepts": "boolean", "fallback": "", "kind": "option", "name": "focusable", "refers": [], "required": false, "says": "Whether the viewport is a region with a tab stop while the table overflows. `false` keeps it out of the tab order, for a table whose cells take focus. `true` unless stated."}, {"accepts": "boolean", "fallback": "", "kind": "variant", "name": "interactive", "refers": [], "required": false, "says": "Whether a body row fills under the pointer and while a control inside it has focus."}, {"accepts": "\"auto\" | \"fixed\"", "fallback": "", "kind": "variant", "name": "layout", "refers": [], "required": false, "says": "Column widths from the content, or from the column declarations and the first row."}, {"accepts": "\"accent\" | \"error\" | \"info\" | \"neutral\" | \"primary\" | \"secondary\" | \"success\" | \"warning\"", "fallback": "", "kind": "variant", "name": "palette", "refers": [], "required": false, "says": "Palette the selected row and the interactive row fill read."}, {"accepts": "\"l1\" | \"l2\" | \"l3\"", "fallback": "", "kind": "variant", "name": "radius", "refers": [], "required": false, "says": "Corner radius of the scroller, from the layer radii without the pill, which clips the first and last rows."}, {"accepts": "\"all\" | \"none\" | \"rows\"", "fallback": "", "kind": "variant", "name": "rules", "refers": [], "required": false, "says": "Where the body rules run: `rows` between rows, `all` between rows and between columns, and `none` nowhere. The rule under the header and the rule over the footer render in every value."}, {"accepts": "\"lg\" | \"md\" | \"sm\"", "fallback": "", "kind": "variant", "name": "size", "refers": [], "required": false, "says": "Text size and cell padding: cells read the body role at the size, and the column names and the caption read the label role one size smaller."}, {"accepts": "boolean", "fallback": "", "kind": "variant", "name": "stickyColumn", "refers": [], "required": false, "says": "Whether the row headers and the first column header stick to the start of the scroll area's viewport."}, {"accepts": "boolean", "fallback": "", "kind": "variant", "name": "stickyHeader", "refers": [], "required": false, "says": "Whether the header rows stick to the top of the scroll area's viewport."}, {"accepts": "boolean", "fallback": "", "kind": "variant", "name": "striped", "refers": [], "required": false, "says": "Whether every odd body row renders on `bg.muted`."}, {"accepts": "\"plain\" | \"surface\"", "fallback": "", "kind": "variant", "name": "variant", "refers": [], "required": false, "says": "Surface of the scroller: the panel inside a hairline edge, or transparent."}, {"accepts": "Ref<HTMLDivElement>", "fallback": "", "kind": "option", "name": "viewportRef", "refers": ["react.RefObject", "react.bivarianceHack"], "required": false, "says": "Ref of the scroll area's viewport, the element that scrolls."}], "SorterProps": [], "SimpleProps": [{"accepts": "\"center\" | \"end\" | \"start\"", "fallback": "", "kind": "variant", "name": "align", "refers": [], "required": false, "says": "Vertical alignment of a cell's content in a row taller than one line."}, {"accepts": "boolean", "fallback": "", "kind": "variant", "name": "banded", "refers": [], "required": false, "says": "Whether the column names render on `bg.subtle`, in capitals, tracked out."}, {"accepts": "ReactNode", "fallback": "", "kind": "option", "name": "caption", "refers": ["react.ReactElement", "react.ReactPortal"], "required": false, "says": "Caption rendered under the table, and the accessible name of the table and the scroller."}, {"accepts": "readonly Column<Row>[]", "fallback": "", "kind": "option", "name": "columns", "refers": ["kit.Branch", "kit.Column", "kit.Leaf", "kit.Row", "react.ReactElement", "react.ReactPortal"], "required": true, "says": "Columns in render order. A branch spans the columns under it."}, {"accepts": "ReactNode", "fallback": "", "kind": "option", "name": "empty", "refers": ["react.ReactElement", "react.ReactPortal"], "required": false, "says": "Content of a full-width row rendered while `rows` is empty."}, {"accepts": "boolean", "fallback": "", "kind": "option", "name": "focusable", "refers": [], "required": false, "says": "Whether the viewport is a region with a tab stop while the table overflows. `false` keeps it out of the tab order, for a table whose cells take focus. `true` unless stated."}, {"accepts": "((row: Row) => string)", "fallback": "", "kind": "option", "name": "groupBy", "refers": ["kit.Row"], "required": false, "says": "Returns the key of the section a record belongs to."}, {"accepts": "((under: string) => ReactNode)", "fallback": "", "kind": "option", "name": "groupLabel", "refers": [], "required": false, "says": "Returns a section's heading from its key. Defaults to the key."}, {"accepts": "boolean", "fallback": "", "kind": "variant", "name": "interactive", "refers": [], "required": false, "says": "Whether a body row fills under the pointer and while a control inside it has focus."}, {"accepts": "\"auto\" | \"fixed\"", "fallback": "", "kind": "variant", "name": "layout", "refers": [], "required": false, "says": "Column widths from the content, or from the column declarations and the first row."}, {"accepts": "((key: string) => void)", "fallback": "", "kind": "option", "name": "onSort", "refers": [], "required": false, "says": "Called with the column key on a press of a sort button."}, {"accepts": "\"accent\" | \"error\" | \"info\" | \"neutral\" | \"primary\" | \"secondary\" | \"success\" | \"warning\"", "fallback": "", "kind": "variant", "name": "palette", "refers": [], "required": false, "says": "Palette the selected row and the interactive row fill read."}, {"accepts": "\"l1\" | \"l2\" | \"l3\"", "fallback": "", "kind": "variant", "name": "radius", "refers": [], "required": false, "says": "Corner radius of the scroller, from the layer radii without the pill, which clips the first and last rows."}, {"accepts": "readonly Row[]", "fallback": "", "kind": "option", "name": "rows", "refers": ["kit.Row"], "required": true, "says": "Records in render order."}, {"accepts": "(row: Row) => string", "fallback": "", "kind": "option", "name": "rowToKey", "refers": ["kit.Row"], "required": true, "says": "Returns the React key of a record."}, {"accepts": "\"all\" | \"none\" | \"rows\"", "fallback": "", "kind": "variant", "name": "rules", "refers": [], "required": false, "says": "Where the body rules run: `rows` between rows, `all` between rows and between columns, and `none` nowhere. The rule under the header and the rule over the footer render in every value."}, {"accepts": "\"lg\" | \"md\" | \"sm\"", "fallback": "", "kind": "variant", "name": "size", "refers": [], "required": false, "says": "Text size and cell padding: cells read the body role at the size, and the column names and the caption read the label role one size smaller."}, {"accepts": "boolean", "fallback": "", "kind": "variant", "name": "stickyColumn", "refers": [], "required": false, "says": "Whether the row headers and the first column header stick to the start of the scroll area's viewport."}, {"accepts": "boolean", "fallback": "", "kind": "variant", "name": "stickyHeader", "refers": [], "required": false, "says": "Whether the header rows stick to the top of the scroll area's viewport."}, {"accepts": "boolean", "fallback": "", "kind": "variant", "name": "striped", "refers": [], "required": false, "says": "Whether every odd body row renders on `bg.muted`."}, {"accepts": "((column: Leaf<Row>) => ReactNode)", "fallback": "", "kind": "option", "name": "total", "refers": ["kit.Leaf", "kit.Row"], "required": false, "says": "Returns the total row's content for a leaf column. Branches are never passed."}, {"accepts": "\"plain\" | \"surface\"", "fallback": "", "kind": "variant", "name": "variant", "refers": [], "required": false, "says": "Surface of the scroller: the panel inside a hairline edge, or transparent."}, {"accepts": "Ref<HTMLDivElement>", "fallback": "", "kind": "option", "name": "viewportRef", "refers": ["react.RefObject", "react.bivarianceHack"], "required": false, "says": "Ref of the scroll area's viewport, the element that scrolls."}]};
|
|
3
|
+
export const shapes = {"react.RefObject": [{"accepts": "HTMLDivElement | null", "name": "current", "says": "The current value of the ref."}], "react.ReactElement": [{"accepts": "string | JSXElementConstructor<any>", "name": "type", "says": ""}, {"accepts": "unknown", "name": "props", "says": ""}, {"accepts": "string | null", "name": "key", "says": ""}], "react.ReactPortal": [{"accepts": "ReactNode", "name": "children", "says": ""}, {"accepts": "string | JSXElementConstructor<any>", "name": "type", "says": ""}, {"accepts": "unknown", "name": "props", "says": ""}, {"accepts": "string | null", "name": "key", "says": ""}], "kit.Column": [{"accepts": "", "name": "Branch<Row>", "says": ""}, {"accepts": "", "name": "Leaf<Row>", "says": ""}], "kit.Branch": [{"accepts": "readonly Column<Row>[]", "name": "columns", "says": "Columns the header spans."}, {"accepts": "ReactNode", "name": "label", "says": "Text of the spanning header."}], "kit.Leaf": [{"accepts": "((row: Row) => ReactNode)", "name": "cell", "says": "Returns the column's value for a record. Defaults to the record's property named `key`."}, {"accepts": "string", "name": "key", "says": "Key of the column, and the property its value is read from without `cell`."}, {"accepts": "ReactNode", "name": "label", "says": "Header of the column."}, {"accepts": "boolean", "name": "numeric", "says": "Whether the column contains figures, aligned to the end in tabular figures."}, {"accepts": "boolean", "name": "rowHeader", "says": "Whether the column's cells render as row headers."}, {"accepts": "\"ascending\" | \"descending\"", "name": "sorted", "says": "Sort direction, on the column the table is sorted by."}, {"accepts": "string", "name": "sortLabel", "says": "Accessible name of the column's sort button. A column without it does not sort."}, {"accepts": "string", "name": "width", "says": "Width of the column, as a CSS length or percentage."}]};
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { C as Connector, S as Content, _ as Title, b as Indicator, v as Root, x as Description, y as Item } from "../../shared-DVn824MJ.js";
|
|
3
|
+
import { i as recipe } from "../../recipes-C1oaF8pO.js";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Room, scenesOf, specimen, useWords } from "@stealthscale/specimen";
|
|
7
|
+
import { CheckIcon, HouseIcon, PackageIcon, PencilIcon, ShoppingCartIcon, TruckIcon, XIcon } from "lucide-react";
|
|
8
|
+
import { Span } from "@stealthscale/component-typography";
|
|
9
|
+
import { Avatar } from "@stealthscale/component-media";
|
|
10
|
+
//#region src/timeline/examples/activity.example.tsx
|
|
11
|
+
var activity_example_exports = /* @__PURE__ */ __exportAll({
|
|
12
|
+
Activity: () => Activity,
|
|
13
|
+
source: () => source$4
|
|
14
|
+
});
|
|
15
|
+
const CHANGES = [
|
|
16
|
+
[
|
|
17
|
+
"lucas",
|
|
18
|
+
"renamed",
|
|
19
|
+
PencilIcon
|
|
20
|
+
],
|
|
21
|
+
[
|
|
22
|
+
"jenna",
|
|
23
|
+
"removed",
|
|
24
|
+
XIcon
|
|
25
|
+
],
|
|
26
|
+
[
|
|
27
|
+
"ada",
|
|
28
|
+
"approved",
|
|
29
|
+
CheckIcon
|
|
30
|
+
]
|
|
31
|
+
];
|
|
32
|
+
function Activity() {
|
|
33
|
+
const $ = c(4);
|
|
34
|
+
const { t } = useWords("timeline");
|
|
35
|
+
let t0;
|
|
36
|
+
if ($[0] !== t) {
|
|
37
|
+
t0 = CHANGES.map((t1) => {
|
|
38
|
+
const [who, did, Glyph] = t1;
|
|
39
|
+
return /* @__PURE__ */ jsxs(Item, { children: [/* @__PURE__ */ jsx(Connector, { children: /* @__PURE__ */ jsx(Indicator, { children: /* @__PURE__ */ jsx(Glyph, {}) }) }), /* @__PURE__ */ jsxs(Content, { children: [/* @__PURE__ */ jsxs(Title, { children: [
|
|
40
|
+
/* @__PURE__ */ jsx(Avatar.Root, {
|
|
41
|
+
"aria-hidden": true,
|
|
42
|
+
name: t(who),
|
|
43
|
+
size: "2xs",
|
|
44
|
+
children: /* @__PURE__ */ jsx(Avatar.Fallback, {})
|
|
45
|
+
}),
|
|
46
|
+
/* @__PURE__ */ jsx(Span, {
|
|
47
|
+
weight: "semibold",
|
|
48
|
+
children: t(who)
|
|
49
|
+
}),
|
|
50
|
+
/* @__PURE__ */ jsx(Span, {
|
|
51
|
+
tone: "muted",
|
|
52
|
+
children: t(did)
|
|
53
|
+
}),
|
|
54
|
+
t(`${did}What`)
|
|
55
|
+
] }), /* @__PURE__ */ jsx(Description, { children: t(`${did}On`) })] })] }, who);
|
|
56
|
+
});
|
|
57
|
+
$[0] = t;
|
|
58
|
+
$[1] = t0;
|
|
59
|
+
} else t0 = $[1];
|
|
60
|
+
let t1;
|
|
61
|
+
if ($[2] !== t0) {
|
|
62
|
+
t1 = /* @__PURE__ */ jsx(Root, {
|
|
63
|
+
size: "lg",
|
|
64
|
+
variant: "subtle",
|
|
65
|
+
children: t0
|
|
66
|
+
});
|
|
67
|
+
$[2] = t0;
|
|
68
|
+
$[3] = t1;
|
|
69
|
+
} else t1 = $[3];
|
|
70
|
+
return t1;
|
|
71
|
+
}
|
|
72
|
+
const source$4 = "import { type ReactElement } from \"react\";\n\nimport { CheckIcon, PencilIcon, XIcon } from \"lucide-react\";\n\nimport { Avatar } from \"@stealthscale/component-media\";\nimport { Span } from \"@stealthscale/component-typography\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Timeline } from \"@stealthscale/component-collections\";\n\nconst CHANGES = [\n [\"lucas\", \"renamed\", PencilIcon],\n [\"jenna\", \"removed\", XIcon],\n [\"ada\", \"approved\", CheckIcon],\n] as const;\n\nexport function Activity(): ReactElement {\n const { t } = useWords(\"timeline\");\n\n return (\n <Timeline.Root size=\"lg\" variant=\"subtle\">\n {CHANGES.map(([who, did, Glyph]) => (\n <Timeline.Item key={who}>\n <Timeline.Connector>\n <Timeline.Indicator>\n <Glyph />\n </Timeline.Indicator>\n </Timeline.Connector>\n <Timeline.Content>\n <Timeline.Title>\n <Avatar.Root aria-hidden name={t(who)} size=\"2xs\">\n <Avatar.Fallback />\n </Avatar.Root>\n <Span weight=\"semibold\">{t(who)}</Span>\n <Span tone=\"muted\">{t(did)}</Span>\n {t(`${did}What`)}\n </Timeline.Title>\n <Timeline.Description>{t(`${did}On`)}</Timeline.Description>\n </Timeline.Content>\n </Timeline.Item>\n ))}\n </Timeline.Root>\n );\n}\n";
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/timeline/examples/alternating.example.tsx
|
|
75
|
+
var alternating_example_exports = /* @__PURE__ */ __exportAll({
|
|
76
|
+
Alternating: () => Alternating,
|
|
77
|
+
source: () => source$3
|
|
78
|
+
});
|
|
79
|
+
const LEGS$1 = [
|
|
80
|
+
[
|
|
81
|
+
"placed",
|
|
82
|
+
"end",
|
|
83
|
+
ShoppingCartIcon
|
|
84
|
+
],
|
|
85
|
+
[
|
|
86
|
+
"packed",
|
|
87
|
+
"start",
|
|
88
|
+
PackageIcon
|
|
89
|
+
],
|
|
90
|
+
[
|
|
91
|
+
"shipped",
|
|
92
|
+
"end",
|
|
93
|
+
TruckIcon
|
|
94
|
+
],
|
|
95
|
+
[
|
|
96
|
+
"arrived",
|
|
97
|
+
"start",
|
|
98
|
+
HouseIcon
|
|
99
|
+
]
|
|
100
|
+
];
|
|
101
|
+
function Alternating() {
|
|
102
|
+
const $ = c(4);
|
|
103
|
+
const { t } = useWords("timeline");
|
|
104
|
+
let t0;
|
|
105
|
+
if ($[0] !== t) {
|
|
106
|
+
t0 = LEGS$1.map((t1) => {
|
|
107
|
+
const [leg, side, Glyph] = t1;
|
|
108
|
+
const words = /* @__PURE__ */ jsxs(Content, { children: [/* @__PURE__ */ jsx(Title, { children: t(leg) }), /* @__PURE__ */ jsx(Description, { children: t(`${leg}At`) })] });
|
|
109
|
+
return /* @__PURE__ */ jsxs(Item, { children: [
|
|
110
|
+
side === "start" ? words : null,
|
|
111
|
+
/* @__PURE__ */ jsx(Connector, { children: /* @__PURE__ */ jsx(Indicator, { children: /* @__PURE__ */ jsx(Glyph, {}) }) }),
|
|
112
|
+
side === "end" ? words : null
|
|
113
|
+
] }, leg);
|
|
114
|
+
});
|
|
115
|
+
$[0] = t;
|
|
116
|
+
$[1] = t0;
|
|
117
|
+
} else t0 = $[1];
|
|
118
|
+
let t1;
|
|
119
|
+
if ($[2] !== t0) {
|
|
120
|
+
t1 = /* @__PURE__ */ jsx(Root, {
|
|
121
|
+
rail: "center",
|
|
122
|
+
variant: "outline",
|
|
123
|
+
children: t0
|
|
124
|
+
});
|
|
125
|
+
$[2] = t0;
|
|
126
|
+
$[3] = t1;
|
|
127
|
+
} else t1 = $[3];
|
|
128
|
+
return t1;
|
|
129
|
+
}
|
|
130
|
+
const source$3 = "import { type ReactElement } from \"react\";\n\nimport { HouseIcon, PackageIcon, ShoppingCartIcon, TruckIcon } from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Timeline } from \"@stealthscale/component-collections\";\n\nconst LEGS = [\n [\"placed\", \"end\", ShoppingCartIcon],\n [\"packed\", \"start\", PackageIcon],\n [\"shipped\", \"end\", TruckIcon],\n [\"arrived\", \"start\", HouseIcon],\n] as const;\n\nexport function Alternating(): ReactElement {\n const { t } = useWords(\"timeline\");\n\n return (\n <Timeline.Root rail=\"center\" variant=\"outline\">\n {LEGS.map(([leg, side, Glyph]) => {\n const words = (\n <Timeline.Content>\n <Timeline.Title>{t(leg)}</Timeline.Title>\n <Timeline.Description>{t(`${leg}At`)}</Timeline.Description>\n </Timeline.Content>\n );\n\n return (\n <Timeline.Item key={leg}>\n {side === \"start\" ? words : null}\n <Timeline.Connector>\n <Timeline.Indicator>\n <Glyph />\n </Timeline.Indicator>\n </Timeline.Connector>\n {side === \"end\" ? words : null}\n </Timeline.Item>\n );\n })}\n </Timeline.Root>\n );\n}\n";
|
|
131
|
+
//#endregion
|
|
132
|
+
//#region src/timeline/examples/dated.example.tsx
|
|
133
|
+
var dated_example_exports = /* @__PURE__ */ __exportAll({
|
|
134
|
+
Dated: () => Dated,
|
|
135
|
+
source: () => source$2
|
|
136
|
+
});
|
|
137
|
+
const LEGS = [
|
|
138
|
+
"booked",
|
|
139
|
+
"cleared",
|
|
140
|
+
"delivered"
|
|
141
|
+
];
|
|
142
|
+
function Dated(props) {
|
|
143
|
+
const $ = c(5);
|
|
144
|
+
const { t } = useWords("timeline");
|
|
145
|
+
let t0;
|
|
146
|
+
if ($[0] !== t) {
|
|
147
|
+
t0 = LEGS.map((leg, index) => /* @__PURE__ */ jsxs(Item, { children: [
|
|
148
|
+
/* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(Title, { children: t(`${leg}On`) }) }),
|
|
149
|
+
/* @__PURE__ */ jsx(Connector, { children: /* @__PURE__ */ jsx(Indicator, { children: index + 1 }) }),
|
|
150
|
+
/* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(Title, { children: t(leg) }) })
|
|
151
|
+
] }, leg));
|
|
152
|
+
$[0] = t;
|
|
153
|
+
$[1] = t0;
|
|
154
|
+
} else t0 = $[1];
|
|
155
|
+
let t1;
|
|
156
|
+
if ($[2] !== props || $[3] !== t0) {
|
|
157
|
+
t1 = /* @__PURE__ */ jsx(Root, {
|
|
158
|
+
variant: "subtle",
|
|
159
|
+
...props,
|
|
160
|
+
children: t0
|
|
161
|
+
});
|
|
162
|
+
$[2] = props;
|
|
163
|
+
$[3] = t0;
|
|
164
|
+
$[4] = t1;
|
|
165
|
+
} else t1 = $[4];
|
|
166
|
+
return t1;
|
|
167
|
+
}
|
|
168
|
+
const source$2 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Timeline } from \"@stealthscale/component-collections\";\n\nconst LEGS = [\"booked\", \"cleared\", \"delivered\"] as const;\n\nexport function Dated(props: Timeline.RootProps): ReactElement {\n const { t } = useWords(\"timeline\");\n\n return (\n <Timeline.Root variant=\"subtle\" {...props}>\n {LEGS.map((leg, index) => (\n <Timeline.Item key={leg}>\n <Timeline.Content>\n <Timeline.Title>{t(`${leg}On`)}</Timeline.Title>\n </Timeline.Content>\n <Timeline.Connector>\n <Timeline.Indicator>{index + 1}</Timeline.Indicator>\n </Timeline.Connector>\n <Timeline.Content>\n <Timeline.Title>{t(leg)}</Timeline.Title>\n </Timeline.Content>\n </Timeline.Item>\n ))}\n </Timeline.Root>\n );\n}\n";
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/timeline/examples/run.example.tsx
|
|
171
|
+
var run_example_exports = /* @__PURE__ */ __exportAll({
|
|
172
|
+
Run: () => Run,
|
|
173
|
+
source: () => source$1
|
|
174
|
+
});
|
|
175
|
+
const EVENTS = [
|
|
176
|
+
"raised",
|
|
177
|
+
"accepted",
|
|
178
|
+
"settled"
|
|
179
|
+
];
|
|
180
|
+
function Run(props) {
|
|
181
|
+
const $ = c(5);
|
|
182
|
+
const { t } = useWords("timeline");
|
|
183
|
+
let t0;
|
|
184
|
+
if ($[0] !== t) {
|
|
185
|
+
t0 = EVENTS.map((event, index) => /* @__PURE__ */ jsxs(Item, { children: [/* @__PURE__ */ jsx(Connector, { children: /* @__PURE__ */ jsx(Indicator, { children: index + 1 }) }), /* @__PURE__ */ jsxs(Content, { children: [/* @__PURE__ */ jsx(Title, { children: t(event) }), /* @__PURE__ */ jsx(Description, { children: t(`${event}On`) })] })] }, event));
|
|
186
|
+
$[0] = t;
|
|
187
|
+
$[1] = t0;
|
|
188
|
+
} else t0 = $[1];
|
|
189
|
+
let t1;
|
|
190
|
+
if ($[2] !== props || $[3] !== t0) {
|
|
191
|
+
t1 = /* @__PURE__ */ jsx(Root, {
|
|
192
|
+
...props,
|
|
193
|
+
children: t0
|
|
194
|
+
});
|
|
195
|
+
$[2] = props;
|
|
196
|
+
$[3] = t0;
|
|
197
|
+
$[4] = t1;
|
|
198
|
+
} else t1 = $[4];
|
|
199
|
+
return t1;
|
|
200
|
+
}
|
|
201
|
+
const source$1 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Timeline } from \"@stealthscale/component-collections\";\n\nconst EVENTS = [\"raised\", \"accepted\", \"settled\"] as const;\n\nexport function Run(props: Timeline.RootProps): ReactElement {\n const { t } = useWords(\"timeline\");\n\n return (\n <Timeline.Root {...props}>\n {EVENTS.map((event, index) => (\n <Timeline.Item key={event}>\n <Timeline.Connector>\n <Timeline.Indicator>{index + 1}</Timeline.Indicator>\n </Timeline.Connector>\n <Timeline.Content>\n <Timeline.Title>{t(event)}</Timeline.Title>\n <Timeline.Description>{t(`${event}On`)}</Timeline.Description>\n </Timeline.Content>\n </Timeline.Item>\n ))}\n </Timeline.Root>\n );\n}\n";
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region src/timeline/examples/shipment.example.tsx
|
|
204
|
+
var shipment_example_exports = /* @__PURE__ */ __exportAll({
|
|
205
|
+
Shipment: () => Shipment,
|
|
206
|
+
source: () => source
|
|
207
|
+
});
|
|
208
|
+
function Shipment() {
|
|
209
|
+
const $ = c(27);
|
|
210
|
+
const { t } = useWords("timeline");
|
|
211
|
+
let t0;
|
|
212
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
213
|
+
t0 = /* @__PURE__ */ jsx(Connector, { children: /* @__PURE__ */ jsx(Indicator, { children: /* @__PURE__ */ jsx(CheckIcon, {}) }) });
|
|
214
|
+
$[0] = t0;
|
|
215
|
+
} else t0 = $[0];
|
|
216
|
+
let t1;
|
|
217
|
+
if ($[1] !== t) {
|
|
218
|
+
t1 = t("left");
|
|
219
|
+
$[1] = t;
|
|
220
|
+
$[2] = t1;
|
|
221
|
+
} else t1 = $[2];
|
|
222
|
+
let t2;
|
|
223
|
+
if ($[3] !== t1) {
|
|
224
|
+
t2 = /* @__PURE__ */ jsx(Title, { children: t1 });
|
|
225
|
+
$[3] = t1;
|
|
226
|
+
$[4] = t2;
|
|
227
|
+
} else t2 = $[4];
|
|
228
|
+
let t3;
|
|
229
|
+
if ($[5] !== t) {
|
|
230
|
+
t3 = t("leftOn");
|
|
231
|
+
$[5] = t;
|
|
232
|
+
$[6] = t3;
|
|
233
|
+
} else t3 = $[6];
|
|
234
|
+
let t4;
|
|
235
|
+
if ($[7] !== t3) {
|
|
236
|
+
t4 = /* @__PURE__ */ jsx(Description, { children: t3 });
|
|
237
|
+
$[7] = t3;
|
|
238
|
+
$[8] = t4;
|
|
239
|
+
} else t4 = $[8];
|
|
240
|
+
let t5;
|
|
241
|
+
if ($[9] !== t2 || $[10] !== t4) {
|
|
242
|
+
t5 = /* @__PURE__ */ jsxs(Item, { children: [t0, /* @__PURE__ */ jsxs(Content, { children: [t2, t4] })] });
|
|
243
|
+
$[9] = t2;
|
|
244
|
+
$[10] = t4;
|
|
245
|
+
$[11] = t5;
|
|
246
|
+
} else t5 = $[11];
|
|
247
|
+
let t6;
|
|
248
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
249
|
+
t6 = /* @__PURE__ */ jsx(Connector, { children: /* @__PURE__ */ jsx(Indicator, { children: /* @__PURE__ */ jsx(TruckIcon, {}) }) });
|
|
250
|
+
$[12] = t6;
|
|
251
|
+
} else t6 = $[12];
|
|
252
|
+
let t7;
|
|
253
|
+
if ($[13] !== t) {
|
|
254
|
+
t7 = t("transit");
|
|
255
|
+
$[13] = t;
|
|
256
|
+
$[14] = t7;
|
|
257
|
+
} else t7 = $[14];
|
|
258
|
+
let t8;
|
|
259
|
+
if ($[15] !== t7) {
|
|
260
|
+
t8 = /* @__PURE__ */ jsx(Title, { children: t7 });
|
|
261
|
+
$[15] = t7;
|
|
262
|
+
$[16] = t8;
|
|
263
|
+
} else t8 = $[16];
|
|
264
|
+
let t9;
|
|
265
|
+
if ($[17] !== t) {
|
|
266
|
+
t9 = t("expected");
|
|
267
|
+
$[17] = t;
|
|
268
|
+
$[18] = t9;
|
|
269
|
+
} else t9 = $[18];
|
|
270
|
+
let t10;
|
|
271
|
+
if ($[19] !== t9) {
|
|
272
|
+
t10 = /* @__PURE__ */ jsx(Description, { children: t9 });
|
|
273
|
+
$[19] = t9;
|
|
274
|
+
$[20] = t10;
|
|
275
|
+
} else t10 = $[20];
|
|
276
|
+
let t11;
|
|
277
|
+
if ($[21] !== t10 || $[22] !== t8) {
|
|
278
|
+
t11 = /* @__PURE__ */ jsxs(Item, { children: [t6, /* @__PURE__ */ jsxs(Content, { children: [t8, t10] })] });
|
|
279
|
+
$[21] = t10;
|
|
280
|
+
$[22] = t8;
|
|
281
|
+
$[23] = t11;
|
|
282
|
+
} else t11 = $[23];
|
|
283
|
+
let t12;
|
|
284
|
+
if ($[24] !== t11 || $[25] !== t5) {
|
|
285
|
+
t12 = /* @__PURE__ */ jsxs(Root, {
|
|
286
|
+
ongoing: true,
|
|
287
|
+
palette: "success",
|
|
288
|
+
children: [t5, t11]
|
|
289
|
+
});
|
|
290
|
+
$[24] = t11;
|
|
291
|
+
$[25] = t5;
|
|
292
|
+
$[26] = t12;
|
|
293
|
+
} else t12 = $[26];
|
|
294
|
+
return t12;
|
|
295
|
+
}
|
|
296
|
+
const source = "import { type ReactElement } from \"react\";\n\nimport { CheckIcon, TruckIcon } from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Timeline } from \"@stealthscale/component-collections\";\n\nexport function Shipment(): ReactElement {\n const { t } = useWords(\"timeline\");\n\n return (\n <Timeline.Root ongoing palette=\"success\">\n <Timeline.Item>\n <Timeline.Connector>\n <Timeline.Indicator>\n <CheckIcon />\n </Timeline.Indicator>\n </Timeline.Connector>\n <Timeline.Content>\n <Timeline.Title>{t(\"left\")}</Timeline.Title>\n <Timeline.Description>{t(\"leftOn\")}</Timeline.Description>\n </Timeline.Content>\n </Timeline.Item>\n <Timeline.Item>\n <Timeline.Connector>\n <Timeline.Indicator>\n <TruckIcon />\n </Timeline.Indicator>\n </Timeline.Connector>\n <Timeline.Content>\n <Timeline.Title>{t(\"transit\")}</Timeline.Title>\n <Timeline.Description>{t(\"expected\")}</Timeline.Description>\n </Timeline.Content>\n </Timeline.Item>\n </Timeline.Root>\n );\n}\n";
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/timeline/timeline.specimen.tsx
|
|
299
|
+
/**
|
|
300
|
+
* Catalogue page for the timeline.
|
|
301
|
+
*
|
|
302
|
+
* @remarks
|
|
303
|
+
* `scenesOf` generates the size, look, palette and ongoing scenes from a run of three numbered
|
|
304
|
+
* events, each in a room at the `xs` measure, because a timeline is as wide as its container. The
|
|
305
|
+
* rail scene renders dates before the rail in a room at the `sm` measure. Hand-written scenes
|
|
306
|
+
* render entries on alternating sides of a centred rail, an activity feed of faces and names, and
|
|
307
|
+
* a shipment still on its way. The words are keys under `timeline` in
|
|
308
|
+
* `locales/en/specimen/timeline.json`.
|
|
309
|
+
*/
|
|
310
|
+
/**
|
|
311
|
+
* Hand-written scene for entries on alternating sides of a centred rail.
|
|
312
|
+
*/
|
|
313
|
+
const sides = {
|
|
314
|
+
about: "timeline.sides.about",
|
|
315
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
316
|
+
size: "sm",
|
|
317
|
+
children: /* @__PURE__ */ jsx(Alternating, {})
|
|
318
|
+
}),
|
|
319
|
+
example: alternating_example_exports,
|
|
320
|
+
title: "timeline.sides.title"
|
|
321
|
+
};
|
|
322
|
+
/**
|
|
323
|
+
* Hand-written scene for an activity feed of faces, names and changes.
|
|
324
|
+
*/
|
|
325
|
+
const feed = {
|
|
326
|
+
about: "timeline.feed.about",
|
|
327
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
328
|
+
size: "sm",
|
|
329
|
+
children: /* @__PURE__ */ jsx(Activity, {})
|
|
330
|
+
}),
|
|
331
|
+
example: activity_example_exports,
|
|
332
|
+
title: "timeline.feed.title"
|
|
333
|
+
};
|
|
334
|
+
/**
|
|
335
|
+
* Hand-written scene for a shipment still on its way, on the success palette.
|
|
336
|
+
*/
|
|
337
|
+
const tracked = {
|
|
338
|
+
about: "timeline.tracked.about",
|
|
339
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
340
|
+
size: "xs",
|
|
341
|
+
children: /* @__PURE__ */ jsx(Shipment, {})
|
|
342
|
+
}),
|
|
343
|
+
example: shipment_example_exports,
|
|
344
|
+
title: "timeline.tracked.title"
|
|
345
|
+
};
|
|
346
|
+
var timeline_specimen_default = specimen({
|
|
347
|
+
about: "timeline.about",
|
|
348
|
+
id: "components/collections/timeline",
|
|
349
|
+
imports: "import { Timeline } from \"@stealthscale/component-collections\";",
|
|
350
|
+
scenes: [
|
|
351
|
+
...scenesOf(recipe, {
|
|
352
|
+
axes: { rail: {
|
|
353
|
+
draw: (props) => /* @__PURE__ */ jsx(Room, {
|
|
354
|
+
size: "sm",
|
|
355
|
+
children: /* @__PURE__ */ jsx(Dated, { ...props })
|
|
356
|
+
}),
|
|
357
|
+
example: dated_example_exports
|
|
358
|
+
} },
|
|
359
|
+
draw: (props) => /* @__PURE__ */ jsx(Room, {
|
|
360
|
+
size: "xs",
|
|
361
|
+
children: /* @__PURE__ */ jsx(Run, { ...props })
|
|
362
|
+
}),
|
|
363
|
+
example: run_example_exports,
|
|
364
|
+
namespace: "timeline",
|
|
365
|
+
order: [
|
|
366
|
+
"size",
|
|
367
|
+
"variant",
|
|
368
|
+
"palette",
|
|
369
|
+
"rail",
|
|
370
|
+
"ongoing"
|
|
371
|
+
]
|
|
372
|
+
}),
|
|
373
|
+
sides,
|
|
374
|
+
feed,
|
|
375
|
+
tracked
|
|
376
|
+
],
|
|
377
|
+
title: "timeline.title"
|
|
378
|
+
});
|
|
379
|
+
//#endregion
|
|
380
|
+
export { timeline_specimen_default as default, feed, sides, tracked };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export const dropped = {"ConnectorProps": {"conditions": 284, "foreign": 1041}, "ContentProps": {"conditions": 284, "foreign": 1041}, "DescriptionProps": {"conditions": 284, "foreign": 1041}, "IndicatorProps": {"conditions": 284, "foreign": 1041}, "ItemProps": {"conditions": 284, "foreign": 1042}, "RootProps": {"conditions": 284, "foreign": 1043}, "TitleProps": {"conditions": 284, "foreign": 1041}};
|
|
2
|
+
export const parts = {"ConnectorProps": [], "ContentProps": [], "DescriptionProps": [], "IndicatorProps": [], "ItemProps": [], "RootProps": [{"accepts": "boolean", "fallback": "", "kind": "variant", "name": "ongoing", "refers": [], "required": false, "says": "Whether the run is still going, which draws the rail past the last indicator."}, {"accepts": "\"accent\" | \"error\" | \"info\" | \"neutral\" | \"primary\" | \"secondary\" | \"success\" | \"warning\"", "fallback": "", "kind": "variant", "name": "palette", "refers": [], "required": false, "says": ""}, {"accepts": "\"center\" | \"end\" | \"start\"", "fallback": "", "kind": "variant", "name": "rail", "refers": [], "required": false, "says": "Where the rail runs, and how the words on either side of it share the width."}, {"accepts": "\"lg\" | \"md\" | \"sm\" | \"xl\"", "fallback": "", "kind": "variant", "name": "size", "refers": [], "required": false, "says": "The indicator's side and the text styles of the words and the marks."}, {"accepts": "\"outline\" | \"plain\" | \"solid\" | \"subtle\"", "fallback": "", "kind": "variant", "name": "variant", "refers": [], "required": false, "says": ""}], "TitleProps": []};
|
|
3
|
+
export const shapes = {};
|