akanjs 3.3.0-rc.40 → 3.3.0-rc.41
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/package.json +1 -1
- package/ui/Dialog/modalSurface.ts +6 -4
- package/ui/Field/Label.tsx +5 -2
- package/ui/Field/Text.tsx +2 -2
- package/ui/Model/EditModal.tsx +3 -3
package/package.json
CHANGED
|
@@ -23,21 +23,21 @@ const presentationClassNames: { [presentation in ModalPresentation]: SurfaceClas
|
|
|
23
23
|
dialog: {
|
|
24
24
|
root: "items-center justify-center p-4",
|
|
25
25
|
panel: "max-h-full max-w-2xl rounded-box border border-border",
|
|
26
|
-
close: "top-
|
|
26
|
+
close: "top-2.25",
|
|
27
27
|
handle: "hidden",
|
|
28
28
|
},
|
|
29
29
|
sheet: {
|
|
30
30
|
root: "items-stretch justify-stretch p-0",
|
|
31
31
|
panel:
|
|
32
32
|
"h-full max-h-full max-w-none rounded-none border-0 pt-[max(var(--akan-top-safe-area,0px),env(safe-area-inset-top,0px))] pb-[max(var(--akan-bottom-safe-area,0px),env(safe-area-inset-bottom,0px))]",
|
|
33
|
-
close: "top-[calc(max(var(--akan-top-safe-area,0px),env(safe-area-inset-top,0px))+
|
|
33
|
+
close: "top-[calc(max(var(--akan-top-safe-area,0px),env(safe-area-inset-top,0px))+1.3125rem)]",
|
|
34
34
|
handle: "flex",
|
|
35
35
|
},
|
|
36
36
|
auto: {
|
|
37
37
|
root: "items-stretch p-0 md:items-center md:justify-center md:p-4",
|
|
38
38
|
panel:
|
|
39
39
|
"h-full max-h-full rounded-none border-0 pt-[max(var(--akan-top-safe-area,0px),env(safe-area-inset-top,0px))] pb-[max(var(--akan-bottom-safe-area,0px),env(safe-area-inset-bottom,0px))] md:h-auto md:max-w-2xl md:rounded-box md:border md:border-border md:pt-0 md:pb-0",
|
|
40
|
-
close: "top-[calc(max(var(--akan-top-safe-area,0px),env(safe-area-inset-top,0px))+
|
|
40
|
+
close: "top-[calc(max(var(--akan-top-safe-area,0px),env(safe-area-inset-top,0px))+1.3125rem)] md:top-2.25",
|
|
41
41
|
handle: "flex md:hidden",
|
|
42
42
|
},
|
|
43
43
|
} as const;
|
|
@@ -51,13 +51,15 @@ const placementClassNames: { [placement in ModalPlacement]: Pick<SurfaceClassNam
|
|
|
51
51
|
},
|
|
52
52
|
} as const;
|
|
53
53
|
|
|
54
|
+
const sideSheetClose = "md:top-[calc(max(var(--akan-top-safe-area,0px),env(safe-area-inset-top,0px))+0.5625rem)]";
|
|
55
|
+
|
|
54
56
|
export const modalSurfaceOf = (presentation: ModalPresentation, placement: ModalPlacement) => {
|
|
55
57
|
const shape = presentationClassNames[presentation];
|
|
56
58
|
const side = placementClassNames[placement];
|
|
57
59
|
return {
|
|
58
60
|
root: [shape.root, side.root],
|
|
59
61
|
panel: [shape.panel, side.panel],
|
|
60
|
-
close: shape.close,
|
|
62
|
+
close: presentation === "sheet" && placement === "right" ? `${shape.close} ${sideSheetClose}` : shape.close,
|
|
61
63
|
handle: [shape.handle, side.handle],
|
|
62
64
|
};
|
|
63
65
|
};
|
package/ui/Field/Label.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "akanjs/client";
|
|
2
|
+
import { cn, usePage } from "akanjs/client";
|
|
3
3
|
import { capitalize } from "akanjs/common";
|
|
4
4
|
import type { ReactNode } from "react";
|
|
5
5
|
import { BiHelpCircle } from "react-icons/bi";
|
|
@@ -14,6 +14,7 @@ export interface LabelProps {
|
|
|
14
14
|
mode?: "view" | "edit";
|
|
15
15
|
}
|
|
16
16
|
export const Label = ({ className, label, desc, unit, nullable, mode = "edit" }: LabelProps) => {
|
|
17
|
+
const { l } = usePage();
|
|
17
18
|
return (
|
|
18
19
|
<span className={cn("flex shrink-0 items-center gap-1", className)}>
|
|
19
20
|
{typeof label === "string" ? capitalize(label) : label}
|
|
@@ -25,7 +26,9 @@ export const Label = ({ className, label, desc, unit, nullable, mode = "edit" }:
|
|
|
25
26
|
</span>
|
|
26
27
|
</Tooltip>
|
|
27
28
|
) : null}
|
|
28
|
-
{nullable ?
|
|
29
|
+
{nullable ? (
|
|
30
|
+
<span className="text-muted-foreground text-sm">{l.trans({ en: "(optional)", ko: "(선택)" })}</span>
|
|
31
|
+
) : null}
|
|
29
32
|
</span>
|
|
30
33
|
);
|
|
31
34
|
};
|
package/ui/Field/Text.tsx
CHANGED
|
@@ -120,7 +120,7 @@ const TextAreaField = ({
|
|
|
120
120
|
}}
|
|
121
121
|
disabled={disabled}
|
|
122
122
|
rows={rows}
|
|
123
|
-
className=
|
|
123
|
+
className="mb-0 h-full w-full"
|
|
124
124
|
inputClassName={cn("w-full focus:border-primary", inputClassName)}
|
|
125
125
|
validate={lengthValidator(l, minlength, maxlength, validate)}
|
|
126
126
|
onPressEnter={onPressEnter}
|
|
@@ -165,7 +165,7 @@ export const Email = ({
|
|
|
165
165
|
onChange(transform(value));
|
|
166
166
|
}}
|
|
167
167
|
disabled={disabled}
|
|
168
|
-
className=
|
|
168
|
+
className="mb-0 w-full"
|
|
169
169
|
inputClassName={cn("w-full focus:border-primary", inputClassName)}
|
|
170
170
|
inputStyleType={inputStyleType}
|
|
171
171
|
validate={lengthValidator(l, minlength, maxlength, validate)}
|
package/ui/Model/EditModal.tsx
CHANGED
|
@@ -272,7 +272,7 @@ export default function EditModal<Full extends { id: string }>({
|
|
|
272
272
|
? null
|
|
273
273
|
: renderTitle
|
|
274
274
|
? typeof renderTitle === "string"
|
|
275
|
-
? `${l(`${modelName}.modelName` as "base.success")}${renderTitle === "default" ? "" : ` - ${(modelForm as DynamicRecord)[renderTitle]
|
|
275
|
+
? `${l(`${modelName}.modelName` as "base.success")}${renderTitle === "default" ? "" : ` - ${(modelForm as DynamicRecord)[renderTitle] || l("base.new")}`}`
|
|
276
276
|
: renderTitle(modelForm)
|
|
277
277
|
: null;
|
|
278
278
|
};
|
|
@@ -314,7 +314,7 @@ export default function EditModal<Full extends { id: string }>({
|
|
|
314
314
|
return (
|
|
315
315
|
<Button
|
|
316
316
|
{...agentAttrs(submitModel)}
|
|
317
|
-
className={cn("
|
|
317
|
+
className={cn("w-full gap-2", type !== "modal" && "mt-4", submitClassName)}
|
|
318
318
|
disabled={isBlocked}
|
|
319
319
|
onClick={async (e, { onError }) => {
|
|
320
320
|
await handleSubmit({ onError });
|
|
@@ -328,7 +328,7 @@ export default function EditModal<Full extends { id: string }>({
|
|
|
328
328
|
</Button>
|
|
329
329
|
);
|
|
330
330
|
},
|
|
331
|
-
[disabled, modelFormId],
|
|
331
|
+
[disabled, modelFormId, type],
|
|
332
332
|
);
|
|
333
333
|
const editProps = { type, slice, className, draftBarClassName, checkSubmit, edit, modal, loadingWrapper };
|
|
334
334
|
if (type === "modal")
|