@techzyapp/ui-library 1.0.0 → 1.0.1
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/README.md +134 -0
- package/dist/Blockquote-CNIuJFHq.js +46 -0
- package/dist/Blockquote-CNIuJFHq.js.map +1 -0
- package/dist/Blockquote-CxHwOecc.cjs +2 -0
- package/dist/Blockquote-CxHwOecc.cjs.map +1 -0
- package/dist/Code-CUdpWlY5.cjs +2 -0
- package/dist/Code-CUdpWlY5.cjs.map +1 -0
- package/dist/Code-DaEpXHfF.js +26 -0
- package/dist/Code-DaEpXHfF.js.map +1 -0
- package/dist/CodeBlock-BWxQyKRo.js +96 -0
- package/dist/CodeBlock-BWxQyKRo.js.map +1 -0
- package/dist/CodeBlock-CgXOjKS-.cjs +2 -0
- package/dist/CodeBlock-CgXOjKS-.cjs.map +1 -0
- package/dist/components/Blockquote/Blockquote.d.cts +25 -0
- package/dist/components/Blockquote/Blockquote.d.ts +25 -0
- package/dist/components/Blockquote/index.cjs +2 -0
- package/dist/components/Blockquote/index.cjs.map +1 -0
- package/dist/components/Blockquote/index.d.cts +2 -0
- package/dist/components/Blockquote/index.d.ts +2 -0
- package/dist/components/Blockquote/index.js +6 -0
- package/dist/components/Blockquote/index.js.map +1 -0
- package/dist/components/Code/Code.d.cts +21 -0
- package/dist/components/Code/Code.d.ts +21 -0
- package/dist/components/Code/index.cjs +2 -0
- package/dist/components/Code/index.cjs.map +1 -0
- package/dist/components/Code/index.d.cts +2 -0
- package/dist/components/Code/index.d.ts +2 -0
- package/dist/components/Code/index.js +6 -0
- package/dist/components/Code/index.js.map +1 -0
- package/dist/components/CodeBlock/CodeBlock.d.cts +10 -6
- package/dist/components/CodeBlock/CodeBlock.d.ts +10 -6
- package/dist/components/CodeBlock/index.cjs +1 -1
- package/dist/components/CodeBlock/index.js +1 -1
- package/dist/components/index.d.cts +2 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/entries/components.cjs +1 -1
- package/dist/entries/components.js +128 -124
- package/dist/entries/components.js.map +1 -1
- package/dist/helpers/translations.d.cts +1 -1
- package/dist/helpers/translations.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +140 -136
- package/dist/index.js.map +1 -1
- package/dist/translations-CXEeeUDL.cjs.map +1 -1
- package/dist/translations-D15tFHM1.js.map +1 -1
- package/package.json +1 -1
- package/dist/CodeBlock-DOk5wekc.cjs +0 -2
- package/dist/CodeBlock-DOk5wekc.cjs.map +0 -1
- package/dist/CodeBlock-n3KExtTO.js +0 -104
- package/dist/CodeBlock-n3KExtTO.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -3,73 +3,75 @@ import { u as s, a as t } from "./useForm-B_5wDIER.js";
|
|
|
3
3
|
import { u as m } from "./useLockBodyScroll-DwBILLPK.js";
|
|
4
4
|
import { u as x } from "./useMediaQuery-_1EcFoC5.js";
|
|
5
5
|
import { g as T, h as l, s as u, u as c } from "./access-Db4knwyR.js";
|
|
6
|
-
import { C as
|
|
7
|
-
import { c as U, a as
|
|
6
|
+
import { C as n, D as A, c as C, d as F, e as S, f as g, g as D, u as y, h as E, i as L, j as b, a as R, k as _, l as B, m as h, b as N, n as P } from "./ConfigProvider-2c94kUOk.js";
|
|
7
|
+
import { c as U, a as k, f as M } from "./messages-C-zecFBE.js";
|
|
8
8
|
import { D as K, b as O, a as Y, f as v, n as G, t as w } from "./translations-D15tFHM1.js";
|
|
9
|
-
import { b as
|
|
9
|
+
import { b as q, p as H } from "./table-DF3zTrC3.js";
|
|
10
10
|
import { I as J, i as V } from "./Icon-CophpkHo.js";
|
|
11
11
|
import { A as X, a as Z } from "./Accordion-CAxa1I-m.js";
|
|
12
12
|
import { A as oo } from "./Alert-BQpA48PY.js";
|
|
13
13
|
import { A as eo } from "./Avatar-BJVCdo-K.js";
|
|
14
14
|
import { A as so } from "./AvatarGroup-DdJf4aT7.js";
|
|
15
15
|
import { B as po } from "./Badge-DSWigoGC.js";
|
|
16
|
-
import { B as fo } from "./
|
|
17
|
-
import { B as io } from "./
|
|
18
|
-
import {
|
|
19
|
-
import { C as co } from "./
|
|
20
|
-
import { C as Ao } from "./
|
|
21
|
-
import { C as
|
|
22
|
-
import { C as Do } from "./
|
|
23
|
-
import { C as Eo
|
|
24
|
-
import { C as
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import { D as Io } from "./
|
|
28
|
-
import { D as
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import { F as
|
|
33
|
-
import { F as qo } from "./
|
|
34
|
-
import { F as Jo } from "./
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import { L as mr } from "./
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import { M as ur } from "./
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import { P as yr } from "./
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import { R as
|
|
52
|
-
import { R as
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import { S as Kr
|
|
56
|
-
import { S as
|
|
57
|
-
import { S as wr } from "./
|
|
58
|
-
import { S as
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import { T as Xr } from "./
|
|
62
|
-
import { T as $r } from "./
|
|
63
|
-
import { T as re } from "./
|
|
64
|
-
import { T as ae } from "./
|
|
65
|
-
import { T as te
|
|
66
|
-
import { T as
|
|
67
|
-
import { T as
|
|
68
|
-
import { T as
|
|
69
|
-
import { T as
|
|
70
|
-
import { T as Ae } from "./
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
16
|
+
import { B as fo } from "./Blockquote-CNIuJFHq.js";
|
|
17
|
+
import { B as io } from "./Breadcrumbs-Bx5UgwDy.js";
|
|
18
|
+
import { B as lo } from "./Button-DhEv0YFk.js";
|
|
19
|
+
import { C as co } from "./Card-DzClqJuu.js";
|
|
20
|
+
import { C as Ao } from "./Checkbox-XKL_Q5qj.js";
|
|
21
|
+
import { C as Fo } from "./Chip-Cfo0v3Z8.js";
|
|
22
|
+
import { C as go, a as Do } from "./ChoiceCardGroup-CvFzZlgI.js";
|
|
23
|
+
import { C as Eo } from "./Code-DaEpXHfF.js";
|
|
24
|
+
import { C as bo } from "./CodeBlock-BWxQyKRo.js";
|
|
25
|
+
import { C as _o, R as Bo } from "./Col-D2TfZKiM.js";
|
|
26
|
+
import { C as No } from "./ColorPicker-2udt1ORM.js";
|
|
27
|
+
import { D as Io } from "./DatePicker-WM9TC6L_.js";
|
|
28
|
+
import { D as ko } from "./DateTimePicker-DBtcWK0F.js";
|
|
29
|
+
import { D as Qo } from "./Divider-LtH3dLgw.js";
|
|
30
|
+
import { D as Oo } from "./Dropdown-DKAXue5_.js";
|
|
31
|
+
import { E as vo } from "./EmptyState-CetM49vk.js";
|
|
32
|
+
import { F as wo } from "./FileUploader-VtmmwUFE.js";
|
|
33
|
+
import { F as qo, S as Ho } from "./Sidebar-DRCs2ygZ.js";
|
|
34
|
+
import { F as Jo } from "./Flag-BWCX6oSR.js";
|
|
35
|
+
import { F as Wo } from "./Flex-Bj3mMF5A.js";
|
|
36
|
+
import { F as Zo } from "./FullscreenToggle-oWzYqUPH.js";
|
|
37
|
+
import { G as or } from "./Grid-CY-syhTX.js";
|
|
38
|
+
import { I as er, a as ar } from "./names-D8ABK2Wk.js";
|
|
39
|
+
import { I as tr } from "./IconButton-CBusrDa9.js";
|
|
40
|
+
import { L as mr } from "./List-BHgFI9Ll.js";
|
|
41
|
+
import { L as xr } from "./ListItem-B4yqZR-Z.js";
|
|
42
|
+
import { L as Tr } from "./Loader-C4JoXOyA.js";
|
|
43
|
+
import { M as ur } from "./Modal-BuaPDlKV.js";
|
|
44
|
+
import { M as dr } from "./MultiSelect-BGRT_B60.js";
|
|
45
|
+
import { M as Ar } from "./MultilineTextField-CwNCJ9lZ.js";
|
|
46
|
+
import { N as Fr } from "./NumberField-DBvhSQCw.js";
|
|
47
|
+
import { O as gr } from "./OtpField-CTq-CUbF.js";
|
|
48
|
+
import { P as yr } from "./PageLayout-DddzYw2B.js";
|
|
49
|
+
import { P as Lr } from "./Pagination-CN9V8M5C.js";
|
|
50
|
+
import { P as Rr } from "./Popover-CgIU4Rhg.js";
|
|
51
|
+
import { R as Br, a as hr } from "./RadioGroup-DbodUJW8.js";
|
|
52
|
+
import { R as Pr } from "./RemoveDialog-Bvt6sH79.js";
|
|
53
|
+
import { R as Ur } from "./RichTextEditor-BTx8Py3I.js";
|
|
54
|
+
import { R as Mr } from "./RootLayout-DCpfuFWF.js";
|
|
55
|
+
import { S as Kr } from "./Select-PbTyxB1Q.js";
|
|
56
|
+
import { S as Yr } from "./Slider-oGXd5e9X.js";
|
|
57
|
+
import { S as Gr, a as wr } from "./SpeedDial-DgFj16BQ.js";
|
|
58
|
+
import { S as qr } from "./Stepper-COKAyN1L.js";
|
|
59
|
+
import { S as zr } from "./SwatchPicker-D30aSrbY.js";
|
|
60
|
+
import { S as Vr } from "./Switch-DMPJ0fhB.js";
|
|
61
|
+
import { T as Xr } from "./Table-BjPLvMbf.js";
|
|
62
|
+
import { T as $r } from "./Tabs--DDM-zKe.js";
|
|
63
|
+
import { T as re } from "./TagsField-BTJcZS9P.js";
|
|
64
|
+
import { T as ae } from "./TextField-DMI1X09n.js";
|
|
65
|
+
import { T as te } from "./ThemeToggle-Deh9j8pm.js";
|
|
66
|
+
import { T as me } from "./TimePicker-3JgvK2on.js";
|
|
67
|
+
import { T as xe, a as ie } from "./Timeline-WkV4k_we.js";
|
|
68
|
+
import { T as le } from "./Toaster-D-eG1xv7.js";
|
|
69
|
+
import { T as ce, a as de } from "./ToggleButtonGroup-BWd7MOcc.js";
|
|
70
|
+
import { T as Ae } from "./Tooltip-Cb_FKxT9.js";
|
|
71
|
+
import { T as Fe } from "./TranslatedFields-CI0F9bHw.js";
|
|
72
|
+
import { T as ge } from "./Typography-Cta6Rg4L.js";
|
|
73
|
+
import { U as ye } from "./UserCard-BhqtX1vU.js";
|
|
74
|
+
import { t as Le } from "./toastStore-Cx_JOKwS.js";
|
|
73
75
|
export {
|
|
74
76
|
X as Accordion,
|
|
75
77
|
Z as AccordionItem,
|
|
@@ -77,94 +79,96 @@ export {
|
|
|
77
79
|
eo as Avatar,
|
|
78
80
|
so as AvatarGroup,
|
|
79
81
|
po as Badge,
|
|
80
|
-
fo as
|
|
81
|
-
io as
|
|
82
|
-
lo as
|
|
83
|
-
co as
|
|
84
|
-
Ao as
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
Do as
|
|
88
|
-
Eo as
|
|
89
|
-
|
|
90
|
-
|
|
82
|
+
fo as Blockquote,
|
|
83
|
+
io as Breadcrumbs,
|
|
84
|
+
lo as Button,
|
|
85
|
+
co as Card,
|
|
86
|
+
Ao as Checkbox,
|
|
87
|
+
Fo as Chip,
|
|
88
|
+
go as ChoiceCard,
|
|
89
|
+
Do as ChoiceCardGroup,
|
|
90
|
+
Eo as Code,
|
|
91
|
+
bo as CodeBlock,
|
|
92
|
+
_o as Col,
|
|
93
|
+
No as ColorPicker,
|
|
94
|
+
n as ConfigProvider,
|
|
91
95
|
A as DEFAULT_FONT_FAMILY,
|
|
92
|
-
|
|
93
|
-
|
|
96
|
+
C as DEFAULT_NESTED_TAB_QUERY_KEY,
|
|
97
|
+
F as DEFAULT_STEP_QUERY_KEY,
|
|
94
98
|
S as DEFAULT_TABS_QUERY_KEY,
|
|
95
99
|
K as DEFAULT_TRANSLATIONS_NAMESPACE,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
Io as DatePicker,
|
|
101
|
+
ko as DateTimePicker,
|
|
102
|
+
Qo as Divider,
|
|
103
|
+
Oo as Dropdown,
|
|
104
|
+
vo as EmptyState,
|
|
105
|
+
wo as FileUploader,
|
|
106
|
+
qo as FirstRouteRedirect,
|
|
107
|
+
Jo as Flag,
|
|
108
|
+
Wo as Flex,
|
|
105
109
|
e as Form,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
Zo as FullscreenToggle,
|
|
111
|
+
or as Grid,
|
|
112
|
+
er as ICON_COUNT,
|
|
113
|
+
ar as ICON_NAMES,
|
|
110
114
|
J as Icon,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
115
|
+
tr as IconButton,
|
|
116
|
+
mr as List,
|
|
117
|
+
xr as ListItem,
|
|
118
|
+
Tr as Loader,
|
|
119
|
+
ur as Modal,
|
|
120
|
+
dr as MultiSelect,
|
|
121
|
+
Ar as MultilineTextField,
|
|
122
|
+
Fr as NumberField,
|
|
123
|
+
gr as OtpField,
|
|
124
|
+
yr as PageLayout,
|
|
125
|
+
Lr as Pagination,
|
|
126
|
+
Rr as Popover,
|
|
127
|
+
Br as Radio,
|
|
128
|
+
hr as RadioGroup,
|
|
129
|
+
Pr as RemoveDialog,
|
|
130
|
+
Ur as RichTextEditor,
|
|
131
|
+
Mr as RootLayout,
|
|
132
|
+
Bo as Row,
|
|
133
|
+
Kr as Select,
|
|
134
|
+
Ho as Sidebar,
|
|
135
|
+
Yr as Slider,
|
|
136
|
+
Gr as SpeedDial,
|
|
137
|
+
wr as SpeedDialAction,
|
|
138
|
+
qr as Stepper,
|
|
139
|
+
zr as SwatchPicker,
|
|
140
|
+
Vr as Switch,
|
|
141
|
+
Xr as Table,
|
|
142
|
+
$r as Tabs,
|
|
143
|
+
re as TagsField,
|
|
144
|
+
ae as TextField,
|
|
145
|
+
te as ThemeToggle,
|
|
146
|
+
me as TimePicker,
|
|
147
|
+
xe as Timeline,
|
|
148
|
+
ie as TimelineItem,
|
|
149
|
+
le as Toaster,
|
|
150
|
+
ce as ToggleButton,
|
|
151
|
+
de as ToggleButtonGroup,
|
|
152
|
+
Ae as Tooltip,
|
|
153
|
+
Fe as TranslatedFields,
|
|
154
|
+
ge as Typography,
|
|
155
|
+
ye as UserCard,
|
|
152
156
|
g as applyTheme,
|
|
153
|
-
|
|
157
|
+
q as buildTableQuery,
|
|
154
158
|
O as buildTranslationName,
|
|
155
159
|
Y as buildTranslations,
|
|
156
160
|
U as createAppTranslator,
|
|
157
|
-
|
|
158
|
-
|
|
161
|
+
k as createTranslator,
|
|
162
|
+
M as flagFor,
|
|
159
163
|
v as flattenTranslations,
|
|
160
164
|
T as getAccessKeys,
|
|
161
165
|
l as hasAccess,
|
|
162
166
|
V as icons,
|
|
163
167
|
G as nestTranslations,
|
|
164
|
-
|
|
168
|
+
H as parseTableQuery,
|
|
165
169
|
u as setAccessKeys,
|
|
166
170
|
w as toFormData,
|
|
167
|
-
|
|
171
|
+
Le as toast,
|
|
168
172
|
c as useAccessKeys,
|
|
169
173
|
s as useDisclosure,
|
|
170
174
|
t as useForm,
|
|
@@ -177,9 +181,9 @@ export {
|
|
|
177
181
|
b as useStepQueryKey,
|
|
178
182
|
R as useT,
|
|
179
183
|
_ as useTableQueryConfig,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
+
B as useTabsQueryKey,
|
|
185
|
+
h as useTheme,
|
|
186
|
+
N as useTranslations,
|
|
187
|
+
P as useTranslationsNamespace
|
|
184
188
|
};
|
|
185
189
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations-CXEeeUDL.cjs","sources":["../src/helpers/translations.ts"],"sourcesContent":["import type { LocaleConfig } from '../theme'\n\n/**\n * Translation form helpers — framework-agnostic glue between `<TranslatedFields>`' **flat** field\n * names (`translations[en-US].title` — the `FormData` shape) and the **nested** JSON shape\n * (`{ translations: { 'en-US': { title } } }`). Public from
|
|
1
|
+
{"version":3,"file":"translations-CXEeeUDL.cjs","sources":["../src/helpers/translations.ts"],"sourcesContent":["import type { LocaleConfig } from '../theme'\n\n/**\n * Translation form helpers — framework-agnostic glue between `<TranslatedFields>`' **flat** field\n * names (`translations[en-US].title` — the `FormData` shape) and the **nested** JSON shape\n * (`{ translations: { 'en-US': { title } } }`). Public from `@techzyapp/ui-library/helpers`.\n */\n\n/** The default top-level namespace for the translation field names + the nested object. */\nexport const DEFAULT_TRANSLATIONS_NAMESPACE = 'translations'\n\n/**\n * Builds a field's form name: `<namespace>[<locale>].<field>` (e.g. `translations[en-US].title`) —\n * the flat, bracketed key that maps cleanly to `FormData`. `namespace` defaults to `'translations'`.\n */\nexport const buildTranslationName = (\n locale: string,\n field: string,\n namespace: string = DEFAULT_TRANSLATIONS_NAMESPACE,\n): string => `${namespace}[${locale}].${field}`\n\n/**\n * Expands a per-field map into the flat, locale-namespaced record `<TranslatedFields>` submits — use\n * it to build a `<Form>`'s `defaultValues` **and** (with Zod field schemas as the values) the schema\n * shape. Pass the same `namespace` you give the component if you changed it.\n *\n * ```ts\n * const locales = ['en-US', 'ka-GE']\n * const fields = { title: '', description: '', shortDescription: '' }\n * const defaultValues = buildTranslations(locales, fields)\n * // { 'translations[en-US].title': '', …, 'translations[ka-GE].shortDescription': '' }\n * const schema = z.object(\n * buildTranslations(locales, { title: z.string().min(1), description: z.string(), shortDescription: z.string() }),\n * )\n * ```\n */\nexport function buildTranslations<T>(\n locales: ReadonlyArray<string | LocaleConfig>,\n fields: Record<string, T>,\n namespace: string = DEFAULT_TRANSLATIONS_NAMESPACE,\n): Record<string, T> {\n const out: Record<string, T> = {}\n for (const loc of locales) {\n const code = typeof loc === 'string' ? loc : loc.code\n for (const field of Object.keys(fields)) {\n out[buildTranslationName(code, field, namespace)] = fields[field]\n }\n }\n return out\n}\n\n/** Parse a flat translation key (`<namespace>[<locale>].<field>`) → `{ locale, field }`, or `null`. */\nfunction parseTranslationKey(\n key: string,\n namespace: string,\n): { locale: string; field: string } | null {\n const open = `${namespace}[`\n if (!key.startsWith(open)) return null\n const close = key.indexOf(']', open.length)\n if (close === -1 || key[close + 1] !== '.') return null\n const locale = key.slice(open.length, close)\n const field = key.slice(close + 2)\n return locale && field ? { locale, field } : null\n}\n\n/**\n * Flat form values → the **nested** JSON shape. Translation keys (`translations[en-US].title`) fold\n * into `{ [namespace]: { [locale]: { [field]: value } } }`; every other key stays top-level. Use it at\n * the submit boundary when you POST JSON (rather than `FormData`):\n *\n * ```ts\n * await api.post('/news', nestTranslations(form.values))\n * // { email: 1, translations: { 'en-US': { title: '…' }, 'ka-GE': { title: '…' } } }\n * ```\n */\nexport function nestTranslations(\n flat: Record<string, unknown>,\n namespace: string = DEFAULT_TRANSLATIONS_NAMESPACE,\n): Record<string, unknown> {\n const out: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(flat)) {\n const parsed = parseTranslationKey(key, namespace)\n if (parsed) {\n const bucket = (out[namespace] ??= {}) as Record<string, Record<string, unknown>>\n ;(bucket[parsed.locale] ??= {})[parsed.field] = value\n } else {\n out[key] = value\n }\n }\n return out\n}\n\n/**\n * The inverse of `nestTranslations`: a **nested** object (e.g. a backend response) → the flat values a\n * `<Form>` / `<TranslatedFields>` expects. Feed the result as `defaultValues` (or into `reset`):\n *\n * ```ts\n * const form = useForm({ schema, defaultValues: flattenTranslations(response) })\n * // { email: 1, 'translations[en-US].title': '…', 'translations[ka-GE].title': '…' }\n * ```\n */\nexport function flattenTranslations(\n nested: Record<string, unknown>,\n namespace: string = DEFAULT_TRANSLATIONS_NAMESPACE,\n): Record<string, unknown> {\n const out: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(nested)) {\n if (key === namespace && value && typeof value === 'object' && !Array.isArray(value)) {\n for (const [locale, fields] of Object.entries(value as Record<string, unknown>)) {\n if (fields && typeof fields === 'object') {\n for (const [field, v] of Object.entries(fields as Record<string, unknown>)) {\n out[buildTranslationName(locale, field, namespace)] = v\n }\n }\n }\n } else {\n out[key] = value\n }\n }\n return out\n}\n\n/**\n * Serialize flat form values into a `FormData` for a `multipart/form-data` POST. The flat translation\n * keys map straight through (`translations[en-US].title`); arrays become indexed keys (`tags[0]`,\n * `tags[1]`) with nullish items skipped so indices stay contiguous; `Blob`/`File` values are appended\n * as-is; a `Date` becomes an ISO string; only **plain** objects recurse (a class instance like a dayjs\n * object is stringified, not exploded into `$d`/`$y` keys); `null`/`undefined` are skipped; everything\n * else is stringified.\n *\n * ```ts\n * await fetch('/news', { method: 'POST', body: toFormData(form.values) })\n * ```\n */\nexport function toFormData(values: Record<string, unknown>): FormData {\n const fd = new FormData()\n const append = (key: string, value: unknown): void => {\n if (value === null || value === undefined) return\n if (value instanceof Blob) {\n fd.append(key, value)\n } else if (value instanceof Date) {\n fd.append(key, value.toISOString())\n } else if (Array.isArray(value)) {\n // drop nullish items so indices stay contiguous (gapped indices break strict parsers)\n value\n .filter((item) => item != null)\n .forEach((item, index) => append(`${key}[${index}]`, item))\n } else if (typeof value === 'object') {\n const proto = Object.getPrototypeOf(value)\n if (proto === Object.prototype || proto === null) {\n for (const [k, v] of Object.entries(value as Record<string, unknown>))\n append(`${key}[${k}]`, v)\n } else {\n fd.append(key, String(value)) // class instance (Date handled above) → stringify, don't explode keys\n }\n } else {\n fd.append(key, String(value))\n }\n }\n for (const [key, value] of Object.entries(values)) append(key, value)\n return fd\n}\n"],"names":["DEFAULT_TRANSLATIONS_NAMESPACE","buildTranslationName","locale","field","namespace","buildTranslations","locales","fields","out","loc","code","parseTranslationKey","key","open","close","nestTranslations","flat","value","parsed","bucket","_a","flattenTranslations","nested","v","toFormData","values","fd","append","item","index","proto","k"],"mappings":"aASO,MAAMA,EAAiC,eAMjCC,EAAuB,CAClCC,EACAC,EACAC,EAAoBJ,IACT,GAAGI,CAAS,IAAIF,CAAM,KAAKC,CAAK,GAiBtC,SAASE,EACdC,EACAC,EACAH,EAAoBJ,EACD,CACnB,MAAMQ,EAAyB,CAAA,EAC/B,UAAWC,KAAOH,EAAS,CACzB,MAAMI,EAAO,OAAOD,GAAQ,SAAWA,EAAMA,EAAI,KACjD,UAAWN,KAAS,OAAO,KAAKI,CAAM,EACpCC,EAAIP,EAAqBS,EAAMP,EAAOC,CAAS,CAAC,EAAIG,EAAOJ,CAAK,CAEpE,CACA,OAAOK,CACT,CAGA,SAASG,EACPC,EACAR,EAC0C,CAC1C,MAAMS,EAAO,GAAGT,CAAS,IACzB,GAAI,CAACQ,EAAI,WAAWC,CAAI,EAAG,OAAO,KAClC,MAAMC,EAAQF,EAAI,QAAQ,IAAKC,EAAK,MAAM,EAC1C,GAAIC,IAAU,IAAMF,EAAIE,EAAQ,CAAC,IAAM,IAAK,OAAO,KACnD,MAAMZ,EAASU,EAAI,MAAMC,EAAK,OAAQC,CAAK,EACrCX,EAAQS,EAAI,MAAME,EAAQ,CAAC,EACjC,OAAOZ,GAAUC,EAAQ,CAAE,OAAAD,EAAQ,MAAAC,GAAU,IAC/C,CAYO,SAASY,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AAMa,EAAQ,OAAO,eAAeb,CAAK,EACzC,GAAIa,IAAU,OAAO,WAAaA,IAAU,KAC1C,SAAW,CAACC,EAAGR,CAAC,IAAK,OAAO,QAAQN,CAAgC,EAClEU,EAAO,GAAGf,CAAG,IAAImB,CAAC,IAAKR,CAAC,OAE1BG,EAAG,OAAOd,EAAK,OAAOK,CAAK,CAAC,CAEhC,MACES,EAAG,OAAOd,EAAK,OAAOK,CAAK,CAAC,CAEhC,EACA,SAAW,CAACL,EAAKK,CAAK,IAAK,OAAO,QAAQQ,CAAM,EAAGE,EAAOf,EAAKK,CAAK,EACpE,OAAOS,CACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translations-D15tFHM1.js","sources":["../src/helpers/translations.ts"],"sourcesContent":["import type { LocaleConfig } from '../theme'\n\n/**\n * Translation form helpers — framework-agnostic glue between `<TranslatedFields>`' **flat** field\n * names (`translations[en-US].title` — the `FormData` shape) and the **nested** JSON shape\n * (`{ translations: { 'en-US': { title } } }`). Public from
|
|
1
|
+
{"version":3,"file":"translations-D15tFHM1.js","sources":["../src/helpers/translations.ts"],"sourcesContent":["import type { LocaleConfig } from '../theme'\n\n/**\n * Translation form helpers — framework-agnostic glue between `<TranslatedFields>`' **flat** field\n * names (`translations[en-US].title` — the `FormData` shape) and the **nested** JSON shape\n * (`{ translations: { 'en-US': { title } } }`). Public from `@techzyapp/ui-library/helpers`.\n */\n\n/** The default top-level namespace for the translation field names + the nested object. */\nexport const DEFAULT_TRANSLATIONS_NAMESPACE = 'translations'\n\n/**\n * Builds a field's form name: `<namespace>[<locale>].<field>` (e.g. `translations[en-US].title`) —\n * the flat, bracketed key that maps cleanly to `FormData`. `namespace` defaults to `'translations'`.\n */\nexport const buildTranslationName = (\n locale: string,\n field: string,\n namespace: string = DEFAULT_TRANSLATIONS_NAMESPACE,\n): string => `${namespace}[${locale}].${field}`\n\n/**\n * Expands a per-field map into the flat, locale-namespaced record `<TranslatedFields>` submits — use\n * it to build a `<Form>`'s `defaultValues` **and** (with Zod field schemas as the values) the schema\n * shape. Pass the same `namespace` you give the component if you changed it.\n *\n * ```ts\n * const locales = ['en-US', 'ka-GE']\n * const fields = { title: '', description: '', shortDescription: '' }\n * const defaultValues = buildTranslations(locales, fields)\n * // { 'translations[en-US].title': '', …, 'translations[ka-GE].shortDescription': '' }\n * const schema = z.object(\n * buildTranslations(locales, { title: z.string().min(1), description: z.string(), shortDescription: z.string() }),\n * )\n * ```\n */\nexport function buildTranslations<T>(\n locales: ReadonlyArray<string | LocaleConfig>,\n fields: Record<string, T>,\n namespace: string = DEFAULT_TRANSLATIONS_NAMESPACE,\n): Record<string, T> {\n const out: Record<string, T> = {}\n for (const loc of locales) {\n const code = typeof loc === 'string' ? loc : loc.code\n for (const field of Object.keys(fields)) {\n out[buildTranslationName(code, field, namespace)] = fields[field]\n }\n }\n return out\n}\n\n/** Parse a flat translation key (`<namespace>[<locale>].<field>`) → `{ locale, field }`, or `null`. */\nfunction parseTranslationKey(\n key: string,\n namespace: string,\n): { locale: string; field: string } | null {\n const open = `${namespace}[`\n if (!key.startsWith(open)) return null\n const close = key.indexOf(']', open.length)\n if (close === -1 || key[close + 1] !== '.') return null\n const locale = key.slice(open.length, close)\n const field = key.slice(close + 2)\n return locale && field ? { locale, field } : null\n}\n\n/**\n * Flat form values → the **nested** JSON shape. Translation keys (`translations[en-US].title`) fold\n * into `{ [namespace]: { [locale]: { [field]: value } } }`; every other key stays top-level. Use it at\n * the submit boundary when you POST JSON (rather than `FormData`):\n *\n * ```ts\n * await api.post('/news', nestTranslations(form.values))\n * // { email: 1, translations: { 'en-US': { title: '…' }, 'ka-GE': { title: '…' } } }\n * ```\n */\nexport function nestTranslations(\n flat: Record<string, unknown>,\n namespace: string = DEFAULT_TRANSLATIONS_NAMESPACE,\n): Record<string, unknown> {\n const out: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(flat)) {\n const parsed = parseTranslationKey(key, namespace)\n if (parsed) {\n const bucket = (out[namespace] ??= {}) as Record<string, Record<string, unknown>>\n ;(bucket[parsed.locale] ??= {})[parsed.field] = value\n } else {\n out[key] = value\n }\n }\n return out\n}\n\n/**\n * The inverse of `nestTranslations`: a **nested** object (e.g. a backend response) → the flat values a\n * `<Form>` / `<TranslatedFields>` expects. Feed the result as `defaultValues` (or into `reset`):\n *\n * ```ts\n * const form = useForm({ schema, defaultValues: flattenTranslations(response) })\n * // { email: 1, 'translations[en-US].title': '…', 'translations[ka-GE].title': '…' }\n * ```\n */\nexport function flattenTranslations(\n nested: Record<string, unknown>,\n namespace: string = DEFAULT_TRANSLATIONS_NAMESPACE,\n): Record<string, unknown> {\n const out: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(nested)) {\n if (key === namespace && value && typeof value === 'object' && !Array.isArray(value)) {\n for (const [locale, fields] of Object.entries(value as Record<string, unknown>)) {\n if (fields && typeof fields === 'object') {\n for (const [field, v] of Object.entries(fields as Record<string, unknown>)) {\n out[buildTranslationName(locale, field, namespace)] = v\n }\n }\n }\n } else {\n out[key] = value\n }\n }\n return out\n}\n\n/**\n * Serialize flat form values into a `FormData` for a `multipart/form-data` POST. The flat translation\n * keys map straight through (`translations[en-US].title`); arrays become indexed keys (`tags[0]`,\n * `tags[1]`) with nullish items skipped so indices stay contiguous; `Blob`/`File` values are appended\n * as-is; a `Date` becomes an ISO string; only **plain** objects recurse (a class instance like a dayjs\n * object is stringified, not exploded into `$d`/`$y` keys); `null`/`undefined` are skipped; everything\n * else is stringified.\n *\n * ```ts\n * await fetch('/news', { method: 'POST', body: toFormData(form.values) })\n * ```\n */\nexport function toFormData(values: Record<string, unknown>): FormData {\n const fd = new FormData()\n const append = (key: string, value: unknown): void => {\n if (value === null || value === undefined) return\n if (value instanceof Blob) {\n fd.append(key, value)\n } else if (value instanceof Date) {\n fd.append(key, value.toISOString())\n } else if (Array.isArray(value)) {\n // drop nullish items so indices stay contiguous (gapped indices break strict parsers)\n value\n .filter((item) => item != null)\n .forEach((item, index) => append(`${key}[${index}]`, item))\n } else if (typeof value === 'object') {\n const proto = Object.getPrototypeOf(value)\n if (proto === Object.prototype || proto === null) {\n for (const [k, v] of Object.entries(value as Record<string, unknown>))\n append(`${key}[${k}]`, v)\n } else {\n fd.append(key, String(value)) // class instance (Date handled above) → stringify, don't explode keys\n }\n } else {\n fd.append(key, String(value))\n }\n }\n for (const [key, value] of Object.entries(values)) append(key, value)\n return fd\n}\n"],"names":["DEFAULT_TRANSLATIONS_NAMESPACE","buildTranslationName","locale","field","namespace","buildTranslations","locales","fields","out","loc","code","parseTranslationKey","key","open","close","nestTranslations","flat","_a","value","parsed","bucket","flattenTranslations","nested","v","toFormData","values","fd","append","item","index","proto","k"],"mappings":"AASO,MAAMA,IAAiC,gBAMjCC,IAAuB,CAClCC,GACAC,GACAC,IAAoBJ,MACT,GAAGI,CAAS,IAAIF,CAAM,KAAKC,CAAK;AAiBtC,SAASE,EACdC,GACAC,GACAH,IAAoBJ,GACD;AACnB,QAAMQ,IAAyB,CAAA;AAC/B,aAAWC,KAAOH,GAAS;AACzB,UAAMI,IAAO,OAAOD,KAAQ,WAAWA,IAAMA,EAAI;AACjD,eAAWN,KAAS,OAAO,KAAKI,CAAM;AACpC,MAAAC,EAAIP,EAAqBS,GAAMP,GAAOC,CAAS,CAAC,IAAIG,EAAOJ,CAAK;AAAA,EAEpE;AACA,SAAOK;AACT;AAGA,SAASG,EACPC,GACAR,GAC0C;AAC1C,QAAMS,IAAO,GAAGT,CAAS;AACzB,MAAI,CAACQ,EAAI,WAAWC,CAAI,EAAG,QAAO;AAClC,QAAMC,IAAQF,EAAI,QAAQ,KAAKC,EAAK,MAAM;AAC1C,MAAIC,MAAU,MAAMF,EAAIE,IAAQ,CAAC,MAAM,IAAK,QAAO;AACnD,QAAMZ,IAASU,EAAI,MAAMC,EAAK,QAAQC,CAAK,GACrCX,IAAQS,EAAI,MAAME,IAAQ,CAAC;AACjC,SAAOZ,KAAUC,IAAQ,EAAE,QAAAD,GAAQ,OAAAC,M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AQ,IAAI,EAC7B,QAAQ,CAACA,GAAMC,MAAUF,EAAO,GAAGf,CAAG,IAAIiB,CAAK,KAAKD,CAAI,CAAC;AAAA,eACnD,OAAOV,KAAU,UAAU;AACpC,cAAMY,IAAQ,OAAO,eAAeZ,CAAK;AACzC,YAAIY,MAAU,OAAO,aAAaA,MAAU;AAC1C,qBAAW,CAACC,GAAGR,CAAC,KAAK,OAAO,QAAQL,CAAgC;AAClE,YAAAS,EAAO,GAAGf,CAAG,IAAImB,CAAC,KAAKR,CAAC;AAAA;AAE1B,UAAAG,EAAG,OAAOd,GAAK,OAAOM,CAAK,CAAC;AAAA,MAEhC;AACE,QAAAQ,EAAG,OAAOd,GAAK,OAAOM,CAAK,CAAC;AAAA,EAEhC;AACA,aAAW,CAACN,GAAKM,CAAK,KAAK,OAAO,QAAQO,CAAM,EAAG,CAAAE,EAAOf,GAAKM,CAAK;AACpE,SAAOQ;AACT;"}
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";var T=Object.create;var f=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var E=(o,e,c,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of k(e))!S.call(o,l)&&l!==c&&f(o,l,{get:()=>e[l],enumerable:!(s=g(e,l))||s.enumerable});return o};var z=(o,e,c)=>(c=o!=null?T(I(o)):{},E(e||!o||!o.__esModule?f(c,"default",{value:o,enumerable:!0}):c,o));const n=require("react/jsx-runtime"),i=require("react"),C=require("clsx"),F=require("./IconButton-D6TenQZ_.cjs"),R=require("./Icon-CXTl_QAP.cjs"),M=require("./Tooltip-Ao7az09p.cjs"),P=require("./ConfigProvider-ByOFXVyP.cjs"),D="_root_3qnqi_4",H="_header_3qnqi_15",L="_title_3qnqi_24",O="_code_3qnqi_34",A="_plain_3qnqi_50",G="_padForCopy_3qnqi_56",J="_wrap_3qnqi_61",K="_lineNumbers_3qnqi_67",Q="_copy_3qnqi_82",U="_floatingCopy_3qnqi_88",t={root:D,header:H,title:L,code:O,plain:A,padForCopy:G,wrap:J,lineNumbers:K,copy:Q,floatingCopy:U},V=1600,W=i.forwardRef(function({code:e,language:c="tsx",title:s,copyable:l=!0,showLineNumbers:x=!1,maxHeight:q,wrap:j=!1,className:w,style:N,...b},v){const a=P.useT(),[h,m]=i.useState(null),[d,y]=i.useState(!1),p=i.useRef(void 0);i.useEffect(()=>{let r=!1;return import("shiki").then(({codeToHtml:_})=>_(e,{lang:c,theme:"dark-plus"})).then(_=>{r||m(_)}).catch(()=>{r||m(null)}),()=>{r=!0}},[e,c]),i.useEffect(()=>()=>window.clearTimeout(p.current),[]);const B=()=>{var r;(r=navigator.clipboard)==null||r.writeText(e).then(()=>{y(!0),window.clearTimeout(p.current),p.current=window.setTimeout(()=>y(!1),V)}).catch(()=>{})},u=l&&n.jsx(M.Tooltip,{content:a(d?"codeBlock.copied":"codeBlock.copy"),placement:"left",style:{"--tz-btn-rgb":"255, 255, 255","--tz-btn-on":"#1e1e1e"},children:n.jsx(F.IconButton,{variant:"text",size:"sm",className:t.copy,style:{"--tz-btn-rgb":"255, 255, 255"},"aria-label":a(d?"codeBlock.copied":"codeBlock.copy"),onClick:B,children:n.jsx(R.Icon,{name:d?"CopySuccess":"Copy"})})});return n.jsxs("div",{ref:v,className:C.clsx(t.root,w),style:N,...b,children:[s!=null&&n.jsxs("div",{className:t.header,children:[n.jsx("span",{className:t.title,children:s}),u]}),n.jsx("div",{className:C.clsx(t.code,j&&t.wrap,x&&t.lineNumbers,s==null&&t.padForCopy),style:q!=null?{maxHeight:q}:void 0,children:h!=null?n.jsx("div",{className:t.highlighted,dangerouslySetInnerHTML:{__html:h}}):n.jsx("pre",{className:t.plain,children:n.jsx("code",{children:e})})}),s==null&&u&&n.jsx("div",{className:t.floatingCopy,children:u})]})});exports.CodeBlock=W;
|
|
2
|
-
//# sourceMappingURL=CodeBlock-DOk5wekc.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlock-DOk5wekc.cjs","sources":["../src/components/CodeBlock/CodeBlock.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { IconButton } from '../IconButton'\nimport { Icon } from '../Icon'\nimport { Tooltip } from '../Tooltip'\nimport styles from './CodeBlock.module.css'\n\n// how long the copy button shows the \"copied\" tick before reverting\nconst COPIED_RESET_MS = 1600\n\nexport interface CodeBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'title'> {\n /** The source code to render. */\n code: string\n /** Shiki language id (`'tsx'`, `'json'`, `'bash'`, `'css'`, …). Defaults to `'tsx'`. */\n language?: string\n /** Header line (e.g. a filename) — adds a header bar above the code with the copy button in it. */\n title?: ReactNode\n /** Show a copy-to-clipboard button. Defaults to `true`. */\n copyable?: boolean\n /** Show line numbers. Defaults to `false`. */\n showLineNumbers?: boolean\n /** Cap the block height in px — taller code scrolls inside. */\n maxHeight?: number\n /** Soft-wrap long lines instead of scrolling horizontally. Defaults to `false`. */\n wrap?: boolean\n}\n\n/**\n * A syntax-highlighted code block with **VS Code colors** — powered by **Shiki** (an optional peer,\n * `npm i shiki`), the actual VS Code highlighting engine, using its **`dark-plus`** theme. The block\n * is **always dark** (in both app modes) — code reads best on a dark surface, and the deep background\n * anchors it regardless of the surrounding light/dark theme. Highlighting is **async and lazy**\n * (`import('shiki')` on first render); until it lands — or if `shiki` isn't installed / the language\n * is unknown — the block shows the plain code (on the same dark surface), so nothing breaks. `title`\n * adds a header bar (e.g. a filename); `copyable` (default `true`) shows a copy button that flips to a\n * tick; `showLineNumbers`, `maxHeight` (scrolls inside) and `wrap` shape the body. The whole block\n * keeps VS Code's own dark colors (a deliberate literal-color exception, like the Modal scrim); only\n * the outer border/radius uses `--tz-*` tokens.\n */\nexport const CodeBlock = forwardRef<HTMLDivElement, CodeBlockProps>(function CodeBlock(\n {\n code,\n language = 'tsx',\n title,\n copyable = true,\n showLineNumbers = false,\n maxHeight,\n wrap = false,\n className,\n style,\n ...props\n },\n ref,\n) {\n const t = useT()\n const [html, setHtml] = useState<string | null>(null)\n const [copied, setCopied] = useState(false)\n const copyTimer = useRef<number | undefined>(undefined)\n\n // highlight asynchronously — shiki is an optional peer, loaded lazily on first use; a missing\n // package or an unknown language just leaves the plain (unhighlighted) fallback in place\n useEffect(() => {\n let cancelled = false\n import('shiki')\n .then(({ codeToHtml }) =>\n codeToHtml(code, {\n lang: language,\n // always VS Code's dark theme — the block stays dark in both app modes\n theme: 'dark-plus',\n }),\n )\n .then((out) => {\n if (!cancelled) setHtml(out)\n })\n .catch(() => {\n if (!cancelled) setHtml(null)\n })\n return () => {\n cancelled = true\n }\n }, [code, language])\n\n useEffect(() => () => window.clearTimeout(copyTimer.current), [])\n\n const handleCopy = () => {\n navigator.clipboard\n ?.writeText(code)\n .then(() => {\n setCopied(true)\n window.clearTimeout(copyTimer.current)\n copyTimer.current = window.setTimeout(() => setCopied(false), COPIED_RESET_MS)\n })\n .catch(() => {})\n }\n\n const copyButton = copyable && (\n // the tooltip is hover/focus-driven; clicking flips `copied`, so its content updates to \"Copied!\"\n // while it's still open (the pointer is on the button). `left` keeps it inside the block's\n // `overflow: hidden` bounds.\n <Tooltip\n content={copied ? t('codeBlock.copied') : t('codeBlock.copy')}\n placement=\"left\"\n // always a white pill with dark text over the (always-dark) block — set via `style` so it beats\n // Tooltip's own color-derived --tz-btn-rgb (which is spread before the consumer `style`)\n style={{ '--tz-btn-rgb': '255, 255, 255', '--tz-btn-on': '#1e1e1e' } as CSSProperties}\n >\n <IconButton\n variant=\"text\"\n size=\"sm\"\n className={styles.copy}\n // force the button light over the dark surface — passed via `style` so it beats IconButton's\n // own inline `--tz-btn-rgb` (which is spread before the consumer `style`, so this wins)\n style={{ '--tz-btn-rgb': '255, 255, 255' } as CSSProperties}\n aria-label={copied ? t('codeBlock.copied') : t('codeBlock.copy')}\n onClick={handleCopy}\n >\n <Icon name={copied ? 'CopySuccess' : 'Copy'} />\n </IconButton>\n </Tooltip>\n )\n\n return (\n <div ref={ref} className={clsx(styles.root, className)} style={style} {...props}>\n {title != null && (\n <div className={styles.header}>\n <span className={styles.title}>{title}</span>\n {copyButton}\n </div>\n )}\n <div\n className={clsx(\n styles.code,\n wrap && styles.wrap,\n showLineNumbers && styles.lineNumbers,\n title == null && styles.padForCopy,\n )}\n style={maxHeight != null ? ({ maxHeight } as CSSProperties) : undefined}\n >\n {html != null ? (\n // shiki output is trusted markup — it escapes the source code itself\n <div className={styles.highlighted} dangerouslySetInnerHTML={{ __html: html }} />\n ) : (\n <pre className={styles.plain}>\n <code>{code}</code>\n </pre>\n )}\n </div>\n {/* with no header the copy button floats over the code's top-right corner */}\n {title == null && copyButton && <div className={styles.floatingCopy}>{copyButton}</div>}\n </div>\n )\n})\n"],"names":["COPIED_RESET_MS","CodeBlock","forwardRef","code","language","title","copyable","showLineNumbers","maxHeight","wrap","className","style","props","ref","t","useT","html","setHtml","useState","copied","setCopied","copyTimer","useRef","useEffect","cancelled","codeToHtml","out","handleCopy","_a","copyButton","jsx","Tooltip","IconButton","styles","Icon","jsxs","clsx"],"mappings":"k/BAiBMA,EAAkB,KA+BXC,EAAYC,EAAAA,WAA2C,SAClE,CACE,KAAAC,EACA,SAAAC,EAAW,MACX,MAAAC,EACA,SAAAC,EAAW,GACX,gBAAAC,EAAkB,GAClB,UAAAC,EACA,KAAAC,EAAO,GACP,UAAAC,EACA,MAAAC,EACA,GAAGC,CACL,EACAC,EACA,CACA,MAAMC,EAAIC,EAAAA,KAAA,EACJ,CAACC,EAAMC,CAAO,EAAIC,EAAAA,SAAwB,IAAI,EAC9C,CAACC,EAAQC,CAAS,EAAIF,EAAAA,SAAS,EAAK,EACpCG,EAAYC,EAAAA,OAA2B,MAAS,EAItDC,EAAAA,UAAU,IA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UAAWF,EAAO,OACrB,SAAA,CAAAH,EAAAA,IAAC,OAAA,CAAK,UAAWG,EAAO,MAAQ,SAAA5B,EAAM,EACrCwB,CAAA,EACH,EAEFC,EAAAA,IAAC,MAAA,CACC,UAAWM,EAAAA,KACTH,EAAO,KACPxB,GAAQwB,EAAO,KACf1B,GAAmB0B,EAAO,YAC1B5B,GAAS,MAAQ4B,EAAO,UAAA,EAE1B,MAAOzB,GAAa,KAAQ,CAAE,UAAAA,GAAgC,OAE7D,SAAAQ,GAAQ,KAEPc,MAAC,OAAI,UAAWG,EAAO,YAAa,wBAAyB,CAAE,OAAQjB,EAAK,CAAG,EAE/Ec,EAAAA,IAAC,OAAI,UAAWG,EAAO,MACrB,SAAAH,EAAAA,IAAC,OAAA,CAAM,WAAK,CAAA,CACd,CAAA,CAAA,EAIHzB,GAAS,MAAQwB,GAAcC,EAAAA,IAAC,OAAI,UAAWG,EAAO,aAAe,SAAAJ,CAAA,CAAW,CAAA,EACnF,CAEJ,CAAC"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as f } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as B, useState as h, useRef as x, useEffect as y } from "react";
|
|
3
|
-
import { clsx as q } from "clsx";
|
|
4
|
-
import { I } from "./IconButton-CBusrDa9.js";
|
|
5
|
-
import { I as S } from "./Icon-CophpkHo.js";
|
|
6
|
-
import { T as z } from "./Tooltip-Cb_FKxT9.js";
|
|
7
|
-
import { a as E } from "./ConfigProvider-2c94kUOk.js";
|
|
8
|
-
const F = "_root_3qnqi_4", R = "_header_3qnqi_15", j = "_title_3qnqi_24", M = "_code_3qnqi_34", D = "_plain_3qnqi_50", H = "_padForCopy_3qnqi_56", L = "_wrap_3qnqi_61", O = "_lineNumbers_3qnqi_67", P = "_copy_3qnqi_82", A = "_floatingCopy_3qnqi_88", o = {
|
|
9
|
-
root: F,
|
|
10
|
-
header: R,
|
|
11
|
-
title: j,
|
|
12
|
-
code: M,
|
|
13
|
-
plain: D,
|
|
14
|
-
padForCopy: H,
|
|
15
|
-
wrap: L,
|
|
16
|
-
lineNumbers: O,
|
|
17
|
-
copy: P,
|
|
18
|
-
floatingCopy: A
|
|
19
|
-
}, G = 1600, Z = B(function({
|
|
20
|
-
code: n,
|
|
21
|
-
language: p = "tsx",
|
|
22
|
-
title: c,
|
|
23
|
-
copyable: C = !0,
|
|
24
|
-
showLineNumbers: w = !1,
|
|
25
|
-
maxHeight: d,
|
|
26
|
-
wrap: N = !1,
|
|
27
|
-
className: b,
|
|
28
|
-
style: T,
|
|
29
|
-
...v
|
|
30
|
-
}, g) {
|
|
31
|
-
const l = E(), [m, _] = h(null), [r, u] = h(!1), s = x(void 0);
|
|
32
|
-
y(() => {
|
|
33
|
-
let t = !1;
|
|
34
|
-
return import("shiki").then(
|
|
35
|
-
({ codeToHtml: a }) => a(n, {
|
|
36
|
-
lang: p,
|
|
37
|
-
// always VS Code's dark theme — the block stays dark in both app modes
|
|
38
|
-
theme: "dark-plus"
|
|
39
|
-
})
|
|
40
|
-
).then((a) => {
|
|
41
|
-
t || _(a);
|
|
42
|
-
}).catch(() => {
|
|
43
|
-
t || _(null);
|
|
44
|
-
}), () => {
|
|
45
|
-
t = !0;
|
|
46
|
-
};
|
|
47
|
-
}, [n, p]), y(() => () => window.clearTimeout(s.current), []);
|
|
48
|
-
const k = () => {
|
|
49
|
-
var t;
|
|
50
|
-
(t = navigator.clipboard) == null || t.writeText(n).then(() => {
|
|
51
|
-
u(!0), window.clearTimeout(s.current), s.current = window.setTimeout(() => u(!1), G);
|
|
52
|
-
}).catch(() => {
|
|
53
|
-
});
|
|
54
|
-
}, i = C && // the tooltip is hover/focus-driven; clicking flips `copied`, so its content updates to "Copied!"
|
|
55
|
-
// while it's still open (the pointer is on the button). `left` keeps it inside the block's
|
|
56
|
-
// `overflow: hidden` bounds.
|
|
57
|
-
/* @__PURE__ */ e(
|
|
58
|
-
z,
|
|
59
|
-
{
|
|
60
|
-
content: l(r ? "codeBlock.copied" : "codeBlock.copy"),
|
|
61
|
-
placement: "left",
|
|
62
|
-
style: { "--tz-btn-rgb": "255, 255, 255", "--tz-btn-on": "#1e1e1e" },
|
|
63
|
-
children: /* @__PURE__ */ e(
|
|
64
|
-
I,
|
|
65
|
-
{
|
|
66
|
-
variant: "text",
|
|
67
|
-
size: "sm",
|
|
68
|
-
className: o.copy,
|
|
69
|
-
style: { "--tz-btn-rgb": "255, 255, 255" },
|
|
70
|
-
"aria-label": l(r ? "codeBlock.copied" : "codeBlock.copy"),
|
|
71
|
-
onClick: k,
|
|
72
|
-
children: /* @__PURE__ */ e(S, { name: r ? "CopySuccess" : "Copy" })
|
|
73
|
-
}
|
|
74
|
-
)
|
|
75
|
-
}
|
|
76
|
-
);
|
|
77
|
-
return /* @__PURE__ */ f("div", { ref: g, className: q(o.root, b), style: T, ...v, children: [
|
|
78
|
-
c != null && /* @__PURE__ */ f("div", { className: o.header, children: [
|
|
79
|
-
/* @__PURE__ */ e("span", { className: o.title, children: c }),
|
|
80
|
-
i
|
|
81
|
-
] }),
|
|
82
|
-
/* @__PURE__ */ e(
|
|
83
|
-
"div",
|
|
84
|
-
{
|
|
85
|
-
className: q(
|
|
86
|
-
o.code,
|
|
87
|
-
N && o.wrap,
|
|
88
|
-
w && o.lineNumbers,
|
|
89
|
-
c == null && o.padForCopy
|
|
90
|
-
),
|
|
91
|
-
style: d != null ? { maxHeight: d } : void 0,
|
|
92
|
-
children: m != null ? (
|
|
93
|
-
// shiki output is trusted markup — it escapes the source code itself
|
|
94
|
-
/* @__PURE__ */ e("div", { className: o.highlighted, dangerouslySetInnerHTML: { __html: m } })
|
|
95
|
-
) : /* @__PURE__ */ e("pre", { className: o.plain, children: /* @__PURE__ */ e("code", { children: n }) })
|
|
96
|
-
}
|
|
97
|
-
),
|
|
98
|
-
c == null && i && /* @__PURE__ */ e("div", { className: o.floatingCopy, children: i })
|
|
99
|
-
] });
|
|
100
|
-
});
|
|
101
|
-
export {
|
|
102
|
-
Z as C
|
|
103
|
-
};
|
|
104
|
-
//# sourceMappingURL=CodeBlock-n3KExtTO.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlock-n3KExtTO.js","sources":["../src/components/CodeBlock/CodeBlock.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { IconButton } from '../IconButton'\nimport { Icon } from '../Icon'\nimport { Tooltip } from '../Tooltip'\nimport styles from './CodeBlock.module.css'\n\n// how long the copy button shows the \"copied\" tick before reverting\nconst COPIED_RESET_MS = 1600\n\nexport interface CodeBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'title'> {\n /** The source code to render. */\n code: string\n /** Shiki language id (`'tsx'`, `'json'`, `'bash'`, `'css'`, …). Defaults to `'tsx'`. */\n language?: string\n /** Header line (e.g. a filename) — adds a header bar above the code with the copy button in it. */\n title?: ReactNode\n /** Show a copy-to-clipboard button. Defaults to `true`. */\n copyable?: boolean\n /** Show line numbers. Defaults to `false`. */\n showLineNumbers?: boolean\n /** Cap the block height in px — taller code scrolls inside. */\n maxHeight?: number\n /** Soft-wrap long lines instead of scrolling horizontally. Defaults to `false`. */\n wrap?: boolean\n}\n\n/**\n * A syntax-highlighted code block with **VS Code colors** — powered by **Shiki** (an optional peer,\n * `npm i shiki`), the actual VS Code highlighting engine, using its **`dark-plus`** theme. The block\n * is **always dark** (in both app modes) — code reads best on a dark surface, and the deep background\n * anchors it regardless of the surrounding light/dark theme. Highlighting is **async and lazy**\n * (`import('shiki')` on first render); until it lands — or if `shiki` isn't installed / the language\n * is unknown — the block shows the plain code (on the same dark surface), so nothing breaks. `title`\n * adds a header bar (e.g. a filename); `copyable` (default `true`) shows a copy button that flips to a\n * tick; `showLineNumbers`, `maxHeight` (scrolls inside) and `wrap` shape the body. The whole block\n * keeps VS Code's own dark colors (a deliberate literal-color exception, like the Modal scrim); only\n * the outer border/radius uses `--tz-*` tokens.\n */\nexport const CodeBlock = forwardRef<HTMLDivElement, CodeBlockProps>(function CodeBlock(\n {\n code,\n language = 'tsx',\n title,\n copyable = true,\n showLineNumbers = false,\n maxHeight,\n wrap = false,\n className,\n style,\n ...props\n },\n ref,\n) {\n const t = useT()\n const [html, setHtml] = useState<string | null>(null)\n const [copied, setCopied] = useState(false)\n const copyTimer = useRef<number | undefined>(undefined)\n\n // highlight asynchronously — shiki is an optional peer, loaded lazily on first use; a missing\n // package or an unknown language just leaves the plain (unhighlighted) fallback in place\n useEffect(() => {\n let cancelled = false\n import('shiki')\n .then(({ codeToHtml }) =>\n codeToHtml(code, {\n lang: language,\n // always VS Code's dark theme — the block stays dark in both app modes\n theme: 'dark-plus',\n }),\n )\n .then((out) => {\n if (!cancelled) setHtml(out)\n })\n .catch(() => {\n if (!cancelled) setHtml(null)\n })\n return () => {\n cancelled = true\n }\n }, [code, language])\n\n useEffect(() => () => window.clearTimeout(copyTimer.current), [])\n\n const handleCopy = () => {\n navigator.clipboard\n ?.writeText(code)\n .then(() => {\n setCopied(true)\n window.clearTimeout(copyTimer.current)\n copyTimer.current = window.setTimeout(() => setCopied(false), COPIED_RESET_MS)\n })\n .catch(() => {})\n }\n\n const copyButton = copyable && (\n // the tooltip is hover/focus-driven; clicking flips `copied`, so its content updates to \"Copied!\"\n // while it's still open (the pointer is on the button). `left` keeps it inside the block's\n // `overflow: hidden` bounds.\n <Tooltip\n content={copied ? t('codeBlock.copied') : t('codeBlock.copy')}\n placement=\"left\"\n // always a white pill with dark text over the (always-dark) block — set via `style` so it beats\n // Tooltip's own color-derived --tz-btn-rgb (which is spread before the consumer `style`)\n style={{ '--tz-btn-rgb': '255, 255, 255', '--tz-btn-on': '#1e1e1e' } as CSSProperties}\n >\n <IconButton\n variant=\"text\"\n size=\"sm\"\n className={styles.copy}\n // force the button light over the dark surface — passed via `style` so it beats IconButton's\n // own inline `--tz-btn-rgb` (which is spread before the consumer `style`, so this wins)\n style={{ '--tz-btn-rgb': '255, 255, 255' } as CSSProperties}\n aria-label={copied ? t('codeBlock.copied') : t('codeBlock.copy')}\n onClick={handleCopy}\n >\n <Icon name={copied ? 'CopySuccess' : 'Copy'} />\n </IconButton>\n </Tooltip>\n )\n\n return (\n <div ref={ref} className={clsx(styles.root, className)} style={style} {...props}>\n {title != null && (\n <div className={styles.header}>\n <span className={styles.title}>{title}</span>\n {copyButton}\n </div>\n )}\n <div\n className={clsx(\n styles.code,\n wrap && styles.wrap,\n showLineNumbers && styles.lineNumbers,\n title == null && styles.padForCopy,\n )}\n style={maxHeight != null ? ({ maxHeight } as CSSProperties) : undefined}\n >\n {html != null ? (\n // shiki output is trusted markup — it escapes the source code itself\n <div className={styles.highlighted} dangerouslySetInnerHTML={{ __html: html }} />\n ) : (\n <pre className={styles.plain}>\n <code>{code}</code>\n </pre>\n )}\n </div>\n {/* with no header the copy button floats over the code's top-right corner */}\n {title == null && copyButton && <div className={styles.floatingCopy}>{copyButton}</div>}\n </div>\n )\n})\n"],"names":["COPIED_RESET_MS","CodeBlock","forwardRef","code","language","title","copyable","showLineNumbers","maxHeight","wrap","className","style","props","ref","t","useT","html","setHtml","useState","copied","setCopied","copyTimer","useRef","useEffect","cancelled","codeToHtml","out","handleCopy","_a","copyButton","jsx","Tooltip","IconButton","styles","Icon","jsxs","clsx"],"mappings":";;;;;;;;;;;;;;;;;;GAiBMA,IAAkB,MA+BXC,IAAYC,EAA2C,SAClE;AAAA,EACE,MAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,OAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,iBAAAC,IAAkB;AAAA,EAClB,WAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAMC,IAAIC,EAAA,GACJ,CAACC,GAAMC,CAAO,IAAIC,EAAwB,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