@stealthscale/component-disclosure 0.2.2 → 0.2.4
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 -5423
- package/dist/pages/accordion/accordion.js +512 -0
- package/dist/pages/accordion/accordion.props.js +3 -0
- package/dist/pages/collapsible/collapsible.js +173 -0
- package/dist/pages/collapsible/collapsible.props.js +3 -0
- package/dist/pages/details/details.js +281 -0
- package/dist/pages/details/details.props.js +3 -0
- package/dist/pages/hover-card/hover-card.js +552 -0
- package/dist/pages/hover-card/hover-card.props.js +3 -0
- package/dist/pages/menu/menu.js +1103 -0
- package/dist/pages/menu/menu.props.js +3 -0
- package/dist/pages/menubar/menubar.js +1181 -0
- package/dist/pages/menubar/menubar.props.js +3 -0
- package/dist/pages/pages.json +138 -0
- package/dist/pages/popover/popover.js +161 -0
- package/dist/pages/popover/popover.props.js +3 -0
- package/dist/pages/steps/steps.js +660 -0
- package/dist/pages/steps/steps.props.js +3 -0
- package/dist/pages/tabs/tabs.js +815 -0
- package/dist/pages/tabs/tabs.props.js +3 -0
- package/dist/pages/toggle-tip/toggle-tip.js +344 -0
- package/dist/pages/toggle-tip/toggle-tip.props.js +3 -0
- package/dist/pages/tooltip/tooltip.js +112 -0
- package/dist/pages/tooltip/tooltip.props.js +3 -0
- package/dist/pages/truncate/truncate.js +235 -0
- package/dist/pages/truncate/truncate.props.js +3 -0
- package/dist/shared-Cfsikh3X.js +5424 -0
- package/dist/theme.js +23 -14
- package/locales/en/specimen/accordion.json +130 -0
- package/locales/en/specimen/collapsible.json +27 -0
- package/locales/en/specimen/details.json +48 -0
- package/locales/en/specimen/hover-card.json +58 -0
- package/locales/en/specimen/menu.json +81 -0
- package/locales/en/specimen/menubar.json +108 -0
- package/locales/en/specimen/popover.json +16 -0
- package/locales/en/specimen/steps.json +86 -0
- package/locales/en/specimen/tabs.json +108 -0
- package/locales/en/specimen/toggle-tip.json +47 -0
- package/locales/en/specimen/tooltip.json +14 -0
- package/locales/en/specimen/truncate.json +31 -0
- package/package.json +10 -9
- /package/dist/{recipe-95yCB2V3.js → recipes-95yCB2V3.js} +0 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { p as recipe } from "../../recipes-95yCB2V3.js";
|
|
3
|
+
import { Ft as Root, It as Indicator, Lt as Content, Pt as Trigger } from "../../shared-Cfsikh3X.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 { ChevronDownIcon } from "lucide-react";
|
|
8
|
+
//#region src/collapsible/examples/delivery.example.tsx
|
|
9
|
+
var delivery_example_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
+
Delivery: () => Delivery,
|
|
11
|
+
source: () => source$1
|
|
12
|
+
});
|
|
13
|
+
function Delivery(props) {
|
|
14
|
+
const $ = c(13);
|
|
15
|
+
const { t } = useWords("collapsible");
|
|
16
|
+
let t0;
|
|
17
|
+
if ($[0] !== t) {
|
|
18
|
+
t0 = t("delivery");
|
|
19
|
+
$[0] = t;
|
|
20
|
+
$[1] = t0;
|
|
21
|
+
} else t0 = $[1];
|
|
22
|
+
let t1;
|
|
23
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
24
|
+
t1 = /* @__PURE__ */ jsx(Indicator, { children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: "100%" }) });
|
|
25
|
+
$[2] = t1;
|
|
26
|
+
} else t1 = $[2];
|
|
27
|
+
let t2;
|
|
28
|
+
if ($[3] !== t0) {
|
|
29
|
+
t2 = /* @__PURE__ */ jsxs(Trigger, { children: [t0, t1] });
|
|
30
|
+
$[3] = t0;
|
|
31
|
+
$[4] = t2;
|
|
32
|
+
} else t2 = $[4];
|
|
33
|
+
let t3;
|
|
34
|
+
if ($[5] !== t) {
|
|
35
|
+
t3 = t("arrives");
|
|
36
|
+
$[5] = t;
|
|
37
|
+
$[6] = t3;
|
|
38
|
+
} else t3 = $[6];
|
|
39
|
+
let t4;
|
|
40
|
+
if ($[7] !== t3) {
|
|
41
|
+
t4 = /* @__PURE__ */ jsx(Content, { children: t3 });
|
|
42
|
+
$[7] = t3;
|
|
43
|
+
$[8] = t4;
|
|
44
|
+
} else t4 = $[8];
|
|
45
|
+
let t5;
|
|
46
|
+
if ($[9] !== props || $[10] !== t2 || $[11] !== t4) {
|
|
47
|
+
t5 = /* @__PURE__ */ jsxs(Root, {
|
|
48
|
+
...props,
|
|
49
|
+
children: [t2, t4]
|
|
50
|
+
});
|
|
51
|
+
$[9] = props;
|
|
52
|
+
$[10] = t2;
|
|
53
|
+
$[11] = t4;
|
|
54
|
+
$[12] = t5;
|
|
55
|
+
} else t5 = $[12];
|
|
56
|
+
return t5;
|
|
57
|
+
}
|
|
58
|
+
const source$1 = "import { type ReactElement } from \"react\";\n\nimport { ChevronDownIcon } from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Collapsible } from \"@stealthscale/component-disclosure\";\n\nexport function Delivery(props: Collapsible.RootProps): ReactElement {\n const { t } = useWords(\"collapsible\");\n\n return (\n <Collapsible.Root {...props}>\n <Collapsible.Trigger>\n {t(\"delivery\")}\n <Collapsible.Indicator>\n <ChevronDownIcon size=\"100%\" />\n </Collapsible.Indicator>\n </Collapsible.Trigger>\n <Collapsible.Content>{t(\"arrives\")}</Collapsible.Content>\n </Collapsible.Root>\n );\n}\n";
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region src/collapsible/examples/terms.example.tsx
|
|
61
|
+
var terms_example_exports = /* @__PURE__ */ __exportAll({
|
|
62
|
+
Terms: () => Terms,
|
|
63
|
+
source: () => source
|
|
64
|
+
});
|
|
65
|
+
function Terms() {
|
|
66
|
+
const $ = c(12);
|
|
67
|
+
const { t } = useWords("collapsible");
|
|
68
|
+
let t0;
|
|
69
|
+
if ($[0] !== t) {
|
|
70
|
+
t0 = t("delivery");
|
|
71
|
+
$[0] = t;
|
|
72
|
+
$[1] = t0;
|
|
73
|
+
} else t0 = $[1];
|
|
74
|
+
let t1;
|
|
75
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
76
|
+
t1 = /* @__PURE__ */ jsx(Indicator, { children: /* @__PURE__ */ jsx(ChevronDownIcon, { size: "100%" }) });
|
|
77
|
+
$[2] = t1;
|
|
78
|
+
} else t1 = $[2];
|
|
79
|
+
let t2;
|
|
80
|
+
if ($[3] !== t0) {
|
|
81
|
+
t2 = /* @__PURE__ */ jsxs(Trigger, { children: [t0, t1] });
|
|
82
|
+
$[3] = t0;
|
|
83
|
+
$[4] = t2;
|
|
84
|
+
} else t2 = $[4];
|
|
85
|
+
let t3;
|
|
86
|
+
if ($[5] !== t) {
|
|
87
|
+
t3 = t("terms");
|
|
88
|
+
$[5] = t;
|
|
89
|
+
$[6] = t3;
|
|
90
|
+
} else t3 = $[6];
|
|
91
|
+
let t4;
|
|
92
|
+
if ($[7] !== t3) {
|
|
93
|
+
t4 = /* @__PURE__ */ jsx(Content, { children: t3 });
|
|
94
|
+
$[7] = t3;
|
|
95
|
+
$[8] = t4;
|
|
96
|
+
} else t4 = $[8];
|
|
97
|
+
let t5;
|
|
98
|
+
if ($[9] !== t2 || $[10] !== t4) {
|
|
99
|
+
t5 = /* @__PURE__ */ jsxs(Root, {
|
|
100
|
+
collapsedHeight: "2lh",
|
|
101
|
+
variant: "subtle",
|
|
102
|
+
children: [t2, t4]
|
|
103
|
+
});
|
|
104
|
+
$[9] = t2;
|
|
105
|
+
$[10] = t4;
|
|
106
|
+
$[11] = t5;
|
|
107
|
+
} else t5 = $[11];
|
|
108
|
+
return t5;
|
|
109
|
+
}
|
|
110
|
+
const source = "import { type ReactElement } from \"react\";\n\nimport { ChevronDownIcon } from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Collapsible } from \"@stealthscale/component-disclosure\";\n\nexport function Terms(): ReactElement {\n const { t } = useWords(\"collapsible\");\n\n return (\n <Collapsible.Root collapsedHeight=\"2lh\" variant=\"subtle\">\n <Collapsible.Trigger>\n {t(\"delivery\")}\n <Collapsible.Indicator>\n <ChevronDownIcon size=\"100%\" />\n </Collapsible.Indicator>\n </Collapsible.Trigger>\n <Collapsible.Content>{t(\"terms\")}</Collapsible.Content>\n </Collapsible.Root>\n );\n}\n";
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/collapsible/collapsible.specimen.tsx
|
|
113
|
+
/**
|
|
114
|
+
* Catalogue page for the collapsible.
|
|
115
|
+
*
|
|
116
|
+
* @remarks
|
|
117
|
+
* `scenesOf` generates the looks, palettes, sizes and motions from the delivery example. The
|
|
118
|
+
* looks and palettes render open, so the content shows, and the palettes use the subtle look,
|
|
119
|
+
* which fills the box. The sizes and motions render closed in
|
|
120
|
+
* the outline look, because a motion shows only on a press. The preview scene is hand-written,
|
|
121
|
+
* because `collapsedHeight` needs content longer than two lines. Every collapsible renders in an
|
|
122
|
+
* `md` room, and every scene shows its example file as its source. The words are keys under
|
|
123
|
+
* `collapsible` in `locales/en/specimen/collapsible.json`.
|
|
124
|
+
*/
|
|
125
|
+
/**
|
|
126
|
+
* Hand-written scene for content that keeps two lines visible while closed.
|
|
127
|
+
*/
|
|
128
|
+
const preview = {
|
|
129
|
+
about: "collapsible.preview.about",
|
|
130
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
131
|
+
size: "md",
|
|
132
|
+
children: /* @__PURE__ */ jsx(Terms, {})
|
|
133
|
+
}),
|
|
134
|
+
example: terms_example_exports,
|
|
135
|
+
title: "collapsible.preview.title"
|
|
136
|
+
};
|
|
137
|
+
var collapsible_specimen_default = specimen({
|
|
138
|
+
about: "collapsible.about",
|
|
139
|
+
id: "components/disclosure/collapsible",
|
|
140
|
+
imports: "import { Collapsible } from \"@stealthscale/component-disclosure\";",
|
|
141
|
+
scenes: [...scenesOf(recipe, {
|
|
142
|
+
axes: {
|
|
143
|
+
motion: { with: { variant: "outline" } },
|
|
144
|
+
palette: { with: {
|
|
145
|
+
defaultOpen: true,
|
|
146
|
+
variant: "subtle"
|
|
147
|
+
} },
|
|
148
|
+
size: {
|
|
149
|
+
direction: "column",
|
|
150
|
+
with: { variant: "outline" }
|
|
151
|
+
},
|
|
152
|
+
variant: {
|
|
153
|
+
direction: "column",
|
|
154
|
+
with: { defaultOpen: true }
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
draw: (props) => /* @__PURE__ */ jsx(Room, {
|
|
158
|
+
size: "md",
|
|
159
|
+
children: /* @__PURE__ */ jsx(Delivery, { ...props })
|
|
160
|
+
}),
|
|
161
|
+
example: delivery_example_exports,
|
|
162
|
+
namespace: "collapsible",
|
|
163
|
+
order: [
|
|
164
|
+
"variant",
|
|
165
|
+
"palette",
|
|
166
|
+
"size",
|
|
167
|
+
"motion"
|
|
168
|
+
]
|
|
169
|
+
}), preview],
|
|
170
|
+
title: "collapsible.title"
|
|
171
|
+
});
|
|
172
|
+
//#endregion
|
|
173
|
+
export { collapsible_specimen_default as default, preview };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export const dropped = {"ContentProps": {"conditions": 284, "foreign": 1041}, "IndicatorProps": {"conditions": 284, "foreign": 1041}, "RootProps": {"conditions": 284, "foreign": 1039}, "TriggerProps": {"conditions": 284, "foreign": 1051}};
|
|
2
|
+
export const parts = {"ContentProps": [], "IndicatorProps": [], "RootProps": [{"accepts": "string | number", "fallback": "", "kind": "option", "name": "collapsedHeight", "refers": [], "required": false, "says": "The height of the content when collapsed."}, {"accepts": "string | number", "fallback": "", "kind": "option", "name": "collapsedWidth", "refers": [], "required": false, "says": "The width of the content when collapsed."}, {"accepts": "boolean", "fallback": "", "kind": "option", "name": "defaultOpen", "refers": [], "required": false, "says": "The initial open state of the collapsible when rendered. Use when you don't need to control the open state of the collapsible."}, {"accepts": "\"ltr\" | \"rtl\"", "fallback": "\"ltr\"", "kind": "option", "name": "dir", "refers": [], "required": false, "says": "The document's text/writing direction."}, {"accepts": "boolean", "fallback": "", "kind": "option", "name": "disabled", "refers": [], "required": false, "says": "Whether the collapsible is disabled."}, {"accepts": "(() => Document | Node | ShadowRoot)", "fallback": "", "kind": "option", "name": "getRootNode", "refers": [], "required": false, "says": "A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron."}, {"accepts": "string", "fallback": "", "kind": "option", "name": "id", "refers": [], "required": false, "says": "The unique identifier of the machine."}, {"accepts": "ElementIds", "fallback": "", "kind": "option", "name": "ids", "refers": ["collapsible.ElementIds"], "required": false, "says": "The ids of the elements in the collapsible. Useful for composition."}, {"accepts": "\"fade\" | \"none\" | \"slide\"", "fallback": "", "kind": "variant", "name": "motion", "refers": [], "required": false, "says": "Animation of the content as it opens and closes."}, {"accepts": "VoidFunction", "fallback": "", "kind": "option", "name": "onExitComplete", "refers": [], "required": false, "says": "The callback invoked when the exit animation completes."}, {"accepts": "((details: OpenChangeDetails) => void)", "fallback": "", "kind": "option", "name": "onOpenChange", "refers": ["collapsible.OpenChangeDetails"], "required": false, "says": "The callback invoked when the open state changes."}, {"accepts": "boolean", "fallback": "", "kind": "option", "name": "open", "refers": [], "required": false, "says": "The controlled open state of the collapsible."}, {"accepts": "\"accent\" | \"error\" | \"info\" | \"neutral\" | \"primary\" | \"secondary\" | \"success\" | \"warning\"", "fallback": "", "kind": "variant", "name": "palette", "refers": [], "required": false, "says": "Palette the looks read, set on the root."}, {"accepts": "Scale", "fallback": "", "kind": "variant", "name": "size", "refers": ["kit.Scale"], "required": false, "says": "Size of the trigger on the control scale, the indicator on the icon scale and the content's padding on the inset scale."}, {"accepts": "\"outline\" | \"plain\" | \"subtle\" | \"surface\"", "fallback": "", "kind": "variant", "name": "variant", "refers": [], "required": false, "says": "Look of the box around the trigger and the content."}], "TriggerProps": []};
|
|
3
|
+
export const shapes = {"collapsible.ElementIds": [{"accepts": "string", "name": "root", "says": ""}, {"accepts": "string", "name": "content", "says": ""}, {"accepts": "string", "name": "trigger", "says": ""}], "collapsible.OpenChangeDetails": [{"accepts": "boolean", "name": "open", "says": ""}], "kit.Scale": [{"accepts": "", "name": "\"2xl\"", "says": ""}, {"accepts": "", "name": "\"3xl\"", "says": ""}, {"accepts": "", "name": "\"4xl\"", "says": ""}, {"accepts": "", "name": "\"lg\"", "says": ""}, {"accepts": "", "name": "\"md\"", "says": ""}, {"accepts": "", "name": "\"sm\"", "says": ""}, {"accepts": "", "name": "\"xl\"", "says": ""}, {"accepts": "", "name": "\"xs\"", "says": ""}]};
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { f as recipe } from "../../recipes-95yCB2V3.js";
|
|
3
|
+
import { At as Root, Mt as Content, jt as Indicator, kt as Summary } from "../../shared-Cfsikh3X.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 { ChevronRightIcon, CircleAlertIcon } from "lucide-react";
|
|
8
|
+
import { Stack } from "@stealthscale/component-layout";
|
|
9
|
+
import { Code } from "@stealthscale/component-typography";
|
|
10
|
+
import { DataList } from "@stealthscale/component-collections";
|
|
11
|
+
import { Alert } from "@stealthscale/component-feedback";
|
|
12
|
+
//#region src/details/examples/declined.example.tsx
|
|
13
|
+
var declined_example_exports = /* @__PURE__ */ __exportAll({
|
|
14
|
+
Declined: () => Declined,
|
|
15
|
+
source: () => source$2
|
|
16
|
+
});
|
|
17
|
+
const FIELDS = [
|
|
18
|
+
["code", "card_declined"],
|
|
19
|
+
["reason", "insufficient_funds"],
|
|
20
|
+
["request", "req_7Hq2Lx9"]
|
|
21
|
+
];
|
|
22
|
+
function Declined() {
|
|
23
|
+
const $ = c(27);
|
|
24
|
+
const { t } = useWords("details");
|
|
25
|
+
let t0;
|
|
26
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
27
|
+
t0 = /* @__PURE__ */ jsx(Alert.Indicator, { children: /* @__PURE__ */ jsx(CircleAlertIcon, {}) });
|
|
28
|
+
$[0] = t0;
|
|
29
|
+
} else t0 = $[0];
|
|
30
|
+
let t1;
|
|
31
|
+
if ($[1] !== t) {
|
|
32
|
+
t1 = t("declined.heading");
|
|
33
|
+
$[1] = t;
|
|
34
|
+
$[2] = t1;
|
|
35
|
+
} else t1 = $[2];
|
|
36
|
+
let t2;
|
|
37
|
+
if ($[3] !== t1) {
|
|
38
|
+
t2 = /* @__PURE__ */ jsx(Alert.Title, { children: t1 });
|
|
39
|
+
$[3] = t1;
|
|
40
|
+
$[4] = t2;
|
|
41
|
+
} else t2 = $[4];
|
|
42
|
+
let t3;
|
|
43
|
+
if ($[5] !== t) {
|
|
44
|
+
t3 = t("declined.description");
|
|
45
|
+
$[5] = t;
|
|
46
|
+
$[6] = t3;
|
|
47
|
+
} else t3 = $[6];
|
|
48
|
+
let t4;
|
|
49
|
+
if ($[7] !== t3) {
|
|
50
|
+
t4 = /* @__PURE__ */ jsx(Alert.Description, { children: t3 });
|
|
51
|
+
$[7] = t3;
|
|
52
|
+
$[8] = t4;
|
|
53
|
+
} else t4 = $[8];
|
|
54
|
+
let t5;
|
|
55
|
+
if ($[9] !== t2 || $[10] !== t4) {
|
|
56
|
+
t5 = /* @__PURE__ */ jsxs(Alert.Root, {
|
|
57
|
+
status: "error",
|
|
58
|
+
children: [t0, /* @__PURE__ */ jsxs(Alert.Content, { children: [t2, t4] })]
|
|
59
|
+
});
|
|
60
|
+
$[9] = t2;
|
|
61
|
+
$[10] = t4;
|
|
62
|
+
$[11] = t5;
|
|
63
|
+
} else t5 = $[11];
|
|
64
|
+
let t6;
|
|
65
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
66
|
+
t6 = /* @__PURE__ */ jsx(Indicator, { children: /* @__PURE__ */ jsx(ChevronRightIcon, {}) });
|
|
67
|
+
$[12] = t6;
|
|
68
|
+
} else t6 = $[12];
|
|
69
|
+
let t7;
|
|
70
|
+
if ($[13] !== t) {
|
|
71
|
+
t7 = t("declined.show");
|
|
72
|
+
$[13] = t;
|
|
73
|
+
$[14] = t7;
|
|
74
|
+
} else t7 = $[14];
|
|
75
|
+
let t8;
|
|
76
|
+
if ($[15] !== t7) {
|
|
77
|
+
t8 = /* @__PURE__ */ jsxs(Summary, { children: [t6, t7] });
|
|
78
|
+
$[15] = t7;
|
|
79
|
+
$[16] = t8;
|
|
80
|
+
} else t8 = $[16];
|
|
81
|
+
let t9;
|
|
82
|
+
if ($[17] !== t) {
|
|
83
|
+
t9 = FIELDS.map((t10) => {
|
|
84
|
+
const [field, value] = t10;
|
|
85
|
+
return /* @__PURE__ */ jsxs(DataList.Item, { children: [/* @__PURE__ */ jsx(DataList.ItemLabel, { children: t(`declined.fields.${field}`) }), /* @__PURE__ */ jsx(DataList.ItemValue, { children: /* @__PURE__ */ jsx(Code, { children: value }) })] }, field);
|
|
86
|
+
});
|
|
87
|
+
$[17] = t;
|
|
88
|
+
$[18] = t9;
|
|
89
|
+
} else t9 = $[18];
|
|
90
|
+
let t10;
|
|
91
|
+
if ($[19] !== t9) {
|
|
92
|
+
t10 = /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(DataList.Root, {
|
|
93
|
+
size: "sm",
|
|
94
|
+
children: t9
|
|
95
|
+
}) });
|
|
96
|
+
$[19] = t9;
|
|
97
|
+
$[20] = t10;
|
|
98
|
+
} else t10 = $[20];
|
|
99
|
+
let t11;
|
|
100
|
+
if ($[21] !== t10 || $[22] !== t8) {
|
|
101
|
+
t11 = /* @__PURE__ */ jsxs(Root, {
|
|
102
|
+
size: "sm",
|
|
103
|
+
children: [t8, t10]
|
|
104
|
+
});
|
|
105
|
+
$[21] = t10;
|
|
106
|
+
$[22] = t8;
|
|
107
|
+
$[23] = t11;
|
|
108
|
+
} else t11 = $[23];
|
|
109
|
+
let t12;
|
|
110
|
+
if ($[24] !== t11 || $[25] !== t5) {
|
|
111
|
+
t12 = /* @__PURE__ */ jsxs(Stack, {
|
|
112
|
+
gap: "sm",
|
|
113
|
+
children: [t5, t11]
|
|
114
|
+
});
|
|
115
|
+
$[24] = t11;
|
|
116
|
+
$[25] = t5;
|
|
117
|
+
$[26] = t12;
|
|
118
|
+
} else t12 = $[26];
|
|
119
|
+
return t12;
|
|
120
|
+
}
|
|
121
|
+
const source$2 = "import { type ReactElement } from \"react\";\n\nimport { ChevronRightIcon, CircleAlertIcon } from \"lucide-react\";\n\nimport { DataList } from \"@stealthscale/component-collections\";\nimport { Alert } from \"@stealthscale/component-feedback\";\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { Code } from \"@stealthscale/component-typography\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Details } from \"@stealthscale/component-disclosure\";\n\nconst FIELDS = [\n [\"code\", \"card_declined\"],\n [\"reason\", \"insufficient_funds\"],\n [\"request\", \"req_7Hq2Lx9\"],\n];\n\nexport function Declined(): ReactElement {\n const { t } = useWords(\"details\");\n\n return (\n <Stack gap=\"sm\">\n <Alert.Root status=\"error\">\n <Alert.Indicator>\n <CircleAlertIcon />\n </Alert.Indicator>\n <Alert.Content>\n <Alert.Title>{t(\"declined.heading\")}</Alert.Title>\n <Alert.Description>{t(\"declined.description\")}</Alert.Description>\n </Alert.Content>\n </Alert.Root>\n <Details.Root size=\"sm\">\n <Details.Summary>\n <Details.Indicator>\n <ChevronRightIcon />\n </Details.Indicator>\n {t(\"declined.show\")}\n </Details.Summary>\n <Details.Content>\n <DataList.Root size=\"sm\">\n {FIELDS.map(([field, value]) => (\n <DataList.Item key={field}>\n <DataList.ItemLabel>{t(`declined.fields.${field}`)}</DataList.ItemLabel>\n <DataList.ItemValue>\n <Code>{value}</Code>\n </DataList.ItemValue>\n </DataList.Item>\n ))}\n </DataList.Root>\n </Details.Content>\n </Details.Root>\n </Stack>\n );\n}\n";
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/details/examples/faq.example.tsx
|
|
124
|
+
var faq_example_exports = /* @__PURE__ */ __exportAll({
|
|
125
|
+
Faq: () => Faq,
|
|
126
|
+
source: () => source$1
|
|
127
|
+
});
|
|
128
|
+
const QUESTIONS = [
|
|
129
|
+
"timing",
|
|
130
|
+
"fees",
|
|
131
|
+
"currencies"
|
|
132
|
+
];
|
|
133
|
+
function Faq() {
|
|
134
|
+
const $ = c(4);
|
|
135
|
+
const { t } = useWords("details");
|
|
136
|
+
let t0;
|
|
137
|
+
if ($[0] !== t) {
|
|
138
|
+
t0 = QUESTIONS.map((question) => /* @__PURE__ */ jsxs(Root, {
|
|
139
|
+
name: "payout-questions",
|
|
140
|
+
children: [/* @__PURE__ */ jsxs(Summary, { children: [/* @__PURE__ */ jsx(Indicator, { children: /* @__PURE__ */ jsx(ChevronRightIcon, {}) }), t(`faq.${question}.question`)] }), /* @__PURE__ */ jsx(Content, { children: t(`faq.${question}.answer`) })]
|
|
141
|
+
}, question));
|
|
142
|
+
$[0] = t;
|
|
143
|
+
$[1] = t0;
|
|
144
|
+
} else t0 = $[1];
|
|
145
|
+
let t1;
|
|
146
|
+
if ($[2] !== t0) {
|
|
147
|
+
t1 = /* @__PURE__ */ jsx(Stack, {
|
|
148
|
+
gap: "sm",
|
|
149
|
+
children: t0
|
|
150
|
+
});
|
|
151
|
+
$[2] = t0;
|
|
152
|
+
$[3] = t1;
|
|
153
|
+
} else t1 = $[3];
|
|
154
|
+
return t1;
|
|
155
|
+
}
|
|
156
|
+
const source$1 = "import { type ReactElement } from \"react\";\n\nimport { ChevronRightIcon } from \"lucide-react\";\n\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Details } from \"@stealthscale/component-disclosure\";\n\nconst QUESTIONS = [\"timing\", \"fees\", \"currencies\"];\n\nexport function Faq(): ReactElement {\n const { t } = useWords(\"details\");\n\n return (\n <Stack gap=\"sm\">\n {QUESTIONS.map((question) => (\n <Details.Root key={question} name=\"payout-questions\">\n <Details.Summary>\n <Details.Indicator>\n <ChevronRightIcon />\n </Details.Indicator>\n {t(`faq.${question}.question`)}\n </Details.Summary>\n <Details.Content>{t(`faq.${question}.answer`)}</Details.Content>\n </Details.Root>\n ))}\n </Stack>\n );\n}\n";
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region src/details/examples/refund.example.tsx
|
|
159
|
+
var refund_example_exports = /* @__PURE__ */ __exportAll({
|
|
160
|
+
Refund: () => Refund,
|
|
161
|
+
source: () => source
|
|
162
|
+
});
|
|
163
|
+
function Refund(props) {
|
|
164
|
+
const $ = c(13);
|
|
165
|
+
const { t } = useWords("details");
|
|
166
|
+
let t0;
|
|
167
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
168
|
+
t0 = /* @__PURE__ */ jsx(Indicator, { children: /* @__PURE__ */ jsx(ChevronRightIcon, {}) });
|
|
169
|
+
$[0] = t0;
|
|
170
|
+
} else t0 = $[0];
|
|
171
|
+
let t1;
|
|
172
|
+
if ($[1] !== t) {
|
|
173
|
+
t1 = t("refund.question");
|
|
174
|
+
$[1] = t;
|
|
175
|
+
$[2] = t1;
|
|
176
|
+
} else t1 = $[2];
|
|
177
|
+
let t2;
|
|
178
|
+
if ($[3] !== t1) {
|
|
179
|
+
t2 = /* @__PURE__ */ jsxs(Summary, { children: [t0, t1] });
|
|
180
|
+
$[3] = t1;
|
|
181
|
+
$[4] = t2;
|
|
182
|
+
} else t2 = $[4];
|
|
183
|
+
let t3;
|
|
184
|
+
if ($[5] !== t) {
|
|
185
|
+
t3 = t("refund.answer");
|
|
186
|
+
$[5] = t;
|
|
187
|
+
$[6] = t3;
|
|
188
|
+
} else t3 = $[6];
|
|
189
|
+
let t4;
|
|
190
|
+
if ($[7] !== t3) {
|
|
191
|
+
t4 = /* @__PURE__ */ jsx(Content, { children: t3 });
|
|
192
|
+
$[7] = t3;
|
|
193
|
+
$[8] = t4;
|
|
194
|
+
} else t4 = $[8];
|
|
195
|
+
let t5;
|
|
196
|
+
if ($[9] !== props || $[10] !== t2 || $[11] !== t4) {
|
|
197
|
+
t5 = /* @__PURE__ */ jsxs(Root, {
|
|
198
|
+
...props,
|
|
199
|
+
children: [t2, t4]
|
|
200
|
+
});
|
|
201
|
+
$[9] = props;
|
|
202
|
+
$[10] = t2;
|
|
203
|
+
$[11] = t4;
|
|
204
|
+
$[12] = t5;
|
|
205
|
+
} else t5 = $[12];
|
|
206
|
+
return t5;
|
|
207
|
+
}
|
|
208
|
+
const source = "import { type ReactElement } from \"react\";\n\nimport { ChevronRightIcon } from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Details } from \"@stealthscale/component-disclosure\";\n\nexport function Refund(props: Details.RootProps): ReactElement {\n const { t } = useWords(\"details\");\n\n return (\n <Details.Root {...props}>\n <Details.Summary>\n <Details.Indicator>\n <ChevronRightIcon />\n </Details.Indicator>\n {t(\"refund.question\")}\n </Details.Summary>\n <Details.Content>{t(\"refund.answer\")}</Details.Content>\n </Details.Root>\n );\n}\n";
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/details/details.specimen.tsx
|
|
211
|
+
/**
|
|
212
|
+
* Catalogue page for the details.
|
|
213
|
+
*
|
|
214
|
+
* @remarks
|
|
215
|
+
* `scenesOf` generates the looks, palettes and sizes from the refund example, each in an `md`
|
|
216
|
+
* room. The looks and palettes render open, so the content shows, and the palettes use the subtle
|
|
217
|
+
* look, which fills the box. The hand-written scenes show an exclusive group of answers and a
|
|
218
|
+
* details under an alert. No generated scene sets `name`, because details with one name close
|
|
219
|
+
* each other across the page. The words are keys under `details` in
|
|
220
|
+
* `locales/en/specimen/details.json`.
|
|
221
|
+
*/
|
|
222
|
+
/**
|
|
223
|
+
* Hand-written scene for three answers that close each other.
|
|
224
|
+
*/
|
|
225
|
+
const faq = {
|
|
226
|
+
about: "details.faq.about",
|
|
227
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
228
|
+
size: "md",
|
|
229
|
+
children: /* @__PURE__ */ jsx(Faq, {})
|
|
230
|
+
}),
|
|
231
|
+
example: faq_example_exports,
|
|
232
|
+
title: "details.faq.title"
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* Hand-written scene for the full error of a payment under its alert.
|
|
236
|
+
*/
|
|
237
|
+
const declined = {
|
|
238
|
+
about: "details.declined.about",
|
|
239
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
240
|
+
size: "md",
|
|
241
|
+
children: /* @__PURE__ */ jsx(Declined, {})
|
|
242
|
+
}),
|
|
243
|
+
example: declined_example_exports,
|
|
244
|
+
title: "details.declined.title"
|
|
245
|
+
};
|
|
246
|
+
var details_specimen_default = specimen({
|
|
247
|
+
about: "details.about",
|
|
248
|
+
id: "components/disclosure/details",
|
|
249
|
+
imports: "import { Details } from \"@stealthscale/component-disclosure\";",
|
|
250
|
+
scenes: [
|
|
251
|
+
...scenesOf(recipe, {
|
|
252
|
+
axes: {
|
|
253
|
+
palette: { with: {
|
|
254
|
+
open: true,
|
|
255
|
+
variant: "subtle"
|
|
256
|
+
} },
|
|
257
|
+
size: { direction: "column" },
|
|
258
|
+
variant: {
|
|
259
|
+
direction: "column",
|
|
260
|
+
with: { open: true }
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
draw: (props) => /* @__PURE__ */ jsx(Room, {
|
|
264
|
+
size: "md",
|
|
265
|
+
children: /* @__PURE__ */ jsx(Refund, { ...props })
|
|
266
|
+
}),
|
|
267
|
+
example: refund_example_exports,
|
|
268
|
+
namespace: "details",
|
|
269
|
+
order: [
|
|
270
|
+
"variant",
|
|
271
|
+
"palette",
|
|
272
|
+
"size"
|
|
273
|
+
]
|
|
274
|
+
}),
|
|
275
|
+
faq,
|
|
276
|
+
declined
|
|
277
|
+
],
|
|
278
|
+
title: "details.title"
|
|
279
|
+
});
|
|
280
|
+
//#endregion
|
|
281
|
+
export { declined, details_specimen_default as default, faq };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export const dropped = {"ContentProps": {"conditions": 284, "foreign": 1041}, "IndicatorProps": {"conditions": 284, "foreign": 1041}, "RootProps": {"conditions": 284, "foreign": 1043}, "SummaryProps": {"conditions": 284, "foreign": 1041}};
|
|
2
|
+
export const parts = {"ContentProps": [], "IndicatorProps": [], "RootProps": [{"accepts": "\"accent\" | \"error\" | \"info\" | \"neutral\" | \"primary\" | \"secondary\" | \"success\" | \"warning\"", "fallback": "", "kind": "variant", "name": "palette", "refers": [], "required": false, "says": "Palette the looks read, set on the root."}, {"accepts": "Scale", "fallback": "", "kind": "variant", "name": "size", "refers": ["kit.Scale"], "required": false, "says": "Size of the summary, the indicator on the icon scale and the content's padding on the inset scale."}, {"accepts": "\"outline\" | \"plain\" | \"subtle\" | \"surface\"", "fallback": "", "kind": "variant", "name": "variant", "refers": [], "required": false, "says": "Look of the box around the summary and the content."}], "SummaryProps": []};
|
|
3
|
+
export const shapes = {"kit.Scale": [{"accepts": "", "name": "\"2xl\"", "says": ""}, {"accepts": "", "name": "\"3xl\"", "says": ""}, {"accepts": "", "name": "\"4xl\"", "says": ""}, {"accepts": "", "name": "\"lg\"", "says": ""}, {"accepts": "", "name": "\"md\"", "says": ""}, {"accepts": "", "name": "\"sm\"", "says": ""}, {"accepts": "", "name": "\"xl\"", "says": ""}, {"accepts": "", "name": "\"xs\"", "says": ""}]};
|