@stll/folio-react 0.7.0 → 0.8.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.
@@ -1,344 +0,0 @@
1
- import { t as __exportAll } from "./rolldown-runtime-BBjsoOtd.js";
2
- import { r as useFolioUI } from "./folio-ui-C-85DSuK.js";
3
- import { u as useCloseOnDialogOpenChange } from "./dialogChrome-BoGYPgeu.js";
4
- import { c } from "react-compiler-runtime";
5
- import { useEffect, useId, useState } from "react";
6
- import { jsx, jsxs } from "react/jsx-runtime";
7
- //#region src/components/dialogs/TablePropertiesDialog.tsx
8
- /**
9
- * Table Properties Dialog — width type, width value, alignment.
10
- */
11
- var TablePropertiesDialog_exports = /* @__PURE__ */ __exportAll({ TablePropertiesDialog: () => TablePropertiesDialog });
12
- function TablePropertiesDialog(t0) {
13
- const $ = c(75);
14
- const { isOpen, onClose, onApply, currentProps } = t0;
15
- const { Root: Dialog, Portal: DialogPortal, Backdrop: DialogBackdrop, Popup: DialogPopup, Title: DialogTitle, Close: DialogClose } = useFolioUI().Dialog;
16
- const handleOpenChange = useCloseOnDialogOpenChange(onClose);
17
- const id = useId();
18
- const [width, setWidth] = useState(currentProps?.width ?? 0);
19
- const [widthType, setWidthType] = useState(currentProps?.widthType ?? "auto");
20
- const [justification, setJustification] = useState(currentProps?.justification ?? "left");
21
- let t1;
22
- if ($[0] !== currentProps?.justification || $[1] !== currentProps?.width || $[2] !== currentProps?.widthType || $[3] !== isOpen) {
23
- t1 = () => {
24
- if (isOpen) {
25
- setWidth(currentProps?.width ?? 0);
26
- setWidthType(currentProps?.widthType ?? "auto");
27
- setJustification(currentProps?.justification ?? "left");
28
- }
29
- };
30
- $[0] = currentProps?.justification;
31
- $[1] = currentProps?.width;
32
- $[2] = currentProps?.widthType;
33
- $[3] = isOpen;
34
- $[4] = t1;
35
- } else t1 = $[4];
36
- let t2;
37
- if ($[5] !== currentProps || $[6] !== isOpen) {
38
- t2 = [isOpen, currentProps];
39
- $[5] = currentProps;
40
- $[6] = isOpen;
41
- $[7] = t2;
42
- } else t2 = $[7];
43
- useEffect(t1, t2);
44
- let t3;
45
- if ($[8] !== justification || $[9] !== onApply || $[10] !== onClose || $[11] !== width || $[12] !== widthType) {
46
- t3 = () => {
47
- const props = { justification: justification === "left" || justification === "center" || justification === "right" ? justification : "left" };
48
- if (widthType === "auto") {
49
- props.width = null;
50
- props.widthType = "auto";
51
- } else {
52
- props.width = width;
53
- props.widthType = widthType;
54
- }
55
- onApply(props);
56
- onClose();
57
- };
58
- $[8] = justification;
59
- $[9] = onApply;
60
- $[10] = onClose;
61
- $[11] = width;
62
- $[12] = widthType;
63
- $[13] = t3;
64
- } else t3 = $[13];
65
- const handleApply = t3;
66
- const t4 = `${id}-tp-width-type`;
67
- const t5 = `${id}-tp-width`;
68
- const t6 = `${id}-tp-align`;
69
- let t7;
70
- if ($[14] !== t4 || $[15] !== t5 || $[16] !== t6) {
71
- t7 = {
72
- widthType: t4,
73
- width: t5,
74
- align: t6
75
- };
76
- $[14] = t4;
77
- $[15] = t5;
78
- $[16] = t6;
79
- $[17] = t7;
80
- } else t7 = $[17];
81
- const fieldIds = t7;
82
- let t8;
83
- if ($[18] !== DialogBackdrop) {
84
- t8 = /* @__PURE__ */ jsx(DialogBackdrop, { className: "fixed inset-0 z-[10000] bg-black/50" });
85
- $[18] = DialogBackdrop;
86
- $[19] = t8;
87
- } else t8 = $[19];
88
- let t9;
89
- if ($[20] !== DialogTitle) {
90
- t9 = /* @__PURE__ */ jsx(DialogTitle, {
91
- className: "border-b px-5 py-3 text-base font-semibold",
92
- children: "Table Properties"
93
- });
94
- $[20] = DialogTitle;
95
- $[21] = t9;
96
- } else t9 = $[21];
97
- let t10;
98
- if ($[22] !== fieldIds.widthType) {
99
- t10 = /* @__PURE__ */ jsx("label", {
100
- className: "w-20 text-muted-foreground text-[13px]",
101
- htmlFor: fieldIds.widthType,
102
- children: "Width type"
103
- });
104
- $[22] = fieldIds.widthType;
105
- $[23] = t10;
106
- } else t10 = $[23];
107
- let t11;
108
- if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
109
- t11 = (e) => setWidthType(e.target.value);
110
- $[24] = t11;
111
- } else t11 = $[24];
112
- let t12;
113
- let t13;
114
- let t14;
115
- if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
116
- t12 = /* @__PURE__ */ jsx("option", {
117
- value: "auto",
118
- children: "Auto"
119
- });
120
- t13 = /* @__PURE__ */ jsx("option", {
121
- value: "dxa",
122
- children: "Fixed (twips)"
123
- });
124
- t14 = /* @__PURE__ */ jsx("option", {
125
- value: "pct",
126
- children: "Percentage"
127
- });
128
- $[25] = t12;
129
- $[26] = t13;
130
- $[27] = t14;
131
- } else {
132
- t12 = $[25];
133
- t13 = $[26];
134
- t14 = $[27];
135
- }
136
- let t15;
137
- if ($[28] !== fieldIds.widthType || $[29] !== widthType) {
138
- t15 = /* @__PURE__ */ jsxs("select", {
139
- className: "border-input bg-background text-foreground flex-1 rounded border px-2 py-1.5 text-[13px] outline-none",
140
- id: fieldIds.widthType,
141
- onChange: t11,
142
- value: widthType,
143
- children: [
144
- t12,
145
- t13,
146
- t14
147
- ]
148
- });
149
- $[28] = fieldIds.widthType;
150
- $[29] = widthType;
151
- $[30] = t15;
152
- } else t15 = $[30];
153
- let t16;
154
- if ($[31] !== t10 || $[32] !== t15) {
155
- t16 = /* @__PURE__ */ jsxs("div", {
156
- className: "flex items-center gap-3",
157
- children: [t10, t15]
158
- });
159
- $[31] = t10;
160
- $[32] = t15;
161
- $[33] = t16;
162
- } else t16 = $[33];
163
- let t17;
164
- if ($[34] !== fieldIds.width || $[35] !== width || $[36] !== widthType) {
165
- t17 = widthType !== "auto" && /* @__PURE__ */ jsxs("div", {
166
- className: "flex items-center gap-3",
167
- children: [
168
- /* @__PURE__ */ jsx("label", {
169
- className: "w-20 text-muted-foreground text-[13px]",
170
- htmlFor: fieldIds.width,
171
- children: "Width"
172
- }),
173
- /* @__PURE__ */ jsx("input", {
174
- className: "border-input bg-background text-foreground flex-1 rounded border px-2 py-1.5 text-[13px] outline-none",
175
- id: fieldIds.width,
176
- min: 0,
177
- onChange: (e_0) => setWidth(Number(e_0.target.value) || 0),
178
- step: widthType === "pct" ? 5 : 100,
179
- type: "number",
180
- value: width
181
- }),
182
- /* @__PURE__ */ jsx("span", {
183
- className: "text-muted-foreground text-[11px]",
184
- children: widthType === "pct" ? "(50ths of %)" : "tw"
185
- })
186
- ]
187
- });
188
- $[34] = fieldIds.width;
189
- $[35] = width;
190
- $[36] = widthType;
191
- $[37] = t17;
192
- } else t17 = $[37];
193
- let t18;
194
- if ($[38] !== fieldIds.align) {
195
- t18 = /* @__PURE__ */ jsx("label", {
196
- className: "w-20 text-muted-foreground text-[13px]",
197
- htmlFor: fieldIds.align,
198
- children: "Alignment"
199
- });
200
- $[38] = fieldIds.align;
201
- $[39] = t18;
202
- } else t18 = $[39];
203
- let t19;
204
- if ($[40] === Symbol.for("react.memo_cache_sentinel")) {
205
- t19 = (e_1) => setJustification(e_1.target.value);
206
- $[40] = t19;
207
- } else t19 = $[40];
208
- let t20;
209
- let t21;
210
- let t22;
211
- if ($[41] === Symbol.for("react.memo_cache_sentinel")) {
212
- t20 = /* @__PURE__ */ jsx("option", {
213
- value: "left",
214
- children: "Left"
215
- });
216
- t21 = /* @__PURE__ */ jsx("option", {
217
- value: "center",
218
- children: "Center"
219
- });
220
- t22 = /* @__PURE__ */ jsx("option", {
221
- value: "right",
222
- children: "Right"
223
- });
224
- $[41] = t20;
225
- $[42] = t21;
226
- $[43] = t22;
227
- } else {
228
- t20 = $[41];
229
- t21 = $[42];
230
- t22 = $[43];
231
- }
232
- let t23;
233
- if ($[44] !== fieldIds.align || $[45] !== justification) {
234
- t23 = /* @__PURE__ */ jsxs("select", {
235
- className: "border-input bg-background text-foreground flex-1 rounded border px-2 py-1.5 text-[13px] outline-none",
236
- id: fieldIds.align,
237
- onChange: t19,
238
- value: justification,
239
- children: [
240
- t20,
241
- t21,
242
- t22
243
- ]
244
- });
245
- $[44] = fieldIds.align;
246
- $[45] = justification;
247
- $[46] = t23;
248
- } else t23 = $[46];
249
- let t24;
250
- if ($[47] !== t18 || $[48] !== t23) {
251
- t24 = /* @__PURE__ */ jsxs("div", {
252
- className: "flex items-center gap-3",
253
- children: [t18, t23]
254
- });
255
- $[47] = t18;
256
- $[48] = t23;
257
- $[49] = t24;
258
- } else t24 = $[49];
259
- let t25;
260
- if ($[50] !== t16 || $[51] !== t17 || $[52] !== t24) {
261
- t25 = /* @__PURE__ */ jsxs("div", {
262
- className: "flex flex-col gap-3 px-5 py-4",
263
- children: [
264
- t16,
265
- t17,
266
- t24
267
- ]
268
- });
269
- $[50] = t16;
270
- $[51] = t17;
271
- $[52] = t24;
272
- $[53] = t25;
273
- } else t25 = $[53];
274
- let t26;
275
- if ($[54] !== DialogClose) {
276
- t26 = /* @__PURE__ */ jsx(DialogClose, {
277
- className: "border-input rounded border px-4 py-1.5 text-[13px]",
278
- children: "Cancel"
279
- });
280
- $[54] = DialogClose;
281
- $[55] = t26;
282
- } else t26 = $[55];
283
- let t27;
284
- if ($[56] !== handleApply) {
285
- t27 = /* @__PURE__ */ jsx("button", {
286
- className: "bg-primary text-primary-foreground rounded px-4 py-1.5 text-[13px] font-medium",
287
- onClick: handleApply,
288
- type: "button",
289
- children: "Apply"
290
- });
291
- $[56] = handleApply;
292
- $[57] = t27;
293
- } else t27 = $[57];
294
- let t28;
295
- if ($[58] !== t26 || $[59] !== t27) {
296
- t28 = /* @__PURE__ */ jsxs("div", {
297
- className: "flex justify-end gap-2 border-t px-5 py-3",
298
- children: [t26, t27]
299
- });
300
- $[58] = t26;
301
- $[59] = t27;
302
- $[60] = t28;
303
- } else t28 = $[60];
304
- let t29;
305
- if ($[61] !== DialogPopup || $[62] !== t25 || $[63] !== t28 || $[64] !== t9) {
306
- t29 = /* @__PURE__ */ jsxs(DialogPopup, {
307
- className: "bg-popover fixed start-1/2 top-1/2 z-[10001] w-full max-w-[440px] min-w-[360px] -translate-x-1/2 -translate-y-1/2 rounded-lg border shadow-xl",
308
- children: [
309
- t9,
310
- t25,
311
- t28
312
- ]
313
- });
314
- $[61] = DialogPopup;
315
- $[62] = t25;
316
- $[63] = t28;
317
- $[64] = t9;
318
- $[65] = t29;
319
- } else t29 = $[65];
320
- let t30;
321
- if ($[66] !== DialogPortal || $[67] !== t29 || $[68] !== t8) {
322
- t30 = /* @__PURE__ */ jsxs(DialogPortal, { children: [t8, t29] });
323
- $[66] = DialogPortal;
324
- $[67] = t29;
325
- $[68] = t8;
326
- $[69] = t30;
327
- } else t30 = $[69];
328
- let t31;
329
- if ($[70] !== Dialog || $[71] !== handleOpenChange || $[72] !== isOpen || $[73] !== t30) {
330
- t31 = /* @__PURE__ */ jsx(Dialog, {
331
- open: isOpen,
332
- onOpenChange: handleOpenChange,
333
- children: t30
334
- });
335
- $[70] = Dialog;
336
- $[71] = handleOpenChange;
337
- $[72] = isOpen;
338
- $[73] = t30;
339
- $[74] = t31;
340
- } else t31 = $[74];
341
- return t31;
342
- }
343
- //#endregion
344
- export { TablePropertiesDialog_exports as n, TablePropertiesDialog as t };